Load-Game Scripts & How they work

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
kylekrack
Liquid Metal Slime
Posts: 1242
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Load-Game Scripts & How they work

Post by kylekrack »

I found a page on the wiki about this, but my load game script is still not working.

My game uses the skip title/load screen bitsets and has a new-game plotscript that loads the title screen. The title screen has a menu with "New Game" and "Load Game" options. The New Game option runs a short intro sequence, then the plotscript "begin game," which starts the main game loop. The Load Game option opens the OHR load menu. The load-game script is set to "begin game" (the same as new-game, but without the intro scene). New game works fine, but loading a save doesn't start the main game loop at all, leading me to believe the load script isn't being called.

So unless I'm doing something blatantly wrong, all I'm asking is when the special plotscripts get called. Does the load game script call when the player chooses a save slot to load? If not, when? Do I have to use the load game command?

Thanks, and sorry. This feels like a stupid question to be asking.

Speaking of stupid questions, is there a right way to search for threads on this forum? I seem to get a bunch of fluff that has nothing to do with my keywords when I search for something. I only ask because I thought this question may have been asked before and couldn't find it anywhere.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Maybe you wrote "load menu" instead of "load menu(true)". The former doesn't actually load a save slot, it just returns the selected save slot number. It's best to read the documentation rather than assume that a command does the obvious thing. Everything else you described sounds perfectly correct.

That wiki article was out of date: it didn't mention the "Don't save gameover/loadgame script IDs" preference bitset. Make sure it's turned on (see the article, which I've updated).


You can search these forums using Google with the site: operator, like this. I haven't found the builtin forum search function too terrible though.
Last edited by TMC on Thu Jun 23, 2016 11:19 am, edited 1 time in total.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1242
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

I'm bad at explaining, so I'm going to throw in some screenshots. I never used the load menu command. I have the load menu open with "special screen" in the menu editor.

Image

My game has a pixel-based movement system, so it requires a main game loop to work. I set this as a special plotscript for new and loaded games.

Image

The new game script shows the title screen.

Image

Selecting "New Game" runs a little cutscene, and then runs "begingame" like the load-game special plotscript, shown above. This works fine. No issues.

The problem is when the load menu loads a save. It goes to the game, runs the map autorun (the walktall script, etc.) but doesn't run the main loop:

Image

The "Don't save gameover/loadgame script IDs" preference bitset is on. I tried it both off and on just to be sure.

Again, I'm sorry if I'm overlooking something simple, but I am very lost. If I've been unclear about anything, I can try to fix that.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

The 'Load' menu option definitely does run the load-game script. After using it, try pressing F10 twice to enter the script debugger and see which scripts are running. I suspect that some other script is also started when you load a save, and it doesn't finish and allow the load-game script to run. Does your map autorun script (or any other aside from "begingame") contain a while loop with a wait? The map autorun script goes on top of the stack (above the load-game script), which means it runs before it.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1242
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

Hey, just felt I should update and say I fixed this issue. For some reason my "paused" global was true. I just had to set it to false on start up. So basically, the problem had nothing to do with what I thought it did.

Thank you for reminding me about the debug menu. I don't have the experience to know all of the ways it can be helpful, honestly.
My pronouns are they/them
Ps. I love my wife
Post Reply