Numeric value resetting in new scenes

I have a numeric variable that has a starting value of 0 and gets set to 1, 2, or 3 during the first scene. It definitely works in the first scene, both for multireplace and *if, Weirdly, once scene 2 starts, it reverts to 0. Any idea what could be going wrong?

Possibly a stupid question but are you using permanent variables or temp variables?

I’m not using *temp, is there any way it could still be temporary?

I’m not really gifted enough with the coding side to tell what is going on without the code in front of me. If you have the game up anywhere post the link and I can try taking a look at it, otherwise perhaps one of the more talented coders on the forum will see this and have some thoughts.

Is scene 2 a separate file?
Are you setting the value to 0 anywhere in your code?
Are you using any gosub commands which might be taking the code somewhere and altering the value?

If nothing obvious comes to mind then print out the value of the variable at different points. Then you can locate exactly when it is set to 0. That should pinpoint the line of code that is doing it

I will give this is a shot! The scene is a separate file, but listed in order in the scene list. To my knowledge the value never gets set to zero except in startup, but I’ll investigate…

Is variable is properly declared in your startup.txt?
(*create your_variable 0)


could you send the code? there might be some that’s unintentionally altering the variable.