OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: The-Architect on 26 Mar 2008, 03:05:24

Title: Checking mutliple conditions
Post by: The-Architect on 26 Mar 2008, 03:05:24
I've been out of the loop for too long.
How do I check if multiple conditions have been met an a script?

Let's call my conditions,
Con1
Con2
Con3

Appreciate it. Cheers.
Title: Re: Checking mutliple conditions
Post by: Nexolate on 26 Mar 2008, 07:16:15
Wouldn't you use a GameLogic Unit?

Create an "AND" Waypoint off it, then synchronise seperate Triggers with each of the conditions to that Waypoint?
It's in the Guide on the site if I haven't made myself clear enough.
Title: Re: Checking mutliple conditions
Post by: Wolfrug on 26 Mar 2008, 10:06:54
Code: (SQF) [Select]
if (Con1 && Con2 && Con3) then {blah blah}
or

Code: (SQS) [Select]
? Con1 && Con2 && Con3 : blah blah
or for a trigger

Code: (trigger) [Select]
Condition: Con1 && Con2 && Con3
On activation : Blah blah

Not much harder than that. ;)

Wolfrug out.
Title: Re: Checking mutliple conditions
Post by: The-Architect on 27 Mar 2008, 00:23:38
Cheers for the syntax Wolfrug.

Here's what's not working.
I have four triggers. Each of the triggers are set to BLUFOR. On activation in each is 1Clear 2Clear 3Clear respectivley.
Here's my code.

Code: [Select]
#Start
? 1Clear && 2Clear && 3Clear : goto "exit"
~1
goto "Start"


#Exit
hint "All CLear"
Exit

Nothing is happening once all my guys have past through the triggers.  :(
Title: Re: Checking mutliple conditions
Post by: myke13021 on 27 Mar 2008, 00:29:21
I guess it's up to me to ask the dumb questions  :D

In the on activations, did you clearly typed:
1clear = true

Did you tried to hint out the status of the conditions?
Title: Re: Checking mutliple conditions
Post by: The-Architect on 27 Mar 2008, 00:51:12
Yes to both.

If I use Wolf's code;

Code: [Select]
Condition: Con1 && Con2 && Con3
On activation : Blah blah

then it asks me for missing (



Fixed it.
Although I originally said my condidtions were Con1, 2 etc. When I wrote the script I made the conditions 1Clear, 2Clear, etc. ArmA Doesn't like the first character in a condition to be a number so I swapped the number to the end and made the conditions Clear1, Clear2 etc. Now it works fine.
Thanks for the help guys.  :good: