====== Script organization reference document ====== Rules and information used in [[en:primitive:mission:start|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 [[en:primitive:mission:var_creature|var_creature]], [[en:primitive:mission:var_faction|var_faction]], [[en:primitive:mission:var_group|var_group]], [[en:primitive:mission:var_item|var_item]], [[en:primitive:mission:var_npc|var_npc]], [[en:primitive:mission:var_place|var_place]], [[en:primitive:mission:var_quality|var_quality]], [[en:primitive:mission:var_quantity|var_quantity]] and [[en:primitive:mission:var_text||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 [[en:primitive:mission:step|step]], [[en:primitive:mission:step_any|step_any]], [[en:primitive:mission:step_dyn_chat|step_dyn_chat]], [[en:primitive:mission:step_failure|step_failure]], [[en:primitive:mission:step_if|step_if]] and [[en:primitive:mission:step_ooo|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 [[en:primitive:mission:add_compass|add_compass]], [[en:primitive:mission:ai_event|ai_event]], [[en:primitive:mission:bot_chat|bot_chat]], [[en:primitive:mission:fail|fail]], [[en:primitive:mission:jump_to|jump_to]], [[en:primitive:mission:learn_action|learn_action]], [[en:primitive:mission:recv_fame|recv_fame]], [[en:primitive:mission:recv_item|recv_item]], [[en:primitive:mission:recv_money|recv_money]], [[en:primitive:mission:set_constrains|set_constrains]], [[en:primitive:mission:system_msg|system_msg]] and [[en:primitive:mission:teleport|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 [[en:primitive:mission:buy|buy]], [[en:primitive:mission:cast|cast]], [[en:primitive:mission:craft|craft]], [[en:primitive:mission:do_mission|do_mission]], [[en:primitive:mission:escort|escort]], [[en:primitive:mission:forage|forage]], [[en:primitive:mission:give_item|give_item]], [[en:primitive:mission:give_money|give_money]], [[en:primitive:mission:kill|kill]], [[en:primitive:mission:loot|loot]], [[en:primitive:mission:sell|sell]], [[en:primitive:mission:skill|skill]], [[en:primitive:mission:talk_to|talk_to]], [[en:primitive:mission:target|target]] and [[en:primitive:mission:visit|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: [[en:primitive:mission:step_if|step_if]], and [[en:primitive:mission:step_dyn_chat|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 [[en:primitive:mission:jump_to|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 [[en:primitive:mission:step_failure|step_failure]] steps and the [[en:primitive:mission:fail|fail]] action. {{tag>primitives ryzom_core}}