Script organization reference document
Rules and information used in mission creation.
Mission script elements
The mission script is based on a linear execution of steps containing actions and objectives.
Variables are used when a script will use several occurrences of the same element. That greatly helps in case one wants to modify the value of this element without having to find any of its occurrences in the script.
Variables are var_creature, var_faction, var_group, var_item, var_npc, var_place, var_quality, var_quantity and |var_text.
Steps are primary elements of a mission script that usually contain one objective and a list of actions to be executed before and after the completion of the objective. Steps are step, step_any, step_dyn_chat, step_failure, step_if and step_ooo.
Actions are elements that are executed punctually, with no input from the player. They usually set conditions, or modify game variables like the amount of money the player has, or his inventory, or to have an impact on the script execution.
Actions are add_compass, ai_event, bot_chat, fail, jump_to, learn_action, recv_fame, recv_item, recv_money, set_constrains, system_msg and teleport.
Objectives are elements that wait for conditions to be fulfilled by the player. The script is blocked until the objective is either completed or failed, in regard of the mission conditions.
Objectives are buy, cast, craft, do_mission, escort, forage, give_item, give_money, kill, loot, sell, skill, talk_to, target and visit.
Mission branches
A mission script branch is implicitly ended by an end instruction that implies the completion of the mission and displays a default success phrase.
There are two special steps that produce script branches: step_if, and step_dyn_chat.
According to the conditions, one branch is selected for execution, and the script continues linearly from that point.
At any point, a jump_to can alter the linear script execution and move to any other step, on the same branch, or on a different one.
Failure is dealt with step_failure steps and the fail action.