Paste #21373: Untitled Paste

Date: 2015/10/22 16:08:16 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


"Citizenship":
 type: assignment

 interact scripts:
 - 1 Offer Citizenship

 actions:
   on assignment:
   # This enables interaction with NPC via clicking, entering proximity and damage.
   - trigger name:click toggle:true
   - trigger name:proximity toggle:true

   # Make the NPC look at players
   - lookclose state:true

"Offer Citizenship":
 type: interact

 steps:
   1:
     proximity trigger:
       entry:
         script:
         - ^narrate "<aqua><npc.name><red> looks down at you from his counter...""
         - ^chat "Oh great.... <yellow>Another<green> adventurer"
         - ^narrate "<aqua><npc.name><red> rolls his eyes and sighs..."
         - ^chat "If you are interested in citizenship for a town click me and we can get this over with."
         - ^playsound location:<npc.location> sound:chicken_idle

     click trigger:
       script:
       - chat "Would you like to join the <yellow>Hatchling <green>Isle or take the <yellow>Bathum <green>citizenship test?"
     chat trigger:
       1:
         Trigger: "I would like to joing /Hatchling/ Isle."
         Script:
         - execute as_op "townyadmin town Bathum remove <player.name>"
         - execute as_op "townyadmin town FarmField add <player.name>"
         - execute as_op "region addmember NewHatchlingIsle <player.name>"
       2:
         trigger: "I would like to take the /Bathum/ test."
         Script:
         - if <player.flag[Fishing]> == Claimed {
           - narrate "<npc.name> rolls their eyes in clear dissapointment."
           - chat "<yellow>You again... You can only apply for citizenship to Bathum once a day."
           }
           else {
             - flag player passBathumQuiz:true
             - inventory open d:in@BathumQuiz1
           }

##
## Bathum Quiz
## 

BathumQuiz1:
 type: inventory
 inventory: CHEST
 title: <&c>Answer to question one? <&9>
 size: 9
 definitions:
   A: i@BathumQuiz1AnswerA
   B: i@BathumQuiz1AnswerB
   C: i@BathumQuiz1AnswerC
   D: i@BathumQuiz1AnswerD
   E: i@BathumQuiz1AnswerE
 slots:
   - "[A] [] [B] [] [C] [] [D] [] [E]"
BathumQuiz1AnswerA:
 type: item
 material: red_wool
 display name: "Wrong"
 correct: false
BathumQuiz1AnswerB:
 type: item
 material: blue_wool
 display name: "Wrong"
 correct: false
BathumQuiz1AnswerC:
 type: item
 material: green_wool
 display name: "Wrong"
 correct: false
BathumQuiz1AnswerD:
 type: item
 material: yellow_wool
 display name: "Correct"
 correct: true
BathumQuiz1AnswerE:
 type: item
 material: Black_wool
 display name: "Wrong"
 correct: false

BathumQuiz2:
 type: inventory
 inventory: CHEST
 title: <&c>Answer to question two? <&9>
 size: 9
 definitions:
   A: i@BathumQuiz2AnswerA
   B: i@BathumQuiz2AnswerB
   C: i@BathumQuiz2AnswerC
   D: i@BathumQuiz2AnswerD
   E: i@BathumQuiz2AnswerE
 slots: 
   - "[A] [] [B] [] [C] [] [D] [] [E]"
BathumQuiz2AnswerA:
 type: item
 material: red_wool
 display name: "Wrong"
 correct: false
BathumQuiz2AnswerB:
 type: item
 material: blue_wool
 display name: "Correct"
 correct: true
BathumQuiz2AnswerC:
 type: item
 material: green_wool
 display name: "Wrong"
 correct: false
BathumQuiz2AnswerD:
 type: item
 material: yellow_wool
 display name: "Wrong"
 correct: false
BathumQuiz2AnswerE:
 type: item
 material: Black_wool
 display name: "Wrong"
 correct: false

BathumQuiz3:
 type: inventory
 inventory: CHEST
 title: <&c>Answer to question three? <&9>
 size: 9
 definitions:
   A: i@BathumQuiz3AnswerA
   B: i@BathumQuiz3AnswerB
   C: i@BathumQuiz3AnswerC
   D: i@BathumQuiz3AnswerD
   E: i@BathumQuiz3AnswerE
 slots: 
   - "[A] [] [B] [] [C] [] [D] [] [E]"
BathumQuiz3AnswerA:
 type: item
 material: red_wool
 display name: "Wrong"
 correct: false
BathumQuiz3AnswerB:
 type: item
 material: blue_wool
 display name: "Wrong"
 correct: false
BathumQuiz3AnswerC:
 type: item
 material: green_wool
 display name: "Wrong"
 correct: false
BathumQuiz3AnswerD:
 type: item
 material: yellow_wool
 display name: "Wrong"
 correct: false
BathumQuiz3AnswerE:
 type: item
 material: Black_wool
 display name: "Correct"
 correct: true


##
## Bathum Quiz Events
##

BathumQuizEvents:
   type: world
   events:
       ## Question 1
       on player clicks BathumQuiz1AnswerA in BathumQuiz1:
           - flag player passBathumQuiz <i@BathumQuiz1AnswerA.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz2
       on player clicks BathumQuiz1AnswerB in BathumQuiz1:
           - flag player passBathumQuiz <i@BathumQuiz1AnswerB.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz2
       on player clicks BathumQuiz1AnswerC in BathumQuiz1:
           - flag player passBathumQuiz <i@BathumQuiz1AnswerC.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz2
       on player clicks BathumQuiz1AnswerD in BathumQuiz1:
           - flag player passBathumQuiz <i@BathumQuiz1AnswerD.script.yaml_key[correct]>
           - narrate <i@BathumQuiz1AnswerD.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz2
       on player clicks BathumQuiz1AnswerE in BathumQuiz1:
           - flag player passBathumQuiz <i@BathumQuiz1AnswerE.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz2

       ## Question 2
       on player clicks BathumQuiz2AnswerA in BathumQuiz2:
           - flag player passBathumQuiz <i@BathumQuiz2AnswerA.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz3
       on player clicks BathumQuiz2AnswerB in BathumQuiz2:
           - flag player passBathumQuiz <i@BathumQuiz2AnswerB.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz3
       on player clicks BathumQuiz2AnswerC in BathumQuiz2:
           - flag player passBathumQuiz <i@BathumQuiz2AnswerC.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz3
       on player clicks BathumQuiz2AnswerD in BathumQuiz2:
           - flag player passBathumQuiz <i@BathumQuiz2AnswerD.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz3
       on player clicks BathumQuiz2AnswerE in BathumQuiz2:
           - flag player passBathumQuiz <i@BathumQuiz2AnswerE.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - inventory open d:in@BathumQuiz3

       ## Question 3
       on player clicks BathumQuiz3AnswerA in BathumQuiz3:
           - flag player passBathumQuiz <i@BathumQuiz3AnswerA.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - run BathumQuizEnd
       on player clicks BathumQuiz3AnswerB in BathumQuiz3:
           - flag player passBathumQuiz <i@BathumQuiz3AnswerB.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - run BathumQuizEnd
       on player clicks BathumQuiz3AnswerC in BathumQuiz3:
           - flag player passBathumQuiz <i@BathumQuiz3AnswerC.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - run BathumQuizEnd
       on player clicks BathumQuiz3AnswerD in BathumQuiz3:
           - flag player passBathumQuiz <i@BathumQuiz3AnswerD.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - run BathumQuizEnd
       on player clicks BathumQuiz3AnswerE in BathumQuiz3:
           - flag player passBathumQuiz <i@BathumQuiz3AnswerE.script.yaml_key[correct]>
           - determine cancelled passively
           - inventory close d:<context.inventory>
           - run BathumQuizEnd

BathumQuizEnd:
 type: task
 script:
 - narrate "Testing <player.flag[passBathumQuiz]> against true"
 - if player.flag[passBathumQuiz] == "true" {
   - execute as_op "townyadmin town FarmField remove <player.name>"
   - execute as_op "townyadmin town Bathum add <player.name>"
   - execute as_op "region addmember Bathum <player.name>"
   }
   else {
   - ^flag <player> bathumQuiz:Failed "duration:20h"
   - narrate "With a shake of their head they stamp a red X on your test."
   - narrate "I'm sorry. At least one of your questions were answered wrong. You can try again in a day."
   }