Trouble with Variables


#1

When I create my scenes, I have this in mind: One chapter will have several scenes (4 to 5 maybe) and the whole game will span maybe 3 to 6 chapters or so.

So there are some variables, let’s say var1 in scene c1-1 that I would like to persist until scene c1-5 because of plot reasons, but that’s all. The variable would not be used anywhere else after that. However, since the temp variable does not allow it to be carried over to other scenes, the only way left - at least that’s what it appears to be in the wiki - is to declare it a global variable.

My question is, is there a way to carry over variables to other scenes? Or should I just lump them together as 1 scene, at the risk of increasing load time/lag/crashes?


#2

Hi, you can use the *create command in the startup.txt file instead. :wink:


#3

The only way here I can see is to make a permanent variable, unless you want to lump them together.


#4

If you’re going to use it through a good chunk of the game, I’d suggest just creating it as a global variable.

That said, I’ve got a few global variables called rollover1, rollover2, etc. that I use when I want a *temp in one scene to be remembered in the next. If I need it in 3 or 4 scenes, though, I’d make it global. Otherwise I’d just be multiplying "rollover"s at the cost of clarity.


#5

I see. I don’t think it neither extends long nor is important enough to warrant a global… guess I’ll lump them together. Thanks for the answer!


#6

is it possible to make the var1 pop up again in the next scene as you say?

so like a To Be Continued thing.


#7

Maybe this answer’s your question too, @The_Chosen_Plump?

Try using @Havenstone’s method, I’ll try and do a quick example.

Startup:
*create rollover1 false

Scene 1:
*temp decision1 false
Are you single?
*fake_choice
  #True
    *set decision1 true
  #False
    *set decision1 false
*set rollover1 decision1
*goto next scene

…two scenes from now

    Scene 3:
    *temp decision1
    *set decision1 rollover1
    You made a decision 2 scenes ago, "are you single?" The value is ${decision1}.

See, you can reuse rollover1 whenever you’re actually finished with the temp “decision1.”