How tasks work

From ADRIFT 5 Manual Wiki
Revision as of 02:08, 1 February 2014 by Saabie (Talk | contribs)

Jump to: navigation, search
THE MAIN ITEMS
Locations
Objects
Tasks
---- Specific
---- General
---- System
---- Executing sub-tasks
---- How tasks work
Characters
Events
Variables
Groups
Properties
Text Overrides
Hints
Synonyms
User functions

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.

  1. The first thing the parser does is replace the words "it", "them", "him" and "her" with the appropriate object or character that the player most recently refered to.
  2. The parser now checks each general task, starting from the one with the lowest number in the "Task Priority:" field on its "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 "Advanced Command Construction" matching.
  3. When it finds a matching general task, it now tries to match the references. Eg.If the command contains an %object% 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.
  4. 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 "scope" system to help choose between them.
    1. 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.
    2. If more than one passes restrictions then scope checks to see if one of those is currently visible to the player and chooses it.
    3. If none of them are currently visible, then scope checks to see if one of the items has ever been seen by the player.
    4. 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.
  5. ADRIFT has now matched all of the objects, characters and/or locations that the player mentioned to the references in the command, so it can start to execute the ask. If there are multiple items for a reference then ADRIFT executes the task once for each item.
  6. The restrictions of the general task are now checked. If a restriction fails and it contains text then that text is displayed to the player as a failure message and the player is prompted to enter their next command.
  7. If a restriction fails but that restriction has a completely blank text box, then ADRIFT skips that general task and resumes searching through the lower priority general tasks for the next match.
  8. If the restrictions pass then ADRIFT next checks to see if that general task has any specific tasks that are set to "run before" or "override" it.
    1. These tasks are checked in priority order.
    2. If the specific task has had any of its references made specific to a particular item, then that must be the item specified by the player, otherwise it is ignored.
    3. All of the restrictions of the specific task must pass, otherwise it is ignored.
    4. If the specific task matches and passes restrictions then its text box is displayed to the player and its actions are performed (in the order specified on the "Advanced" page)
    5. If the specific task that executes has the "Continue executing matching lower priority tasks (multiple matching)" checkbox selected on its "Advanced" page, then it continues to check any remaining specific tasks in priority order.
  9. If there are no "override" tasks, or they fail matching or restrictions, then the text box of the general task is displayed to the player and its actions are performed. If a "run before" task has executed successfully then it controls which parts of the general task execute with its "Display parent message" and "Execute parent actions" check boxes.
  10. ADRIFT next checks to see if that general task has any specific tasks that are set to "Run after" it, and if so, and they match the references and pass restrictions, then they are executed.
  11. Finally, ADRIFT checks the "Continue executing matching lower priority tasks (multiple matching)" checkbox on the "Advanced" page of the general task. If this is selected then ADRIFT continues to search lower priority general tasks for another match and goes back to step 3 above if it finds one.


<<< Executing sub-tasksMain_PageCharacters >>>