Does checking the stats screen interfere with gosub?

I read elsewhere on the forum that the stats screen has some odd behavior due to how it’s implemented. Essentially it’s a permanent “scene” in every game like a gosub with a permanent button link?

  • Firstly, I want several places in the game to hook to a generic “dressing room” where a player can access their clothing they have via a gosub_scene. If the player checks the stat screen before the return in the dressing room, will this mess with getting back to the right place in the original gosub?

  • Second, I also have a time-advancing mechanic at the top of many pages that is accessed by gosubbing to a scene that does a lot of silent stuff and returns. I’m thinking this gosub to the time-advance scene will recur if the player accesses the stats screen and returns to the original page? (Similarly, I don’t want to make changing clothes take half a day when the player returns to a page from the dressing room where the time-advance will run again.)

(I know this fix though is pretty easy–*create statschecked = false and set it to true on the stats screen… then have the time-advance machinery first check if the player came from the stats screen if statschecked is true, and if so set it back to false and return without altering anything.

I just want to confirm that’s how gosub and stats work before I try to correct a problem that might not exist!

From what I can say, it never messed up my game so far.

I played around with a few gosub_scenes, but everything was fine whenever I used it, so it might just be an older version of CS? Of course, I am not completely sure if it is that case, it just seems like the most logical answer to me at the moment.

Sounds cool. Now I just need to know if returning from stats actually reloads the entire previous page, or if it is cached somehow and displays without re-running gosubs.

I don’t really know how to help you because I don’t use go sub very often but what I end up doing it just put a choice in the stats screen like in Sabres of infinity.

So long as you haven’t used *rand in the scene, to my understanding, going to stats screen and returning causes the entire page to recalculate from the point it was at the start of the scene, so it should display the exact same page. Basically, *gosub should work fine to display a full page without being messed up by going to the stats screen. (*rand will however cause some problems. If you use *rand, run it silently before you need it, and without any other stats alteration on the same page, or better yet, generate a seed at the start of the game and check that instead.)

Also, nothing gets saved in the stats screen. Once you go back, the game reverts any changes made in the stats screen.

2 Likes