You may want to use SetLocalVarInt rather than AddLocalVarInt - 'Set' merely sets the variable you specify to the value you specify, wheras 'Add' actually adds the value you specify to the total that the variable holds. That should explain why it worked the first time, although there might be another problem as well.
SetLocalVarInt("Int", 1);
AddLocalVarInt("Int", 1);
// "Int" now equals 2
SetLocalVarInt("Int", 1);
SetLocalVarInt("Int", 1);
// "Int" still equals 1
(06-12-2013, 09:59 PM)Bridge Wrote: Well I don't know what's wrong with your script but seeing as integers generally take up 4 bytes and Boolean variables only 1 you save a whole bunch of space that otherwise goes towards doing nothing. A good general rule of thumb is to use as few resources as you possibly can to achieve what you want. Doesn't do anything to make your code more functional, just more efficient.
The potential problem with using a bool is that there is no engine function to set a bool variable, and only variables set by the engine functions will be saved when you exit/reload your game. Any variables declared simply using bool MyBool = true; in the global scope of the script will therefore be re-initialized when the map reloads. It could then present some weird behaviors for the puzzle if the player saves & exits, or just goes out of the map and back in, although your absolutely right if that risk is managed correctly