The Dink Network

Reply to Re: Why Can't I Quit You, DinkC?

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:
 
 
November 5th 2013, 06:52 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
For a while I have been wanting to write up a good essay about the different ways to jump in code, to run code in other scripts, and stuff like that. I'll probably make a different post about it.

The answer to that question is: "It will be ignored". Perhaps a weirder observation is this:

void talk( void )
{
  say_stop("Talk!",1);
  stuff();
  say_stop("No talk!",1);
}

void hit( void )
{
  say_stop("Hit!",1);
  // A.k.a. A long time.
  wait(100000);
  say_stop("No hit!",1);
}

void stuff( void )
{
  say_stop("Stuff!",1);
  // A.k.a. Not quite a long time.
  wait(10000);
  say_stop("No stuff!",1);
}


I talk to the sprite, and see "Talk!", followed by "Stuff!". When "Stuff!" disappears, I punch the sprite, and "Hit!" appears. Not quite a long time later (say, 10 seconds, give or take ), "No stuff!" appears. This is immediately followed by "No hit!". "No talk!" never appears, which is consistent with the way scripts are spawned. I'm rather surprised at not having to wait over a minute for "No hit!" to appear.

Something related that actually managed to make a game crash for me comes down to the following. This script won't crash, but try to figure out what'll happen before reading on:

void talk( void )
{
  int &scripts = scripts_used();
  say_stop("Talk 1: &scripts",1);
  stuff();
  &scripts = scripts_used();
  say_stop("Talk 2: &scripts",1);
  &scripts = scripts_used();
  say_stop("Talk 3: &scripts",1);
}

void stuff( void )
{
  int &scripts = scripts_used();
  say_stop("Stuff: &scripts",1);
}


Got all that? Got an idea as to what will happen? Excellent.

I talk to the sprite. The following happens:
"Talk 1: 3" (As it happens: screen base script, the sprite's script, fist script)
"Stuff: 4" (screen base script, the sprite's script, the script that's just been spawned for stuff(), fist script)
"Talk 2: 4" (screen base script, the sprite's script, fist script, ... the script that's just been spawned for stuff()?)
"Talk 3: 3" (the original 3 again)

Conclusion: Until a script yields control, any scripts spawned by proc()s or external()s won't get garbage collected.

The more complicated version I had running, managed to crash the game by running into the script limit of all things.