Home   Help Search Login Register  

Author Topic: setmarkertype empty for an array  (Read 1356 times)

0 Members and 1 Guest are viewing this topic.

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
setmarkertype empty for an array
« on: 15 Apr 2003, 18:48:21 »
In the init.sqs i want to setmarkertype empty for an array of markers

my array is

markerarray = [marker1, marker2, marker3]
the elemnts of the array being the names ogf the markers

i have tried the following lines

setmarkertype "empty"  foreach markerarray
"setmarkertype "empty""  foreach markerarray
{setmarkertype "empty"}  foreach markerarray

i just keep getting an error based on the "empty" command

this is so easy and i have gone completely blank, please help :'(

please dont respond with
Why dont you use "marker1" setmarkertype "empty"


as i need to run it on an array who's elements change due to a prior selection


Thx in advance
« Last Edit: 15 Apr 2003, 18:49:05 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:setmarkertype empty for an array
« Reply #1 on: 15 Apr 2003, 20:40:20 »
In the Comref it says:

"_x setdammage 1" forEach units group player

so i guess in your case it's:

{_x setmarkertype "empty"} forEach markerarray

 ???
« Last Edit: 15 Apr 2003, 20:40:51 by DrStrangelove »

Tactician

  • Guest
Re:setmarkertype empty for an array
« Reply #2 on: 15 Apr 2003, 21:25:06 »
Are marker1, marker2, and marker3 markers or variables that contain names of markers?  If they are markers, your array needs to look like this:

markerarray = ["marker1", "marker2", "marker3"]

And then you run this on it:

{_x setMarkerType "EMPTY"}  forEach markerarray

You simply can not do anything with forEach without _x in the code string.  If the element _x points to is a string, it will use the string for _x.  If it points to a variable containing a string, it will use the string for _x.
« Last Edit: 15 Apr 2003, 21:26:02 by Tactician »

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:setmarkertype empty for an array
« Reply #3 on: 16 Apr 2003, 01:21:23 »
You simply can not do anything with forEach without _x in the code string.

Minor point... that's not quite correct ;)

You can use the line:

"unit addmagazine ""m16""" foreach [1, 2, 3, 4]

To give unit 4 M-16 magazines... there's no _x in that code line.

However, for the situation in question, Tactician has hit the nail right on the head :)
Also, when working with markers, remember that their names should always be in quotes...

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:setmarkertype empty for an array
« Reply #4 on: 16 Apr 2003, 01:51:37 »
ah thanks folks, i was missing the quotation marks surrounding the array elements

i had tried the _x initially and with all the other bits n bats, just couldnt understand why my markers werent disappearing
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123