Denizen/0.7/Example Scripts/Beginner Scripts: Difference between revisions

From Citizens Wiki

< Denizen‎ | 0.7

No edit summary
Line 62: Line 62:
           - CHAT "Press 'e' to open your inventory, and drag the shovel to your item bar"
           - CHAT "Press 'e' to open your inventory, and drag the shovel to your item bar"
           - CHAT "Press the number 1-9 to select the shovel, then start digging!"
           - CHAT "Press the number 1-9 to select the shovel, then start digging!"
</pre>
|}
==The Race==
Coach wants you to RUN, BOY! This script uses a TASK script and a Location trigger to make a timed race for the player. Good example of ZAP and RUNTASK/CANCELTASK command usage. Be sure and define a Location Bookmark on Coach behind the tree using the
/denizen bookmark location
command.
{| class="wikitable collapsible collapsed"
! Joe the Builder Script and Assignment
|-
|
<pre>
---- assignments.yml----
Denizens:
  Coach:
    Interact Scripts:
      - 0 Coaches Race
   
---- Scripts.yml -----
'RaceEnd':
  Type: Task   
  Script:     
  - NARRATE "%%cTimes Up!"
  - ZAP 'SCRIPT:Coaches Race' 3
 
"Coaches Race":
  Type: Interact 
  Requirements:
    Mode: All
    List:
    - -FINISHED Coaches Race
  Steps:
    1:
      Click Trigger:
        Script:
          - CHAT "Think you're fast, sonny-jim?"
          - CHAT "Lets see how fast you are. Run up that hill, around the tree, and back in 15 seconds, if you can!"
          - WAIT 1
          - CHAT "On your mark, get set, go!"
          - RUNTASK SCRIPT:RaceEnd DELAY:15
          - ZAP 2
    2:
      Location Trigger:
        1:
          Trigger: theTree
          Script:
            - ZAP 4
      Click Trigger:
        Script:
          - CANCELTASK RaceEnd
          - CHAT "Trying to cheat eh?, you have to go around the tree!, try again later, slowpoke!"
          - ZAP 1
    3:
      Click Trigger:
        Script:
          - CHAT "Aww too slow!, go run some laps and try again!"
          - ZAP 1
    4:
      Click Trigger:
        Script:
          - CANCELTASK RaceEnd
          - CHAT "Woo, you are quick! Good job!"
          - GIVE MONEY QTY:1000
          - FINISH
</pre>
</pre>
|}
|}

Revision as of 00:22, 7 September 2012

Example scripts are provided with both the assignments and the scripts in the same box. Be sure and put the text in the correct file in your plugins folder.

  • Assignments should always be appended to plugins\Denizen\assignments.yml
  • Scripts can be placed in any .yml file in the plugins\Denizen\scripts\ directory



Joe the Builder

This is the script from the start-up kit. It's 2 interact scripts assigned to 1 Denizen named Steve. He will respond different to a right-click by a player depending on whether or not the player has the modifyworld.* permission.

The Race

Coach wants you to RUN, BOY! This script uses a TASK script and a Location trigger to make a timed race for the player. Good example of ZAP and RUNTASK/CANCELTASK command usage. Be sure and define a Location Bookmark on Coach behind the tree using the

/denizen bookmark location

command.