Tankbuster 1747 Posted June 22, 2014 I've been staring at this for a few days now without figuring out what is broken, so I thought I'd ask you guys. I have a while statement that needs to use a flag with a dynamic variable name. This works; while { iris_active_0 } do { and that's fine. But the script needs to work with a number of flags, namely iris_active_1, iris_active_2 etc etc So i tried this, call compile format ["while { iris_active_%1 } do {", _serial]; But it gives an error; 2014/06/22, 22:16:39 Error in expression <while {iris_active_0} do> 2014/06/22, 22:16:39 Error position: <> 2014/06/22, 22:16:39 Error Invalid number in expression _serial is a scalar number, I checked in debug. So, 2 questions, why isn't it working as expected and is there a better way of doing this? Thanks in advance, Tanky -Paul- Share this post Link to post Share on other sites
terox 316 Posted June 22, 2014 while{call compile format ["Iris_Active_%1",_serial]}do { .............. }; Share this post Link to post Share on other sites
zooloo75 834 Posted June 22, 2014 You can also put the loop inside of a [] spawn {} Share this post Link to post Share on other sites
Tankbuster 1747 Posted June 24, 2014 That's got it, Terox! Thanks mate. :) Share this post Link to post Share on other sites
Larrow 2823 Posted June 24, 2014 You could also replace call compile with missionNamespace getVariable if your workking with global variables while{missionNamespace getVariable (format ["Iris_Active_%1",_serial]) ] }do { .............. }; Share this post Link to post Share on other sites
Tankbuster 1747 Posted June 24, 2014 Yes, I was thinking about this method, Larrow. These variable are global, public, in fact and so I have been mulling over replacing much of my call compile format with setvariable. I was going to put an object in each of the locations that iris works on (it's Island Random Incident System BTW) and store the flag there using setvariable. Share this post Link to post Share on other sites