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, 07:50 AM
fairy.gif
Someone
Peasant He/Him Australia
 
re Shevek: Unfortunately that still breaks if the user saves in a way the DMOD author didn't intend (Paul's 3rd point).

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. That's what I thought happens, but I misinterpreted what you said about main.c "keeps running" to mean you found main.c survived the load game. If main.c is run before the load game proper and doesn't survive it, then it seems more than just a complication to me?

Aside from using arm/disarm (which I still think is possible), I've come up with an even more devilishly convoluted solution! It involves randomly generating a number in main.c when a load occurred, saving a game with that number, then trying to recover the last random number generated (assuming Dink's random number generator is predictable) and checking if a save with that number exists. That would allow information to pass from before the load game to after. Probably wouldn't work though

I'm interested to see what you decide is the best solution in the end. Running scripts after a load seems a potential common problem to many DMODs with complex/innovative scripting.