The Dink Network

Reply to Re: New *WORKING* cross-platform editor

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:
 
 
June 25th 2011, 05:52 AM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
As for gotos into other functions:
void main( void )
{
  int &blah = 5;
}

void talk( void )
{
  goto proc;
procend:
  say_top("Bye &blah",1);
}

void proc( void )
{
proc:
  say_stop("Hey &blah",1);
  goto procend;
}

This makes Dink say "Hey 5" followed by "Bye 5".
void main( void )
{
  int &blah = 5;
}

void talk( void )
{
  proc();
  say_top("Bye &blah",1);
}

void proc( void )
{
  say_stop("Hey &blah",1);
}

This makes Dink say "Hey &blah" followed by "Bye 5". Once you know what's going on, this isn't too surprising. Only the engine and the run_script_by_number() function can call procedures of existing script instances. Any other procedure call launches a new script instance.

Sadly, run_script_by_number(&current_script,"proc") *will* run the procedure, make Dink say 5 instead of the variable name, but it won't return back to the code it came from.

In short: custom procedure calls launch a new script instance, with no local variables in scope. More scoping fun:
void hit( void )
{
  int &blah = 5;
}

void talk( void )
{
  say_stop("&blah",1);
}

First talking: Dink says "&blah".
Hitting: No visible effect.
Second talking: Dink says "5".