Paste #6960: sentry

Date: 2014/07/15 15:33:17 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Sentry:
  type: assignment
  interact scripts:
  - 100 TheSentry
  actions:
    on assignment:
    - trigger name:click toggle:true
TheSentry:
  type: interact
  steps: 
    1:
      click trigger:
        script:
        - if <npc.owner> = <player> {
          - chat "go to your city and walk until i teleport to you then tell me your faction name. Then say 'point one' for one part of the wall.  Then say 'point two' for the other side of the wall. then walk to the starting place and say 'origin' and i will start to make a circuit"
          - execute as_server "sentry <npc.id> guard <player.name>"
          }
          else {
          - chat "Good day to you sir."
          }
      chat trigger:
        'faction':
          trigger: "my faction name is /Regex.+/"
          script:
          - execute as_server "sentry <npc.id> ignore add faction:<player.chat_history>"
          - chat "Your faction has been registered"
        'point1':
          trigger: "this is your /point1/"
          script:
          - narrate "point one registered."
          - ^flag <npc> pos1:<player.location>
        'point2':
          trigger: "this is your /point2/"
          script:
          - narrate "point two registered."
          - ^flag <npc> pos2:<player.location>
        'origin':
          trigger: "this is your /origin/"
          script:
          - narrate "The sentry begins to patrol."
          - execute as_server "sentry <npc.id> guard"
          - ^flag <npc> origin:<player.location>
          #- execute as_server "sentry <npc.id> target add entity:all"
          - zap step:execute
    2:
      click trigger:
        script:
        - if <npc.owner> = <player> {
          - chat "Hello my lord which task would you like me to do?"
          - chat "Would you like me to continue or be your bodyguard"
          - zap 'step:ChooseTask'
          }
          else {
          - chat "Hello mate how are you?"
          - zap step:1
          }
    'ChooseTask':
      chat trigger:
        'miner':
          trigger: "I want you to /continue/."
          script:
          - zap <execute> 
        'farmer':
          trigger: "I want you to be a /bodyguard/."
          script:
          - zap 'step:bodyguard'
        'return':
          trigger: "I want you to /return/."
          script:
          - zap 'step:bodyguard'
    'continue':
      click trigger:
        script:
        - chat "Hello sir just making my rounds."
    'bodyguard':
      click trigger:
        script:
        - chat "Welcome to the bodyguard menu say hold to make me stop then follow for me to continue to guard you"
        - zap 'step:Stop'
    'stop':
      chat trigger:
        'Stop':
          trigger: "/Stop/!."
          script:
          - execute as_server "sentry <npc.id> guard"
        'Follow':
          triger: "/Follow/ me!"
          script:
          - execute as_server "sentry <npc.id> guard <player.name>"
execute:
  type: task
  script:
  - chat "meow"
  - ~walk <npc> <npc.flag[pos1]>
  - ~walk <npc> <npc.flag[pos2]>
  - ~walk <npc> <npc.flag[origin]>
  - zap <TheSentry> step:ChooseTask