0

I want to have an information button show up in chat so when you press it, it tells you information or teleports you somewhere. I heard it uses /trigger but I'm not sure how to use that. Does anyone know?

FireStrike289
  • 1,301
  • 9
  • 21
  • 33

1 Answers1

1

You may want to copy and paste the following code into a command block. Then you can use your way to activate the command block. Then, the chat pane will pop up the text and when players click on it they will be automatically teleported.

/tellraw @a {"text":"","extra":[{"text":"<Normal text, cannot be clicked>"},{"text":"<Text that teleports you>","clickEvent":{"action":"run_command","value":"<Command, in this case, /tp @p [x] [y] [z]>"}},{"text":"."}]}

Notice that {"text":"<Normal text, cannot be clicked>"},can be omitted.

[EDIT] This is an example:

Lets say you want the players to click on the words "HERE" in the chat pane and they will be teleported. You can use the following code:

/tellraw @a {"text":"","extra":[{"text":"Click to be teleported:"},{"text":"HERE","clickEvent":{"action":"run_command","value":"/tp @p 1 1 1"}},{"text":"."}]}

Then the player will be teleported to 1, 1, 1.

If you want to want players to teleport to 1 1 1 when clicking "1" and 2 2 2 when clicking "2", then just do:

/tellraw @a {"text":"","extra":[{"text":"1","clickEvent":{"action":"run_command","value":"/t‌​p @p 1 1 1"}},{"text":"2","clickEvent":{"action":"run_command","value":"/tp @p 2 2 2"}}]}

Go to this website to see more. This is the source of this answer. http://www.minecraftforum.net/forums/minecraft-discussion/redstone-discussion-and/351959-1-8-raw-json-text-examples-for-tellraw-title-books#ACTIONSclick

54D
  • 4,877
  • 9
  • 36
  • 64
  • What does omitted mean? Also can I have to click buttons next to eachother? – FireStrike289 Nov 15 '14 at 07:24
  • Omitted means you can choose not to add any normal text. You can also add click buttons next to each other, just continue adding strings between "extra":[ and ]. If you want to want players to teleport to 1 1 1 when clicking "1" and 2 2 2 when clicking "2", then just do: /tellraw @a {"text":"","extra":[{"text":"1","clickEvent":{"action":"run_command","value":"/tp @p 1 1 1"}},{"text":"2","clickEvent":{"action":"run_command","value":"/tp @p 2 2 2"}}]} – 54D Nov 15 '14 at 07:25
  • Awesome that's all I needed. – FireStrike289 Nov 15 '14 at 07:30