Terminate All Scripts

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Terminate All Scripts

Post by Willy Elektrix »

Is there a command that terminates all running scripts?

From what I understand, "Exit Script" exits only the script it is imbedded in. I want to kill every script that is currently running.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

There isn't.

I was planning to add such a command when script multitasking is added. (I would want to consider how that interacts with script fibres before adding it.)

Could you describe what you want to use it for? Do you only want to exit the current script, and the one that called that one, and so on? Or do you also want to terminate independent scripts which are currently suspended (ie. those that were triggered separately)?
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

TMC wrote:Could you describe what you want to use it for? Do you only want to exit the current script, and the one that called that one, and so on? Or do you also want to terminate independent scripts which are currently suspended (ie. those that were triggered separately)?
I have a script that occurs when the hero dies in battle. At the end of that script, I wanted to terminate all scripts in order to stop any suspended scripts that are running as part of the map, or as running on-step triggered NPCs.

I think I figured out a solution, but it brings up a question. If the hero steps on an on-step NPC (triggering a script) and has a random encounter (triggering another instead-of-encounter script), which script starts first?
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

In that case the instead-of-battle script gets to run first, and the NPC script runs after it finishes. I think I never got around to documenting the precedence order.

I can certainly add a script command to exit all scripts if needed. It should be pretty simple.

I just have to wonder whether it's the best solution for other people with the same problem: it seems that in general one would want a way to stop a whole set of scripts (eg. associated with a particular map) including ones that have been triggered but not started yet. Are you leaving the map when you lose a battle? It sounds like this could be accomplished with a planned feature, map-tied and npc-tied scripts.
Last edited by TMC on Tue Jun 16, 2015 5:04 am, edited 3 times in total.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

TMC wrote:I just have to wonder whether it's the best solution for other people with the same problem: it seems that in general one would want a way to stop a whole set of scripts (eg. associated with a particular map) including ones that have been triggered but not started yet. Are you leaving the map when you lose a battle? It sounds like this could be accomplished with a planned feature, map-tied and npc-tied scripts.
The hero does leave the map when they die in battle. They are sent back to the beginning of the dungeon (another map).
Last edited by Willy Elektrix on Thu Jun 18, 2015 12:49 am, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Distracted by a lot of other features/bugs. I'll add the command if you still want it, otherwise I'll simply wait until later.
Last edited by TMC on Thu Jun 18, 2015 6:03 pm, edited 1 time in total.
Post Reply