To kill a running script
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?
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?
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
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
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?
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?
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, " ")
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"); }
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!
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!