Home   Help Search Login Register  

Author Topic: From script to script question  (Read 696 times)

0 Members and 1 Guest are viewing this topic.

Ace Productions

  • Guest
From script to script question
« on: 21 Nov 2003, 23:32:52 »
Hi everyone,

my question is how can I use returned values from one script to another. For example I use an EH and in the EH activated script I have:

_unit=_this select 0
_tank=_this select 1

How can I use _tank in another script and refer to the same unit as the EH script?  :)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:From script to script question
« Reply #1 on: 22 Nov 2003, 00:54:29 »
You can't do it directly.

A variable starting with _underscore is a local variable and applies only to the script in which it lives.   A variable which does not start with an underscore is global and applies to all scripts (and everywhere else).   Of course you can change the value of a variable as often as you like, just remember that it can only have one value at a time.   If you want to "cancel" it use variable=null (I think).

In other words, to pass a value from one script to another use a global variable.  

_tank = tank1

(Note that in MP it gets more complicated.)
Plenty of reviewed ArmA missions for you to play

KyleSarnik

  • Guest
Re:From script to script question
« Reply #2 on: 22 Nov 2003, 06:28:18 »
You can transfer a local varibale through parameters. So in that script:

[_tank] exec "script2.sqs"

and just have _tank = _this select 0 in script2.sqs and your good....