How to modify name of variable inside if statement

I am having a bit of trouble with my game, which uses many random variables (I know they are not really recommended, and I am starting to understand why…). Anyway I am trying to find a way around a problem where if a player clicks on the stats button in the middle of a fight when he turns back the computer the re-calculates all random number. Thus, I came up with the idea of having all these random numbers be generated at the beginning of the fight, and then used sequentially. So, for the first round of combat die_roll_1 would be used, then die_roll_2, etc. However, how can I program this? I was thinking something like

*set round +1

*if die_roll_{round} < (laser_attack)

But that does not seem to work… any ideas?

Hard to say without seeing much more of the intended combat routine. However, the simplest solution may be to have a *page_break between each round of combat, allowing you to generate the next round’s random number(s) just before the *page_break itself, so those values remain unaffected by an impromptu visit to the Stats screen.

If looping tightly through the combat routine, however, *setref might be what you’re looking for:

1 Like

@Vendetta Thanks so much for the help, I did as you said (or at least I think so) and it worked, much appreciated!!!

Okay, thanks for that. I knew the stat screen thing happened, but didn’t know how to avoid it.

Okay, so I’ll admit that I don’t know how this random variable thing will work- that’s entirely up to you. But, I -do- have a functional time progression in my game which dictates events happening in certain ways. The way I have set it up is, basically, at the beginning…

*create time 1 (or whatever number- as it happens, this would, for you, signify turn 1 in this fight of yours.)

Then, at some point in your story, create a *label like

*label timeprogressionchart
*if time = 1
*set time +1
*goto fightsceneA
*elseif time = 2
*set time +1
*goto fightsceneA
*elseif time = 3
*set time +1
*goto fightsceneA
*else
*set time +1
*goto fightsceneend

And then another *label like
*label fightsceneA
*if time = 1
(battle for turn 1, stats for turn 1)
*goto timeprogressionchart
*if time = 2
(battle for turn 2, stats for turn 2)
*goto timeprogressionchart
*if time = 3
(battle for turn 3, stats for turn 3)
*goto timeprogressionchart

And
*label fightsceneend
(battle description for how the battle ends)

Well, with proper indentation. For some reason I can’t get it to indent, here.