The Dink Network

Reply to Re: Execution of script on game load

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:
 
 
August 1st 2012, 03:26 AM
dinkdead.gif
Hello

Does using external actually affect the spawned script? I would've thought it creates a new instance of it, odd.

"Is there a way to check if a script is currently loaded into memory/executing?"

Not as such, but you can save the script number to control it later. For example:
&global_var = spawn("timer");
//later
run_script_by_number(&global_var, "term");


What might be helpful to you is a way to know if a game is being loaded or not - that way you can spawn the timer if it's a loaded game and do nothing if the player has just walked onto the screen.

To do this, make a global &loadedgame or something. In the savebot script set it to 1 just before saving and set it back to 0 straight afterwards. Then in the main() of the savebot you can do:
if (&loadedgame)
{
  //It's a loaded game!  Do stuff
  spawn("timer")
}