Denizen/0.7/Task Scripts: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
== Task Scripts in detail == | == Task Scripts in detail == | ||
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | <div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | ||
Task scripts are just a simple list of [[Denizen/Interact_Scripts/Commands|Script Commands]]. They | Task scripts are just a simple list of [[Denizen/Interact_Scripts/Commands|Script Commands]]. They can be called by the RUNTASK command, the IF command, or the TASK activity. They are useful for creating a set of commands that is used in multiple places. | ||
</div> | </div> | ||
Line 16: | Line 16: | ||
</div> | </div> | ||
==== Using a Task Script with RUNTASK ==== | ==== Using a Task Script with the RUNTASK command==== | ||
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | <div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;"> | ||
Imagine a scenario where you'd like to check a single outcome from multiple sources. Say, for instance, you have multiple 'quests' that all have the same outcome. You could check the completion for each quest, or, you could have all the quests call a Task Script and check against that. | Imagine a scenario where you'd like to check a single outcome from multiple sources. Say, for instance, you have multiple 'quests' that all have the same outcome. You could check the completion for each quest, or, you could have all the quests call a Task Script and check against that. | ||
Line 56: | Line 56: | ||
- RUNTASK Apple Reward | - RUNTASK Apple Reward | ||
</pre> | </pre> | ||
</div> | |||
==== Using a Task Script with TASK Activity==== | |||
This is a special case, as Activities occur without a player. Therefor any commands that require a Player will not function in a Task Script called from the activity. | |||
Many script commands have a DENIZEN modifier to run the command on the NPC instead of the Player, and these should always be used when calling a Task Script from the TASK Activity. | |||
<pre> | |||
'WalkHome': | |||
Type: Task | |||
Script: | |||
- CHAT NOPLAYER "Welp.. time to head home!" | |||
- WALKTO BOOKMARK:Home | |||
'GoHomeActivity': | |||
Type: Activity | |||
Requirements: | |||
Mode: None | |||
Activities: | |||
List: | |||
- 1 TASK SCRIPT:WalkHome REPEATS:0 | |||
</pre> | |||
</div> | </div> |
Revision as of 20:46, 10 October 2012
Task Scripts in detail
Task scripts are just a simple list of Script Commands. They can be called by the RUNTASK command, the IF command, or the TASK activity. They are useful for creating a set of commands that is used in multiple places.
General layout of a Task Script
'Name of script': Type: Task Script: - COMMAND1 - COMMAND2 - etc...
Using a Task Script with the RUNTASK command
Imagine a scenario where you'd like to check a single outcome from multiple sources. Say, for instance, you have multiple 'quests' that all have the same outcome. You could check the completion for each quest, or, you could have all the quests call a Task Script and check against that.
This is a very basic example for something that can in theory be very complex. Imagination, hoooo!
'Apple Reward': Type: Task Script: - NARRATE "You've received some APPLES. Nice!" - GIVE APPLE QTY:10 - FINISH 'Apple Quest 1': Type: Interact Requirements: Mode: All List: - -FINISHED Apple Reward Steps: '1': Click Trigger: Script: - CHAT "Welcome to my house, have some apples!" - RUNTASK Apple Reward 'Apple Quest 2': Type: Interact Requirements: Mode: All List: - -FINISHED Apple Reward Steps: '1': Click Trigger: Script: - CHAT "Welcome to my orchard, have some apples!" - RUNTASK Apple Reward
Using a Task Script with TASK Activity
This is a special case, as Activities occur without a player. Therefor any commands that require a Player will not function in a Task Script called from the activity. Many script commands have a DENIZEN modifier to run the command on the NPC instead of the Player, and these should always be used when calling a Task Script from the TASK Activity.
'WalkHome': Type: Task Script: - CHAT NOPLAYER "Welp.. time to head home!" - WALKTO BOOKMARK:Home 'GoHomeActivity': Type: Activity Requirements: Mode: None Activities: List: - 1 TASK SCRIPT:WalkHome REPEATS:0