The Dink Network

Reply to scripting trouble, why always me

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:
 
 
December 8th 2006, 07:59 PM
slayer.gif
rabidwolf9
Peasant He/Him United States
twitch.tv/rabidwolf9 
Here's a script for my game. It looks perfectly fine to me, but it doesn't work properly and I am completely perplexed. It pushes perfectly and changes the variable the way it's supposed to, but the script for the created sprite doesnt change like it's supposed to. So the main sprite moves, but the created sprite still run. I've tried killing it and everything, but it won't work. It DOES work if you change screens and come back, but that's the same procedure...

I just realized the first three created sprites don't do what they're supposed to even on screenchange.

Forgive me if this is some dumb error overlooked by me, but I keep testing and testing and it gets really annoying because there is a lot going on concerning the screen the scripts take place on.

void main( void )
{
int &junk;
int &place;
int &rock = sp_x(&current_sprite, -1);
sp_hard(&current_sprite, 0);
draw_hard_sprite(&current_sprite);

if (&rock == 465)
{
&rock = 1;
int &hole = create_sprite(507, 278, 0, 158, 2);
}

if (&rock == 244)
{
&rock = 2;
int &hole = create_sprite(244, 286, 0, 158, 2);
}

if (&rock == 279)
{
&rock = 3;
int &hole = create_sprite(243, 131, 0, 158, 2);
}

if (&rock == 466)
{
&rock = 4;
int &hole = create_sprite(513, 120, 0, 158, 2);
}

sp_script(&hole, "s5-trap2");
sp_que(&hole, -10);
sp_nohit(&hole, 1);
goto check;
}

void push ( void )
{
freeze(1);
sp_speed(&current_sprite, 1);
&place = &rock_placement;

if (&rock == 1)
{
if (&place >= 1000)
&place -= 1000;
if (&place >= 100)
&place -= 100;
if (&place >= 10)
&place -= 10;
if (&place < 1)
{
if (sp_dir(1, -1) == 6)
{
move_stop(&current_sprite, 6, 507, 1);
&rock_placement += 1;
}
}
}
if (&rock == 2)
{
if (&place >= 1000)
&place -= 1000;
if (&place >= 100)
&place -= 100;
if (&place < 10)
{
if (sp_dir(1, -1) == 2)
{
move_stop(&current_sprite, 2, 286, 1);
&rock_placement += 10;
}
}
}

if (&rock == 3)
{
if (&place >= 1000)
&place -= 1000;
if (&place < 100)
{
if (sp_dir(1, -1) == 4)
{
move_stop(&current_sprite, 4, 243, 1);
&rock_placement += 100;
}
}
}
if (&rock == 4)
{
if (&place < 1000)
{
if (sp_dir(1, -1) == 6)
{
move_stop(&current_sprite, 6, 513, 1);
&rock_placement += 1000;
}
}
}
unfreeze(1);
draw_hard_map();
goto check;
}

void check( void )
{
check:
&place = &rock_placement;

if (&place >= 1000)
{
if (&rock == 4)
{
sp_x(&current_sprite, 513);
&junk = is_script_attached(&hole);
sp_script(&hole, "");
}
}
&place -= 1000;

if (&place >= 100)
{
if (&rock == 3)
{
sp_x(&current_sprite, 243);
sp_script(&hole, "");
}
}
&place -= 100;

if (&place >= 10)
{
if (&rock == 2)
{
sp_y(&current_sprite, 286);
sp_script(&hole, "");
}
}
&place -= 10;

if (&place >= 1)
{
if (&rock == 1)
{
sp_x(&current_sprite, 507);
sp_script(&hole, "");
}
}
draw_hard_map();
}