The Dink Network

Create sprite, wait(50);, remove sprite?

December 4th 2010, 09:55 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Here is my code:
int &red = create_sprite(423, 295, 0, 38, 7);
      sp_que(&red, 10000);
      wait(50);
      sp_active(&red, 0);

I want to create the sprite, put it above everything, wait(50); and then remove it from the screen.
It creates, but it does not remove. It simply stays there. Anyone know why?
December 5th 2010, 12:24 AM
spike.gif
It's probably the wait() killing the script. When is the code run?
December 5th 2010, 12:49 AM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
Inside a procedure called with external(); from another script.
December 5th 2010, 01:18 AM
spike.gif
Well, if the parent sprite dies after calling this (or possibly does some other bizarre thing...) the externaled script will die with it. (the engine will "jump" back to the parent script when it encounters the wait() command. If you haven't read it, Someone explains the stuff pretty well in his FIFO variable thing =)

If possible (ie, there's no other stuff that will stop working), you could use spawn() instead of external(), or sp_kill(&red,50) instead of wait() and sp_active().
December 5th 2010, 05:39 PM
sob_scorpy.gif
DinkDude95
Peasant He/Him Australia
The guy with the cute D-Mod. 
sp_kill(&red, 50); works perfectly.

But it sounds like it may be worth it to read the FIFI variable thing.