The Dink Network

Reply to Re: The Three Pillars of Dink v1.08

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:
 
 
August 28th 2005, 09:46 PM
custom_king.png
redink1
King He/Him United States bloop
A mother ducking wizard 
I modified the whatsnew.txt with a new engine change that I forgot to mention:

* Variables are now dynamicly scoped.

It basically allows you to reference local variables defined in previous functions, so you wouldn't have to resort to global variables like &save_x and &save_y (most of the time).

You can do something like this:

void main(void)
{
int &x = 4;
int &y = 6;
bob();
say_stop("&x, &y", 1);
}

void bob()
{
int &y = 8;
function();
}

void function(void)
{
say_stop("&x, &y", 1);
&x / 2;
}

This would result in Dink saying "4, 8" and then "2, 6".

If there were global variables &x and &y, they would be looked for if no local variables in the calling function stack's scope were found.

Global variables like &save_x and &save_y would be required in instances where the calling script was killed (i.e. when a sprite dies), in which case the scope defaults to global.