The Dink Network

Reply to Re: What's the best way to run a script every time a save is loaded?

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
February 15th 2012, 09:24 AM
spike.gif
re Paul: if main.c is being killed, it sounds like main.c is run before the load game proper occurs, then is killed alongside all other scripts when the load game proper occurs.

Yeah, looking at debug.txt, it seems to run somewhere in the ether between using the load_game() command and the game loading up completely. I'm not sure about the reason stuff can't be done in main.c, though; I can't seem to be able to do much whether it's on the title screen or when loading a game. Either stuff doesn't run or the game crashes (even if I just try spawning a script from main.c on the title screen, same result).

However, you can use this to communicate with a saved game! I tried checking for &player_map in main.c, then spiriting the player to another screen if &player_map is anything other than 0 (meaning main.c is being run during the load function, not on the title screen). This works, so you could do something like add a script on the screen Dink is spirited to, then spirit him back to wherever he was when the game was saved. It's a little bit more complicated than doing stuff straight from main.c, but it kills #2 and #3 at least. (I used to use the savebot check method, hopefully I'll never do that again ).