The Dink Network

Reply to Scripting problem

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:
 
 
October 3rd 2010, 09:30 AM
custom_iplaydink.gif
iplaydink
Peasant He/Him Sweden
Hmm.. 
Why can't I get Dink to say the value of the variable in the below script?
when say("&x"); is called he says "x" with a line under the x instead of the value... and I'm 100 percent sure &x has a value!

I need to know the value of &x and &y to figure out another problem with the script, why the object nebver returns that it's inside the coordinates in check_p.
The pushing works fine.

Script:

void main (void)
{
	int &x;
	int &y;
	&x = 100;
	&y = 100;
	int &junk;
	int &dir1;
	sp_speed(&current_sprite, 5);
	sp_brain(&current_sprite, 0);
	sp_x(&current_sprite, &x);
	sp_y(&current_sprite, &y);
	sp_hard(&current_sprite, 0);
	draw_hard_map();
}
void push(void)
{
	freeze(1);	
	sp_hard(&current_sprite, 1);
	draw_hard_map();
	
	&dir1 = sp_dir(1, -1);
	
	if(&dir1 == 6)
	{
		&x = sp_x(&current_sprite, -1);
		&x += 20;
		move_stop(&current_sprite, 6, &x, 1);
	}
	if(&dir1 == 2)
	{
		&y = sp_y(&current_sprite, -1);
		&y += 20;
		move_stop(&current_sprite, 2, &y, 1);
		
	}
	if(&dir1 == 8)
	{
		&y = sp_y(&current_sprite, -1);
		&y -= 20;
		move_stop(&current_sprite, 8, &y, 1);
		
	}
	if(&dir1 == 4)
	{
		&x = sp_x(&current_sprite, -1);
		&x -= 20;
		move_stop(&current_sprite, 4, &x, 1);
	}
	say("&dir", 1);
	sp_hard(&current_sprite, 0);
	unfreeze(1);
	check_p();
}
void talk(void)
{
	say("It's a stone", 1);
}
void check_p(void)
{
	&x = sp_x(&current_sprite, -1);
	&y = sp_y(&current_sprite, -1);
	
	if (&x >= 221)
	{
		if (&x <= 272)
		{
			if (&y <= 304)
			{
				if (&y >= 268)
				{
                                        //I need to print the x and y
                                        //to figure out why the script never gets here
					say("It's inside!", 1);
					goto skip;
				}
			}
			
		}
		
	}
	say("&x", 1);
        //Why doesn't that work?!
skip:
	draw_hard_map();
}