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, 08:16 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
I'd like to see that code, actually (or a minimal example that also exhibits the same behaviour). I find stuff like this immensely interesting.

An important thing to know about calling other procedures is that this won't share any local variables (¤t_sprite works just fine, though. ¤t_script will actually have a different value inside the called procedure, due to having spawned a new script instance).

void main( void )
{
  int &crap = 3;
}

void talk( void )
{
  say_stop("&crap",1);
  stuff();
  &crap += 1;
  say_stop("&crap",1);
}

void stuff( void )
{
  &crap += 1;
  say_stop("&crap",1);
}


When talking to this, Dink first says "3", then "crap" (with the c underlined), then "4". Subsequently talking to it, we'll see "4", "crap" (with c underlined), "5".

The following:

void main( void )
{
  int &crap = 300;
}

void talk( void )
{
  say("Now I'm here!",¤t_sprite);
  stuff();
  say("Now I'm here!",¤t_sprite);
}

void stuff( void )
{
  sp_x(¤t_sprite, &crap);
}


Will cause the sprite to have an x-coordinate of 0. Essentially, this means that uninitialized variables will be a partially underlined variable name when displayed through say and friends, and will be 0 when used as a number.