OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: rfountain on 09 Sep 2002, 10:00:27

Title: Group commands using forEach
Post by: rfountain on 09 Sep 2002, 10:00:27
Hi All,

I have looked through the forums several times looking for a posting regarding the use of the forEach command

It detailed an issue of using status commands that contain ""s, like "Safe" or "Green".  It mentioned assigning a variable to these commands and using the variable in the forEach command.

If anyone could point me in the direction of the posting or let me know if this is even possible, that would be great.

Thanks

Robert
Title: Re:Group commands using forEach
Post by: Black_Feather on 09 Sep 2002, 14:23:15
like this

behav = "safe";"_x setBehaviour behav" foreach units this
Title: Re:Group commands using forEach
Post by: DeusRich on 09 Sep 2002, 19:44:50
the forEach command is easy enough to use, once you have defined a group:

thegroup = group this

and then you put in "speech marks" the command, except using _x instead of a unit, like this:

"_x setdammage 1.0"

then, after that, you put forEach units thegroup, or you could have vehicles i think, or anything, it just means:
foreach: for every one of:
units: any units
in thegroup

so, you would end up with:

"_x setdammage 1.0" forEach units thegroup

hope you understand....
Title: Re:Group commands using forEach
Post by: toadlife on 10 Sep 2002, 06:24:40
You dont have to assign a variable for the behavior, you just have to remember that when using quotes inside of quotes, the quotes inside the quotes must be double quotes.

LOL!!!

For example:

"_x setbehaviour ""safe""" foreach units group1

Notice that "safe" has double quotes around it.

This applies to alot of OFP commands, for example If you wanted quotes to appear on the screen you would have to do the double-quote thing, like this:

Code: [Select]
titletext["""Hello!""","plain"]

This would make "Hello!" appear in (with the quotes) on the screen.
Title: Re:Group commands using forEach
Post by: rfountain on 11 Sep 2002, 06:26:02
Cool

I will try that

ThX!!!! :D