You can do this using the /tellraw
command. The syntax is:
/tellraw <player> <raw json message>
For example, to have a command that activates on click, try running this:
/tellraw @a {"text":"Click this!","clickEvent":{"action":"run_command","value":"/say Hello!"}}
That has a "clickEvent" of type "run_command" with a value of the command to be run. There's a lot of different things you can do with JSON: displaying scoreboard objectives, selectors, items, achievements, entities, different text formatting, etc.
Here's a more complex command with the Yes/No choice and output you wanted:
/tellraw @p ["",{"text":"Yes","color":"green","bold":"true","clickEvent":{"action":"run_command","value":"/tellraw @p {\"text\":\"Confirmed!\",\"color\":\"green\"}"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Confirm","color":"green"}]}}},{"text":"/","color":"dark_gray","bold":"false"},{"text":"No","color":"red","bold":"true","clickEvent":{"action":"run_command","value":"/tellraw @p {\"text\":\"Cancelled\",\"color\":\"red\"}"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Cancel","color":"red"}]}}}]
You may want to learn more about the raw JSON text format, or use a JSON generator.
Best Answer
After 1.7, you can no longer refer to a block by its numeric Block ID; instead you must use its full name. Thus, you should replace
152
withredstone_block
.Also, with
/setblock
, you need to specify the[dataValue]
before you can specify the[oldBlockHandling]
mode, so you should add a0
beforedelete
.Fixed command should look like:
In situations like this where you're setting signs that execute commands or have nested execute commands, I often find it useful to "unwrap" it and try each layer of command separately.
For example, you can try the innermost command (
/setblock -44 110 248 152 delete
) in chat or a command block to get a somewhat useful message that can help you with fixing the first error: