A very specific problem (how to hide show stats button, problem with rand function)

As always - sry for bad english )))

Hi, all, me and my friend almost finished our first game. Unfortunately, I found one annoying bug.

We used rand function in our game (simulation of 2 dice with 6 edges, like in classical board games) for create a stat-checks in game. Throws two “dice”, they added buffs and the resulting number is compared with the number of checks. But in the page after this every time when player go to show stats, and after this go back to main game, this dice roll again and all a changes!!!

Here a bit of code for example:

Player go to “show stat” and after this he back in game and all “dice” reroll again!!! I have one question - how to fix it? )))

  1. Maybe I can just hide “show stats” stats in some scenes - but how???

  2. Or maybe I can somehow make my rand function non-reusable in some scenes - but again, how???

The easy way would be to do the dice roll in the scene before the choice. That way it won’t reset if you go to the stats screen after making a choice.

If you’re looking for a solution more complicated than that you’ll have to ask the coding wizards. I only know the basics.

1 Like

Hm, very interesting - I will try it, tnx! )

Amazing!!! It really works!!! But I will wait for another answers - maybe someone know something about how to hide show stats button ))) Tnx!

1 Like

The best way to hide stats that I’ve figured out is to create a variable and set it to false when you want the stats to be hidden. Then you can set up the stat screen to only show those stats when the variable is true. It doesn’t erase the “show stat button”, but it can hide some stats while letting you show others.

His problem isn’t so much that he doesn’t want the players to be able to see their stats, it’s that every time they go to their stats page and back the *rand function rerolls because the page you’re on isn’t stored, it’s just reloaded, and the page rereads and reapplies all the code in it all over again. I’ve had the same problem even without a *rand, with a stray “oh I’ll add a +20 here,” and then every time you would go to your stats page and back it would increase by 20!

The simple solution is to roll it well in advance. If that’s not possible though, you’d have to use a *goto or *page_break or

You can use a conditional in the stats page, so that different parts show when different conditions are met.