Denizen/0.7/Task Scripts: Difference between revisions

From Citizens Wiki

< Denizen‎ | 0.7

No edit summary
No edit summary
 
Line 1: Line 1:
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
 
For more up-to-date information and full details on specific features (individual commands or tags, for example), check the [https://one.denizenscript.com/denizen/cmds/ Meta Documentation].
 
If you want a full tutorial to help get you set up, check out the [https://one.denizenscript.com/denizen/cmds/denizen/vids Tutorial Videos] on youtube or the [https://guide.denizenscript.com/ Beginner's Guide] text website.
 
If you need quick help, visit our [https://discord.gg/Q6pZGSR Discord group].
 
<br><br><br>
 
<span style="font-family:natalya-alternate-one; font-size:300%; margin-right:-7px; margin-left:-10px;">This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!</span>
 
<s><div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
Task scripts are just a simple list of [[Denizen/0.7/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.
Task scripts are just a simple list of [[Denizen/0.7/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 78: Line 89:
   </pre>
   </pre>


[[Category:Denizen 0.7]]
[[Category:Denizen 0.7]]</s>

Latest revision as of 16:12, 24 March 2020

For more up-to-date information and full details on specific features (individual commands or tags, for example), check the Meta Documentation.

If you want a full tutorial to help get you set up, check out the Tutorial Videos on youtube or the Beginner's Guide text website.

If you need quick help, visit our Discord group.




This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!

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

'Name of script':  
  Type: Task    
  Script:        
  - COMMAND1
  - COMMAND2
  - etc...

Using 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 'SCRIPT: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 'SCRIPT:Apple Reward'

Using the 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