Home   Help Search Login Register  

Author Topic: "Is vehicleX part of array? Then......" how is it done?  (Read 491 times)

0 Members and 1 Guest are viewing this topic.

Pimmelorus

  • Guest
Hmm, I forgot about and I just cannot remember.

I have an array of vehicles "choppers"

In my script I want to check if a particular vehicle is part of this array. the reasoning is as followed:

?(vehicleA xxxx choppers): bla bla bla

What is the command to put on the xxxx?

Thnx in advance,

Pimmelorus

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:"Is vehicleX part of array? Then......" how is it done?
« Reply #1 on: 11 Apr 2003, 09:00:22 »
x in array
Operand types:
    x: Any Value
    array: Array
Type of returned value:
    Boolean
Description:
    Check if x is equal to any element of array.

Example:
    1 in [0, 1, 2] , result is true

Plenty of reviewed ArmA missions for you to play

Pimmelorus

  • Guest
Re:"Is vehicleX part of array? Then......" how is it done?
« Reply #2 on: 11 Apr 2003, 10:15:29 »
Ah I interpreted the "value" in the command reference as a strickt  numerical variable. But I guess its not then :)

Thnx, Pimmelorus

Pimmelorus

  • Guest
Re:"Is vehicleX part of array? Then......" how is it done?
« Reply #3 on: 11 Apr 2003, 11:23:05 »
I have another problem now. Fact is activation of script.sqs works:

<assume here the vehicle is of class A>
?(_class == A OR _class == B): _vehicle exec "script.sqs"

I am using many vehicle types so I dont want to write "OR _class == etc. etc." for each vehicle type. My solution for tis was to declare an array of vehicle types in the init.sqs that contains the appropriate groups of vehicle types. like this:

In init.sqs
classes = ["A","B"]

But now if I want to activate the script.sqs again like this:

?(_class in classes): _vehicle exec "script.sqs"

this does not work. Does anyone know why?

Yhnx, Pimmelorus