OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Mr.Peanut on 19 Oct 2005, 00:48:28
-
Could someone please verify the syntax of the following 2 code lines?
e.g.
smb_List20 = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]
{{[_x] exec "FOX2_HDConvAI.sqs"} forEach units (call format["gra_%1",_x])} forEach smb_List20
where gra_0 to gra_19 are groups.
-
I think You need a semi-colon:
{{[_x] exec "FOX2_HDConvAI.sqs"} forEach units; (call format["gra_%1",_x])} forEach smb_List20
-
no, you don't want a semicolon, that is correct syntax
-
Yes, you are right, sorry, I thought "units" was another array name and you were trying to do two commands for the second "forEach". Your syntax was correct! Oops. :-X
-
Okay,
Next question in this vein. What if a nested forEach needs two temporary variables i.e. _x.
{{_x doFire _y} forEach units grpA} forEach units grpB
-
Okay,
Next question in this vein. What if a nested forEach needs two temporary variables i.e. _x.
{{_x doFire _y} forEach units grpA} forEach units grpB
Just use:
{_y=_x ; {_x doFire _y} forEach units grpA} forEach units grpB
-
so, are you trying to have something like this?
x1 -> y1
x2 -> y2
x3 -> y3
etc
where the arrow is shooting
so that each member of one group is shooting their corresponding unit from the other group? otherwise what you'll end up with is every unit looping through til the end of the other groups list and killing that one
there is no way to do what you're trying to do, if i'm right about what you're trying, with foreach, simply not possible
-
The code I posted was just a possible example.