Home   Help Search Login Register  

Author Topic: True or false  (Read 1290 times)

0 Members and 1 Guest are viewing this topic.

Hartza

  • Guest
True or false
« on: 03 Sep 2002, 14:03:05 »
I have a mission where one trigger executes on script named chopper1hunt.sqs. Script send an chopper to hunt men flying with ultralight planes. Anyway, that part works great.

Idea: I dont want this chopper to hunt my men for ever, but say about 3 minutes.

Inside that chopper1hunt.sqs is an global variable named attack and same trigger that executes that script, sets that variable to true. OK, so far everything is working fine.

I have an other trigger set to be activated with 180sec delay and which condition is attack and on activation attack= false.

So, now I have trigger that sets this variable to true and trigger that sets it to false. These seems to work OK.

Problem: How do I use this variable mode change in my script ?

I have tried something like this:
?attack=false:goto "gohome"

idea is that when trigger sets variable to false, chopper is heading to home and stops hunting.

But, I allways get error like : ?attack |#|=false (and something text which I dont remember )

What should I do  ???

Offline icarus_uk

  • Members
  • *
  • LiarLiarPants Inflame True
    • [furryclan]
Re:True or false
« Reply #1 on: 03 Sep 2002, 14:24:17 »
What you are looking for is;

!attack

ie when attack is false (not true).  If you have a looping script you can use;

?!(attack) : goto "GoHome"

As this will be checked in each loop.  However once checked it wont check again until the script runs around again.  If you are running the script once, and want the script to wait for the condition to be false and then continue just use;

@!(attack)

And then all your "gohome" things underneath.

Bremmer

  • Guest
Re:True or false
« Reply #2 on: 03 Sep 2002, 14:27:15 »
For boolean variables you do not need to specify true/false in evaluation statements. eg.

? attack : goto "gohome"

will send your script to #gohome when attack is true.

? not attack : goto "gohome"

will send your script to #gohome when attack is false.

Be careful when using boolean variables with the 'not' command (make sure you define them as true or false in an init file, or line). This is dangerous because an undefined boolean is not classified as false in the statement:

? not undefined_boolean

Hope that helps.

[edit] damn this slow keyboard!  ;)[/edit]
« Last Edit: 03 Sep 2002, 14:28:32 by Bremmer »

Hartza

  • Guest
Re:True or false
« Reply #3 on: 03 Sep 2002, 14:31:11 »
Thanks icarus_uk !

I knew, it has something to do with how to write that attack is false line, but couldnt figure out the proper way :P

Thanks now my mission is complete  ;D

Thanks again BOTH of you guys  ;)
« Last Edit: 03 Sep 2002, 14:33:24 by Hartza »