Numerical values keep changing when leaving and entering the Show stats menu

I’ve got a weird problem happening with my test demo. As shown here, this is the HP value before entering the stats screen:

image

Then, once you go into the stats menu then come back:

image

This happens. The *set routine I have written constantly rolls again whenever I leave the stats screen. Is there a way to stop this from happening, or am I screwed?

1 Like

Are you using *rand by any chance?

1 Like

Make another label that doesn’t have the command that’s changing that stat so the script stops there and doesn’t change the value every time it comes back.

1 Like

One thing I used was making sure you have a page break or something after randomizing but before the result was visible. Makes the result lock in.

2 Likes

Aaaah. I see. Yes, I am using rand. Damn. I figured it’d only roll once. Sorry, forgot to make that clear. Is there a way to lock the roll once the option is selected?

*rand rerolls every time you go to the stat screen.

What you need to do is use *rand before you actually need it. Like this.

*label random_roll
*rand die 1 6
You walk up to the table.
*page_break
You roll the dice and you get ${die}.

or if it’s rolled after a choice.

*rand die 1 6
*choice
    #Attack with a sword.
        You deal ${die} points of damage.
        *goto next_scene
    #Attack with an axe.
        You deal ${die} points of damage.
        *goto next_scene
3 Likes

Ah! Perfect. I spent a good two hours trying to figure this out before I gave up and came here. Thanks for the help as always, and thanks to all who chimed in. Cheers! :slight_smile:

5 Likes

Yes, it happened to me before too, just one more thing you learn in the process. A lot of people have already gone through issues that may happen to you too, so don’t hesitate to look out for a similar problem on the forum, it probably has been answered somewhere already.

1 Like

Yeah., my bad. Just got fed up trying to figure it out and i just ran back over here, lol. I’ll try to dig for an answer next time.

This topic was automatically closed after 13 hours. If you want to reopen your WiP, contact the @moderators.