Home   Help Search Login Register  

Author Topic: Group commands using forEach  (Read 1215 times)

0 Members and 1 Guest are viewing this topic.

rfountain

  • Guest
Group commands using forEach
« 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

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
Re:Group commands using forEach
« Reply #1 on: 09 Sep 2002, 14:23:15 »
like this

behav = "safe";"_x setBehaviour behav" foreach units this

DeusRich

  • Guest
Re:Group commands using forEach
« Reply #2 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....

Offline toadlife

  • OFPEC Old Skool
  • Former Staff
  • ****
  • Official OFP Editing Center Toad
    • toadlife.net
Re:Group commands using forEach
« Reply #3 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.
"Whenever you want information on the 'net, don't ask a question; just post a wrong answer." -- Cancer Omega.

rfountain

  • Guest
Re:Group commands using forEach
« Reply #4 on: 11 Sep 2002, 06:26:02 »
Cool

I will try that

ThX!!!! :D