zodd 14 Posted April 18, 2012 Gday all, I have a script which is working very well for a single call (allows user to pass information to set up a gun unit with type of round, accuracy, ammo etc) What I am looking at doing is extending the script to allow multiple different instances... My plan - Add an integer to the call and change all the variables in the script to array types eg. (simplified for concept) CURRENT: [gun, rounds, ammo] execVM "myscript.sqf"; which creates the following var: (eg) trigger_adjust trigger_fire ammo Can I amend the whole script to something like: [positioninarry, gun, rounds, ammo] execVM "myscript.sqf"; which creates the following var: (eg) trigger_adjust[positioninarray] trigger_fire[positioninarray] ammo [positioninarray] Is this functional or is there an easier way? I will do some more experimenting when I can but keen to avoid reinventing the wheel if possible as the current script series is fairly large! Much appreciated! Share this post Link to post Share on other sites
PELHAM 10 Posted April 19, 2012 (edited) You could do that with a variable in the script: No need to do that outside of the script, you can change the variables each time it runs with conditions and control structures: _scriptRuns = 0; _scriptRuns = _scriptRuns +1; _number = str(_scriptRuns); switch (_number) do { case "0" : { change variables here...... }; case "1" : { change variables here...... }; case "2" : { change variables here...... }; }; http://community.bistudio.com/wiki/Control_Structures#switch-Statement http://community.bistudio.com/wiki/Variables You could build an array within a script to execVM, Call or Spawn another script with (not tested this but it should work): http://community.bistudio.com/wiki/Array#Addition _array1 = [[0,0,0]]; _array2 = [gun, rounds, ammo]; _array3 = _array1 + _array2 //_array3 will return [[0,0,0],gun, rounds, ammo]; _array3 execVM "somethingsomethingdarkside.sqf"; Edited April 19, 2012 by PELHAM Share this post Link to post Share on other sites