Scripting

## Creating and Assigning

Scripts are used to tell characters what actions to take during auto combat. They work for both the Arena and the Dungeon. To edit scripts, the Arena must be built. Scripts are made and edited in the Arena menu by choosing Soda Scripts.

All characters start out using the Default script. To assign a different script, go to Assign Scripts and select a script for a character with the arrows. Alternatively, scripts can be assigned from the Player Book. The Recruiter can save different script assignments for each team loadout.

## Script Contents

A script is a list of triggers. Each trigger has four parts: Priority, which Target, a Condition, and an Action.

### Priority

The game checks the first trigger. If the condition matches, and if the action is able to be performed, then the action is executed. Otherwise, it goes to the second one and so on.

**Should all triggers fail or get ignored, the game will use Enemy Weakest -> Default Attack.**

To change the order, click on the priority number and use the arrows to move up or down.

### Target

Target can be one of three things.

* Enemy
* Ally
* Self

The condition and action normally both apply to the specified target. However, it is possible to add a trigger with an enemy condition that performs a friendly action such as Foretell or Go Fish. This implicitly targets the weakest (i.e. most injured) member of the player team.

Defend can be used with conditions for any target.

### Condition

There are several conditions to choose from based on what you set as target. Only one condition may be set for each trigger.

Note: != means **Does not Equal**

### Action

Lastly, there is the action that a trigger performs, which can be set as a number of things depending on the target.

 Strongest Attack
Rock Toss (1 MP) can be used with this action but not with Strongest Single-Target Attack. (The reason is that it takes a variable number of targets when used by an enemy).
There is a bit of ambiguity for this action because a few skills have the same costs. This is resolved as follows:
* Nailed It (2 MP) is tried before Wide Cut, which is tried before Phantasmal Claw.
* Double Strike (0 MP) is tried before Strike (the player default attack), which is tried before Sweeping Smash, so it will never get tried except with Strongest Group Attack or a specific skill.

 Strongest Group Attack
* Closing Time 15 MP
* Dark Flame 10 MP
* Eviserate 6 MP
* Noxin 4 MP
* Torment 3 MP
* Shadow Slicer 3 MP
* Wide Cut 2 MP
* Phantasmal Claw 2 MP
 Strongest Single-Target Attack
* Judgement 25 MP
* Laser 20 MP
* Skull Bash 8 MP
* Biohazard 3 MP
* Big Burp 3 MP
* Nailed It 2 MP
* Double Strike 0 MP
* Strike 0 MP

 Strongest Heal
 Strongest Group Heal
 Any Buff
 Any Debuff
 Any
 Specific Skill

If a skill is not available, then the trigger is ignored. For example, setting a Thief to Ransack before experience level 25, setting a Nurse to Recharge, or not having enough MP to cast a skill will cause the trigger to be skipped. Actions that shouldn't take place are also ignored—an ally will not be attacked even if there is a trigger that says so.

Additionally, some skills will be ignored based on certain conditions:

* Pilfer and Ransack when the target has already been stolen from. To attempt to steal from a second target, specify "Any" and enter the same script command multiple times, once for each enemy.
* Foretell when it is currently active
* Transmute when it has already been used in the current floor. However an attempt to Transmute a boss will not be ignored even though it always fails, so Miner scripts should check for rank.
* Go Fish when it has already been performed in the current stage, or if the stage does not contain a suitable fishing area
* To prevent an endless cycle of damage followed by healing, scripts will only use healing actions so many times in a row for a team before they skip those triggers. This limit is the number of alive teammates \* 2.

## Examples

These examples illustrate how scripts can be used for different characters.

A simple Nurse script
 2
 3

This video may be from the alpha but it still gives a good explanation on how scripts work. Note that assigning scripts is now done in the characters menu of the book in the top left and the scripting menu is directly on the arena menu.