{| style="width:12em; font-size:90%; text-align:left; float:right; border:1px #CCC solid; margin-left:1em; margin-bottom:1em;" cellpadding="3" cellspacing="0"
+
{{nav_mi2|how={{WhiteOnBlack}} }}
! colspan="2" style="font-size:110%; text-align: center; background-color: #ccccff;" | ''THE MAIN ITEMS''
+
|-
+
| style="background-color: #00C000;" | [[Locations]]
+
|-
+
| style="background-color: #00C000;" | [[Objects]]
+
|-
+
| style="background-color: #00ff00;" | [[Tasks]]
+
|-
+
| ---- [[Specific tasks|Specific]]
+
|-
+
| ---- [[General tasks|General]]
+
|-
+
| ---- [[System tasks|System]]
+
|-
+
| ---- [[Executing sub-tasks|Executing sub-tasks]]
+
|-
+
| style="color: #ffffff; background-color: #000000;" | ---- How tasks work
+
|-
+
| style="background-color: #00C000;" | [[Characters]]
+
|-
+
| style="background-color: #00C000;" | [[Events]]
+
|-
+
| style="background-color: #00C000;" | [[Variables]]
+
|-
+
| style="background-color: #00C000;" | [[Groups/Classes|Groups]]
+
|-
+
| style="background-color: #00C000;" | [[Properties ]]
+
|-
+
| style="background-color: #00C000;" | [[Text Overrides]]
+
|-
+
| style="background-color: #00C000;" | [[Hints]]
+
|-
+
| style="background-color: #00C000;" | [[Synonym|Synonyms]]
+
|-
+
| style="background-color: #00C000;" | [[User functions]]
+
|}
+
    +
When the player types a command, ADRIFT searches through the command lines specified in all of the general tasks, looking for one which matches the players input.
 +
 +
It does this in priority order, from smallest priority number to highest, until it finds a match.
 +
 +
If the matching command contains references (%object%,%character%,%location% etc.) then a search is made through the items in the game to see if any match what the player typed at that possition in the command.
 +
 +
If more than one could be a match then ADRIFT tries to find the most appropriate by first testing if they would pass the task restrictions, then checking if the player has ever seen them, and finally checking if they are currently visible. If ADRIFT cannot find one best match then it asks the player which of the possible items that they mean.
 +
 +
If the general task does not pass its restrictions with any possible item, then one of two things can happen:
 +
 +
If the "Task execution logic" on the Advanced page of [[Options]] is set to the second option, or the failing restriction does not output any text, then ADRIFT looks for another general task that matches the players input and passes its restrictions, and runs that instead.
 +
 +
When a general task does pass its restrictions, ADRIFT checks for any specific tasks that have been set to override it.
 +
 +
Specific tasks which are set to "Run before" or "Override" the general task are checked in priority order.
 +
 +
If any of these matches its specific item and passes its restrictions, its actions are run and its "Message to display on completion" is shown.
 +
 +
Any lower priority specific tasks are only run if this one has its "Multiple matching" option set on the Advanced page.
 +
 +
The actions and completion message of the general task are now run, but not if an "Override" task ran, or if '''any''' of the "Run before" tasks that ran had its "Display parent message" or "Execute parent actions" boxes unticked.
 +
 +
Finally, the "Run after" specific tasks are run, in priority order.
 +
 +
== Advanced Information ==
 
This is a step-by-step description of how ADRIFT processes a players command and chooses which tasks to run.
 
This is a step-by-step description of how ADRIFT processes a players command and chooses which tasks to run.
    
It is not meant to be read through start to finish, it is provided as a reference for more advanced ADRIFT uses to help design more complex multiple-task commands and debug problems.
 
It is not meant to be read through start to finish, it is provided as a reference for more advanced ADRIFT uses to help design more complex multiple-task commands and debug problems.
    +
# The %Turns% counter is incremented as soon as the command is entered, so all of the tasks and events that follow will see the same value. %Turns% is zero when the introduction and any "immediately" system tasks are run at the start of the game, and 1 after the first command is entered.
 
# The first thing the parser does is replace the words "[[The command parser#IT|it]]", "[[The command parser#THEM|them]]", "[[The command parser#HIM|him]]" and "[[The command parser#HER|her]]" with the appropriate object or character that the player most recently refered to.
 
# The first thing the parser does is replace the words "[[The command parser#IT|it]]", "[[The command parser#THEM|them]]", "[[The command parser#HIM|him]]" and "[[The command parser#HER|her]]" with the appropriate object or character that the player most recently refered to.
 
# The parser now checks each [[general task]], starting from the one with the lowest number in the "Task Priority:" field on its [[Tasks#Advanced|"Advanced" page]] and proceeding in order until it finds a match between the player's input and one of the command lines of a task, using "[[General_tasks#Advanced_Command_Construction|Advanced Command Construction]]" matching.
 
# The parser now checks each [[general task]], starting from the one with the lowest number in the "Task Priority:" field on its [[Tasks#Advanced|"Advanced" page]] and proceeding in order until it finds a match between the player's input and one of the command lines of a task, using "[[General_tasks#Advanced_Command_Construction|Advanced Command Construction]]" matching.
# When it finds a matching general task, it now tries to match the references. Eg.If the command contains an %object% [[General_tasks#References|reference]] then ADRIFT searches through all of the objects in the game trying to find one which matches what the player typed in that part of the input. Note that the player may have entered the names of several objects, eg. "the watch and the pendant" or "all except the hat" or "pens" (which can mean all objects with "pen" as the noun if no objects are called "pens"). All of these must match objects in the game.
+
# When it finds a matching general task, it now tries to match the references. Eg.If the command contains an %object% [[General_tasks#References|reference]] then ADRIFT searches through all of the objects in the game trying to find one which matches what the player typed in that part of the input. Note that the player may have entered the names of several objects, eg. "the watch and the pendant" or "all except the hat" or "pens" (which can mean all objects with "pen" as the noun if no objects are called "pens"). All of these must match items in the game.
# The player may have typed an ambiguous name that matches several items in the game, for example "pen" could match "red pen", "blue pen" or "green pen" if these all exist. To decide which one the player meant, ADRIFT contains a "[[General_tasks#Scope|scope]]" system to help choose between them.
+
# The player may have typed an ambiguous name that matches several items in the game, for example "pen" could match "red pen", "blue pen" or "green pen" if these all exist. To decide which one the player meant, ADRIFT uses a "[[General_tasks#Scope|scope]]" system to help choose between them.
 
## The first thing scope does is to check the items against the restrictions of the general task, if only one of them passes then it is assumed to be the one the player meant.
 
## The first thing scope does is to check the items against the restrictions of the general task, if only one of them passes then it is assumed to be the one the player meant.
 
## If more than one passes restrictions then scope checks to see if one of those is currently visible to the player and chooses it.
 
## If more than one passes restrictions then scope checks to see if one of those is currently visible to the player and chooses it.
 
## If none of them are currently visible, then scope checks to see if one of the items has ever been seen by the player.
 
## If none of them are currently visible, then scope checks to see if one of the items has ever been seen by the player.
 
## If more than one item passes these scope checks, then the player is asked a disambiguation question such as "Do you mean the red pen, the blue pen or the green pen?" to determine which item they meant.
 
## If more than one item passes these scope checks, then the player is asked a disambiguation question such as "Do you mean the red pen, the blue pen or the green pen?" to determine which item they meant.