The Dink Network

Reply to Re: Debug mode questions

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 22nd, 11:35 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
So, unless things have significantly changed since I last meddled in engine things about a gazillion years ago...

Local variables are stored per script instance number (check &current_script, and also the return value of scripts_used()). Calling a custom procedure, either through external("script","proc") or through proc(), creates a new script instance, with its own &current_script, and its own scope of local variables.

Globals work as normal. &current_sprite is a pseudoglobal which gets transferred over, if applicable.

If you know the script instance number (say, &number), you can run_script_by_number(&number,"proc") (which *doesn't* allow arguments, AFAIK), and all the locals that are known to &number will be available. But beware! This is pretty much a remote-goto. You're instructing script instance &number to forget what it's doing, and do proc() instead. Similar to how you can interrupt the execution of the talk() procedure if you leave Dink unfrozen, and you then trigger hit() instead. run_script_by_number(&current_script,"proc") is pretty much a goto, except you're using a procedure name instead of a label.