The Dink Network

I need some help, guys

July 23rd 2009, 07:20 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
I know how to make a script spawn to another script, like this
spawn("someotherscript")
but how can I make the script so after certain amount of time, it spawns to the other script again?

Here's my script now:

//THE DUCK!!

void main(void)
{
//the duck's standard things
say("`%YOU WILL NEVER WIN, SMALLWOOD!!", &current_sprite);
sp_brain(&current_sprite, 9);
sp_speed(&current_sprite, 3);
sp_exp(&current_sprite, 500);
sp_base_walk(&current_sprite, 20);
sp_base_death(&current_sprite, 111);
sp_touch_damage(&current_sprite, 10);
sp_hitpoints(&current_sprite, 800);
preload_seq(131);
preload_seq(133);
preload_seq(141);
preload_seq(143);

if (random(2,1) == 1)
 {
 sp_target(&current_sprite, 1);
 }
spawn("duckstuff")
}

void hit( void )
{
//lock on to the guy who just hit us
sp_target(&current_sprite, &enemy_sprite);
//play the "Quack!" sound
    Playsound(21,22050,0,0,0);
}
void die( void )
{
  int &hold = sp_editor_num(&current_sprite);
  if (&hold != 0)
  editor_type(&hold, 6); 

&save_x = sp_x(&current_sprite, -1);
&save_y = sp_y(&current_sprite, -1);

 external("emake","small");

}

}

(the die prodecue isn't completed yet)

So, as you can see, the script would spawn to another script named "duckstuff", but how can I make it to spawn to the "duckstuff" after 10 seconds, again? This would need to continue as long, until the enemy is dead.

Thanks,
Skull
July 23rd 2009, 07:44 AM
dinkdead.gif
I would say just put a 10 second loop in, but it'll probably leave the loop whenever the hit procedure is run... hmm.

Only way I can think of offhand is to have the loop in a seperate script, but that could get messy if you have more than one of these ducks on the screen.

Edit: Or it might work to have the loop in duckstuff.c and use external instead of spawn, then you can use &current_sprite to control the duck and there'll be no problems with more than one. Hopefully.

//the duck
void main (void)
{
  //blah blah
  external("duckstuff", "main");
}

//duckstuff.c
void main (void)
{
loop:
  wait(10000);
  //whatever happens... use &current_sprite
  goto loop;
}
July 23rd 2009, 07:57 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Thanks, gonna try out your script soon. A massive laziness attack just hit me
July 23rd 2009, 09:19 AM
girl.gif
joshriot
Peasant They/Them United States
keep it real 
use set_callback_random