# SPLEEF ORGANIZER is an interact script example with a task loop for 0.8.4+. # # This script is kept simple to allow a base scripting example to extend upon. # # Tell the npc: # - 'join' to be added to the list of Spleef players. # - 'leave' to be removed from the list. # - 'start' (only if you are an operator) to get all the players on the list # teleported to the same spot. # # @version 1.1 # @last-updated Jan 30 2013 # @author davidcernat "Spleef Organizer": type: assignment default constants: # Here you must choose the coordinates to which players are teleported. Spleef X Coordinate: 300 Spleef Y Coordinate: 70 Spleef Z Coordinate: 300 # Here you must choose the name of the world to which players are teleported. Spleef World: world actions: on assignment: - trigger name:chat toggle:true cooldown:1 interact scripts: - 10 Spleef Organizer Conversation 'Spleef Organizer Conversation': type: interact steps: 'Spleef*': click trigger: script: - ^if "<flag.p:Met Spleef Organizer>" chat "Yes, <player.name>? Are you here to join, leave or start?" else chat "I am the Spleef organizer. Do you wish to join, leave or start?" - ^flag player "Met Spleef Organizer:true" chat trigger: '1': trigger: "I want to /join/." script: - ^if "<flag.g:Spleef Players.aslist>" contains "<player.name>" chat "You have already joined. Please wait for the game to start." else runtask "script:Spleef Player Joins" '2': trigger: "I would like to /leave/." script: - ^if "<flag.g:Spleef Players.aslist>" !contains "<player.name>" chat "You are not on the list of players." else runtask "script:Spleef Player Leaves" '3': trigger: "Let's /start/." script: - if "<flag.g:Spleef Players.aslist || 0>" < 1 chat "No players have joined Spleef yet." else if "<player.is_op>" == true runtask "script:Spleef Teleport Loop" else chat "You need to be an operator to be able to start a game of Spleef." "Spleef Player Joins": type: task script: - ^flag global "Spleef Players:->:<player.name>" - announce "<yellow><player.name> <red>has joined Spleef!" "Spleef Player Leaves": type: task script: - ^flag global "Spleef Players:<-:<player.name>" - announce "<yellow><player.name> <red>has left Spleef!" "Spleef Teleport Loop": type: task script: - ^if "<flag.g:Spleef Players.size || 0>" > 0 runtask "script:Spleef Teleport Player" instant else announce "<red>All players have been sent to the arena!" "Spleef Teleport Player": type: task script: - teleport "location:<cons:Spleef X Coordinate>,<cons:Spleef Y Coordinate>,<cons:Spleef Z Coordinate>,<cons:Spleef World>" "targets:player.<flag.g:Spleef Players[1]>" - flag global "Spleef Players:<-:<flag.g:Spleef Players[1]>" - runtask "script:Spleef Teleport Loop" instant
In this script the trigger section only lists chat even though click trigger is present in the scrip, you just need to add - trigger name:click toggle:true under the line for chat trigger.