The Dink Network

To kill a running script

March 15th 2015, 02:32 AM
knightgl.gif
zeddexx
Peasant He/Him New Zealand
I'm pretty sure I'm worth atleast SIX goats... 
mmk so basically i wanna know how to kill or stop a script by using a command in another one.

Like i know you can kill a script by using the Kill_this_task command, but what i wanna do is kill a different script.

what im trying to do is have the cursor chat to you while you're on the title screen.
But i want him to shut up when you click start or continue.

Any ideas?
March 15th 2015, 04:28 AM
pq_water.gif
flood
Peasant He/Him New Zealand
 
I hate to suggest doing this but I can't think of another way.

you could use a global variable that is modified by the start or continue button when they are clicked and your other script will keep checking to see if it has changed and when it does use kill_this_task.

Maybe someone else has a more elegant solution to this though
March 15th 2015, 06:11 AM
custom_skull.gif
Skull
Peasant He/Him Finland bloop
A Disembodied Sod 
Did you try sp_active(&mouse, 0)?

Though if the mouse has Dink's brain, using that command would likely cause all sorts of problems later on. I'm not really sure. The easiest way would probably be to just use a global. If you don't wanna risk losing a global though, and wanna get all fancy with it, one thing to do would be to create an invisible sprite in the screen that makes the mouse say stuff, and then kill that sprite off when you want the talking to stop.

There would actually be a really simple solution for this if there was a player_map number for the title screen. Does anyone know if the game uses a specific screen for this or does it use none?
March 15th 2015, 09:58 AM
wizardg.gif
leprochaun
Peasant He/Him Japan bloop
Responsible for making things not look like ass 
I would suggest attaching the script you want to kill to a sprite. You could attach the script to a sprite with a unique brain so you can find it easier, or you can attach it to dink. Then when you want to kill that script just do, sp_script(&sprite, " ")
March 15th 2015, 01:31 PM
custom_magicman.gif
magicman
Peasant They/Them Netherlands duck
Mmmm, pizza. 
Do you have a script number of the script you want to kill? In those cases I'd do something like adding a self-destruct button:

// stuff.c
void main( void )
{
  // Do stuff here. But at some point, I need to be killed!
}

void selfdestruct( void )
{
  // Self-destruct button.
  kill_this_task();
}


// killer.c
void main( void )
{
  // There are other ways to get at a script number. I believe sp_script also returns one.
  int &script = spawn("stuff");
}

void talk( void )
{
  // Or whenever. Just make sure that you somehow have the script number.
  run_script_by_number(&script,"selfdestruct");
}

March 15th 2015, 08:14 PM
knightgl.gif
zeddexx
Peasant He/Him New Zealand
I'm pretty sure I'm worth atleast SIX goats... 
Thanks everyone! you guys were a big help,
i ended up just makin it simple and created an invisible sprite on the title screen with the script attached, and since its just a sprite the script just ended by itself once i clicked start!

Thanks again all, i'm one step closer to finally bringing you guys a quality dmod!