Azz -GUN- 0 Posted October 30, 2002 How the hell do i check if a variable is true ? i have a trigger on activation overLZ=true then in my script there is a loop what is it i thought it was ?(overLZ == true) dosent work. Share this post Link to post Share on other sites
bn880 5 Posted October 30, 2002 just initialize overLZ to false first overLZ = false do it in that script if you are sure it won't be set true before. Share this post Link to post Share on other sites
Azz -GUN- 0 Posted October 30, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> overLZ=false #loop ?(overLZ==true) : goto "Eject" goto "loop" #Eject _Array = units aP _Count = count _Array _x = 0 #EjectLoop _Unit = _array select _x _Unit action ["EJECT",Chopper1] ~3 _x = _x + 1 ?(_x < _count) : goto "EjectLoop" exit<span id='postcolor'> I just get error it dosent like the bool it expects something else Share this post Link to post Share on other sites
bn880 5 Posted October 30, 2002 oh try ?overLz: goto "eject"; Share this post Link to post Share on other sites
Azz -GUN- 0 Posted October 30, 2002 just crashes now Grr what have BIS Done im sure you used to be able to put it in the () and have == true Share this post Link to post Share on other sites
bn880 5 Posted October 30, 2002 what the? the () should be no problem crashes? maybe because of instructions in Eject portion? Share this post Link to post Share on other sites
Azz -GUN- 0 Posted October 30, 2002 This should be freeking simple! Share this post Link to post Share on other sites
bn880 5 Posted October 30, 2002 units aP? units group aP right? you must be accessing something incorrectly to crash EDIT: NEVER MIND, I will go and test this script... it's bugging me now. Share this post Link to post Share on other sites
Azz -GUN- 0 Posted October 30, 2002 hehe dont stress over it i have started a fress mission now and it seems to work so far Share this post Link to post Share on other sites
bn880 5 Posted October 30, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">overLZ=false #loop ?(overLZ): goto "Eject" ~0.001 goto "loop" #Eject _Array = units aP _Count = count _Array _x = 0 #EjectLoop _Unit = _array select _x _Unit action ["EJECT",Chopper1] ~3 _x = _x + 1 ?(_x < _count) : goto "EjectLoop" exit<span id='postcolor'> works for me make sure to name the guy aP and chopper Chopper1 Share this post Link to post Share on other sites
kkkonge 0 Posted November 23, 2002 A hint: Don't use script-loops if you want to continuosly check some state. When saving the game during the running of such a looping script, OF will not re-start the script when you reload the savegame. Instead, use a recursive trigger: Define some arbitrary variable (say varCheckState) as true in your init.sqs. Also add a 1 sec. delayed, repeated GameLogic trigger that activates on varCheckState. During its activation (ie in the On Activation field) you falsify varCheckState and run a checking script. This can also be done at the end of your script. In the On Deactivation field you negate varCheckState again (to 'TRUE', that is). This way the trigger will run the checking script once every second. This allows for easier coding, and as the varCheckState variable is saved in the savegame, it will re-/deactivate the GameLogic trigger upon reload. If you want to run the checking script only when a certain condition is met, you just add some boolean state to the Condition field of your trigger. Share this post Link to post Share on other sites
bn880 5 Posted November 23, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (kkkonge @ Nov. 23 2002,10:54)</td></tr><tr><td id="QUOTE">A hint: Don't use script-loops if you want to continuosly check some state. When saving the game during the running of such a looping script, OF will not re-start the script when you reload the savegame.<span id='postcolor'> It should, if it didn't then all scripts would be useless for people who want to save games. Edit: I should have said, the save and load should be fairly transparent to the script execution since script and variable states are saved and then restored. Scripts are not re-started, they continue where they left off. Share this post Link to post Share on other sites