The Dink Network

External spawnings attached to number 1000

May 4th 2003, 07:34 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Well, I'm not sure if the title makes any sense, but what I'm gonna ask is this:

WHAT exactly is the difference between a spawn("script");
an external("script","proc");
a script_attach(1000);
and a vision-like-script, which is attached in the editor to the screen.

I know that &current_sprite in an external is actually the sprite calling the external, but which one is best to use?
May 4th 2003, 08:38 AM
pq_frog.gif
Ric
Peasant They/Them Canada
 
When you use external in one script, to call a procedure from a second script, Dink acts as though that other procedure is there in place of the command "external.". So if the procedure called in controls "&current_sprite", it will control the sprite that the first script is attached to. It saves typing and memory. You can use external to run talk, attack, die, or anything from another sprite you think will work. You can even use extenal to run a procedure within the first script, knowing it will return to the "external" command when it is done. Handy.
Room scripts are the best for setting visions because it is run before the screen is drawn, and so you don't need to force_vision. Graphics will run smoother too, unless you have a wait() or a random() in it. Room scripts can create_sprite and other things too, but don't use things like talk() or hit() unless you attach it to a sprite with sp_script_attach().
Spawn runs a script starting with its main() without interupting the script that spawned it. If you need that script attached to a sprite (even sp 1000 ) I would just use sp_script(1000,"scriptname"); . Always end that script with Kill_this_task(); or it will never end. (Most sprite scripts die when you leave the screen, but sp 1000 never dies.)
May 5th 2003, 03:01 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Ah, thank you. It gets much clearer now! But I'm using 'spellbook technique' when writing wizard scripts: I've got one long list of spells (just like emake.c or make.c) and I use external to call one of them. Would it be better to use a spawn with different scripts for each effect (or a global called &effect for 'goto'-ing to the effect)?
May 5th 2003, 04:36 AM
spike.gif
No
May 5th 2003, 09:41 AM
pq_frog.gif
Ric
Peasant They/Them Canada
 
I use a script full of sale items so several different people can sell the same things:
external("sale","itemxxx")
. Works good.