Denizen/0.7/Task Scripts: Difference between revisions

From Citizens Wiki

< Denizen‎ | 0.7

No edit summary
 
(18 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Task Scripts in detail ==
 
<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].
Task scripts are script that are called by either the RUNTASK command or PLAYERTASK command. These are more basic than trigger scripts since they have no requirements or step nodes. The types of commands are also more limited since there is no NPC Denizen associated with the script, but useful for certain situations.
 
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.
</div>
</div>


==== General layout of a Trigger Script ====
__TOC__
 
==== General layout ====
<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%;">
<pre>
<pre>
'Name of script':   # Name Node
'Name of script':
   Type: Task       # Type Node
   Type: Task  
   Script:           # Script Node
   Script:      
   - ...
  - COMMAND1
   - ...
   - COMMAND2
   - etc...
</pre>
</pre>
</div>
</div>


==== Using a Task Script with RUNTASK ====
==== Using 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 25: Line 38:
   Type: Task     
   Type: Task     
   Script:       
   Script:       
   - NARRATE You've received some APPLES. Nice!
   - NARRATE "You've received some APPLES. Nice!"
   - GIVE APPLE 10
   - GIVE APPLE QTY:10
   - FINISH
   - FINISH


'Apple Quest 1':
'Apple Quest 1':
   Type: Trigger
   Type: Interact
   Requirements:
   Requirements:
     Mode: All
     Mode: All
Line 39: Line 52:
       Click Trigger:
       Click Trigger:
         Script:
         Script:
         - CHAT Welcome to my house, have some apples!
         - CHAT "Welcome to my house, have some apples!"
         - RUNTASK Apple Reward
         - RUNTASK 'SCRIPT:Apple Reward'
    
    
'Apple Quest 2':
'Apple Quest 2':
   Type: Trigger
   Type: Interact
   Requirements:
   Requirements:
     Mode: All
     Mode: All
Line 52: Line 65:
       Click Trigger:
       Click Trigger:
         Script:
         Script:
         - CHAT Welcome to my orchard, have some apples!
         - CHAT "Welcome to my orchard, have some apples!"
         - RUNTASK Apple Reward
         - RUNTASK 'SCRIPT:Apple Reward'
</pre>
</pre>
</div>
</div>
==== 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.
<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>
[[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