Executing sub-tasks
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 |
A single ADRIFT task checks its restrictions and if they pass it performs its actions and displays its text.
Basically it is a single IF <restrictions> THEN <perform actions and display text> ELSE <display first failing restriction message> statement.
In most cases this is all you need, but what if you want to output text both before and after the actions, or if you want to perform an action that is more complex than the one's provided by ADRIFT.
No matter what you want to do, it is possible to do it in ADRIFT by using execute-task actions to run sub-tasks that contain extra restrictions, and can operate on the result of an item function instead of the original item references.
This action can execute any task, general, specific or system. If you are creating a new task to use as a sub-task then you should create a system task if you don't need to pass parameters to it, or a general task if you do.
Contents
Executing a system task to print text
There are several reasons to create a system task that only displays text, and execute it with an action.
- . It allows you to keep one copy of a large block of text that you want to display in several tasks.
- . You may need to display some text before executing actions, and some after.
- . You may have a complex arrangement of alternate restrictions that you don't want to duplicate every time you need it.
This system task
Executing a system task to add conditional actions
Executing a general task for advanced processing
Note the use of the # symbol at the start of the command line. This tells ADRIFT that this task does not contain a command and should be ignored by the command parser.
After the #, you can add any combination of references (%object1% to %object5%, %objects%, %character1% to %character5%, %characters%, %direction%, %number%, %text% and %location%)
These references can then be used in the usual manner in the restrictions and actions of the task.
When you now execute this task from an action in another task, you will be presented with a series of parameter entry dialogs, one for each reference that you defined:
In the simplest case you might pass on the references of the main task to the sub-task so it can use them, but you are also able to use the full power of the general and item functions to generate whatever reference you need.
Using a group to execute a sub-task multiple times
If you pass the key of a character, object or location group as a parameter, or use an item function to access the group of objects on or in another object, or worn/held by a character, then the sub-task will be executed for each item in the group.
<<< General tasks | Main_Page | How tasks work >>> |