uhmattbravo Posted October 9, 2016 Share Posted October 9, 2016 (edited) Wouldn't, I don't know the technical term, staging a variable be more efficient than a timer? Sorry I don't know how to properly post scripts from my phone, but for example: Short myVariable Begin onActivate player Set MyVariable to 1 End Begin GameMode If MyVariable == 1 If player.getitemcount thingA > 0ContainerRef.additem thingB 1Set myVariable to 2 Elseif player.getitemcount thingC > 0ContainerRef.additem thingD 1Set MyVariable to 2 Else ContainerRef.additem thingE 1Set MyVariable to 2 Endif Elseif myVariable == 2 ContainerRef.Activate player ;though I assume it could be just "activate" since the script is presumably on the container anyway.Set MyVariable to 0 End if End Edited October 9, 2016 by uhmattbravo Link to comment Share on other sites More sharing options...
Mktavish Posted October 10, 2016 Share Posted October 10, 2016 Thanks for the explanation guys. And I know that is just an example script.But couldn't you just skip the game mode block having all that execute within an OnActivate block ? I guess the reversal of that would be more what the OP might find useful ? A game mode block running to detect triggering events so to speak. That then sets variables.Which an OnActivate block would then place items in the container based on the variables. Link to comment Share on other sites More sharing options...
uhmattbravo Posted October 10, 2016 Share Posted October 10, 2016 (edited) Sometimes if too many actions are triggered at once in one if, especially if they're all on one ref, things can either happen in the wrong order, or otherwise not work as intended. Separating them either with a timer or stages helps make sure it all happens in the order you want it to. In this case, it'll make sure the item gets added before the PC actually opens the container. The gamemode block just allows the timer or stages to be checked more than once (which they need to be) whereas the onActivate block only runs once per activation. That'd advance the timer or stage, but you'd need to click it a second time to actually open the container. I have noticed though that in my example, it'll keep adding the items every time you activate the container. I should have had that last command set myvariable to 3 instead of 0. Edited October 10, 2016 by uhmattbravo Link to comment Share on other sites More sharing options...
RoyBatterian Posted October 11, 2016 Share Posted October 11, 2016 Either way, depends on how long it needs to wait. Sometimes can't do stuff too quick or the engine will puke, but shouldn't be an issue in this case. Link to comment Share on other sites More sharing options...
Mktavish Posted October 11, 2016 Share Posted October 11, 2016 Ahh ... Ok that explains it. Thanks guys. Link to comment Share on other sites More sharing options...
Recommended Posts