Home   Help Search Login Register  

Author Topic: How to check if xy = true or xy = false ?  (Read 951 times)

0 Members and 1 Guest are viewing this topic.

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
How to check if xy = true or xy = false ?
« on: 03 Sep 2008, 01:26:46 »
Hi guys.

I found a thread about this issue, but it was not very helpful to me...


I have a chopper patroling around. When the player reaches a certain trigger, a script is launched that checks if xy = true or false. If it's true, the chopper has to fly to position A, if xy = false, it has to fly to position B.

How would this script have to look?

I tried

? xy = true : chopper to A
? xy = false : chopper to B

but obviously I received a error message, this seems not to be the right way to check it.


Would be glad if someone can give me a good code. :)

Thank you very much!!
Current project: Black Lands (Arma 3)

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: How to check if xy = true or xy = false ?
« Reply #1 on: 03 Sep 2008, 01:54:21 »
= is used for assignment, but == tests for equality. Can be confusing at first, since you are used to = being used for equality in mathematics.

Thus, this is what you could have done to get the result you expected.
Code: [Select]
? xy == true : chopper to A
? xy == false : chopper to B

However, since ?: checks for true/false anyway, it is more usual to:
Code: [Select]
? xy : chopper to A
? not xy : chopper to B
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Undeceived

  • Members
  • *
    • My missions and campaigns
Re: How to check if xy = true or xy = false ?
« Reply #2 on: 03 Sep 2008, 02:15:30 »
Aah, great!

Thank you, Spooner! It works perfectly! :good:
Current project: Black Lands (Arma 3)