The Dink Network

Problem with script

December 23rd 2004, 04:24 PM
wizardg.gif
chaotic
Peasant He/Him
 
Grr.. I assigned this script to a sprite and whenever it runs it, it runs the die procedure after the main procedure and the sprite hasn't even died... makes me so frustrated...

void main( void )
{
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 2);
sp_timing(&current_sprite, 0);
sp_defense(&current_sprite, 4);
sp_base_walk(&current_sprite, 380)
sp_strength(&current_sprite, 4);
sp_touch_damage(&current_sprite, 4);
sp_hitpoints(&current_sprite, 100);
sp_target(&current_sprite, 1);
sp_exp(&current_sprite, 100);
unfreeze(1)
unfreeze(&current_sprite)
screenlock(1)
}
void die( void )
{
if (get_sprite_with_this_brain(9, &current_sprite) == 0)
{
spawn("killer")
screenlock(0);
}
}
December 23rd 2004, 04:27 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Try putting semicolons ";" after the two unfreeze() statements, after the screenlock() and after the spawn() as well.
December 23rd 2004, 05:24 PM
wizardg.gif
chaotic
Peasant He/Him
 
That didn't fix the problem.. it still runs the die procedure once you start fighting the sprite. However, the script now runs the die procedure again once the sprite has died
December 23rd 2004, 05:28 PM
goblinm.gif
I'd tell you to throw a return; at the end of your main() proc, but although that _might_ solve the problem, you still wouldn't know why it happened.

The only thing I can think of, and this is too stupid to mention, is that you set the hitpoints to a negative number in the editor.
December 23rd 2004, 05:31 PM
goblinm.gif
Oh yeah, the sp_base_walk line is missing a semicolon, not that it matters...
December 23rd 2004, 08:21 PM
wizardb.gif
merlin
Peasant He/Him
 
It does. Without a semicolon the process_line() function will treat it as a function call (well, sorta). Anyway, it's a bad thing.
December 23rd 2004, 10:21 PM
wizardg.gif
chaotic
Peasant He/Him
 
It now works! Thanks Milobones!