3

I managed to this before, but now I'm getting errors with the same format of a command. The idea is I'm attempting to make a blockdata command that will set a sign to say something (which works before adding the tellraw) that has a ClickEvent running a tellraw command that will display the info of the map. The problem is, the command gives me this error:

[00:44:34] Data tag parsing failed: Expected '}' but got 't' at: ...d\",\"value\":\"tellraw @p [\{\"t<--[HERE]

I can't figure out what is wrong with that point, though. Like I said in the beginning, I've done this before in a previous map, using what I think was the same command aside from the actual data of what the sign and tellraw said.

What is the problem with this command?

/blockdata ~ ~1 ~ {Text1:"{\"text\":\"Right Click\",\"color\":\"blue\",\"bold\":true,\"underlined\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"tellraw @p [\\{\\"text\\":\\"Welcome to \\",\\"color\\":\\"gold\\"},{\\"text\\":\\"World of Lights\\",\\"bold\\":true,\\"italic\\":true,\\"color\\":\\"green\\"},{\\"text\\":\\" \\",\\"bold\\":true,\\"color\\":\\"gold\\"},{\\"text\\":\\"by \\",\\"color\\":\\"gold\\"},{\\"text\\":\\"jackmaster110\\",\\"underlined\\":true,\\"color\\":\\"yellow\\"},{\\"text\\":\\"!\\",\\"underlined\\":true,\\"color\\":\\"gold\\"},{\\"text\\":\\"\\n\\"},{\\"text\\":\\"Info:\\nTo play you must click the \\\\"play\\\\" sign behind you. Then you will be dropped into the map.\\nThis is a map where you must get through the \\\\"World of Lights.\\\\" There will be challenges such as parkour,puzzles,and some other kinds of awesomeness.\\nIf you enjoy the map please check out the other maps and minigames available on the server.\\",\\"color\\":\\"gold\\"},{\\"text\\":\\"\\n\\"},{\\"text\\":\\"Have fun!!!!\\",\\"color\\":\\"gold\\"}]\"}}",Text2:"{\"text\":\"asdasdfasdgdasfeasdf\",\"color\":\"green\",\"underlined\":true,\"strikethrough\":true,\"obfuscated\":true}",Text3:"{\"text\":\"asdasdfasdgdasfeasdf\",\"color\":\"green\",\"underlined\":true,\"strikethrough\":true,\"obfuscated\":true}",Text4:"{\"text\":\"For Info\",\"color\":\"blue\",\"bold\":true,\"underlined\":true}"}
  • That error message is not very helpful. You probably have a bracket problem, but not at all at that spot. It just happens to be the first character that the compiler has problems with. – Fabian Röling Nov 15 '17 at 8:04
  • Can you try using the tellraw command on its own, correcting it where necessary and then escape the quotation marks, brackets and backslashes using the search and replace function of a text editor? That should make it much easier. – Fabian Röling Nov 15 '17 at 8:19
  • I think I found your problem, but I can't test it: You have to escape the curly brackets ({ and }) if they are part of a string. Escaping the square brackets ([ and ]) might also be necessary. – Fabian Röling Nov 15 '17 at 8:22
  • No, brackets don't have to be escaped, but they were escaped too much right after the opening square bracket behind the tellraw command. – D-Inventor Nov 15 '17 at 9:51
  • @arghtype Here is a question over in meta about putting Minecraft commands into quote blocks. I believe the general consensus is that commands should be put into code blocks, not block quotes. – IronAnvil Nov 15 '17 at 22:40
5

It all has to deal with the escaping of special characters. I am guessing that you used a tellraw generator and then stuffed that into a command sign generator of some sort. They do well but are not very good at escaping characters when it gets complicated. The above linked sign generator even includes:

Note: The sign generator is somewhat fragile. If something does not work try adding a preceding \ to your special chars.

In your case, the command inside the other command requires double escaping of special characters. The tellraw list is what needs the extra escaping.

Quotation marks are escaped \". Then they need both characters escaped for the second escaping. You are escaping the \ with another and escaping the " with \ which gives you \\\". Some call this triple escaped.

In the case of line breaks \n, you need to double escape the \ . The first escape gives \\ and then escape those two for the second escape which gives \\\\n.

One last one. The most complicated of the bunch. The quotation marks in your tellraw text to give you "World of lights" displayed in chat with quotation marks. Truly triple escaped. They are escaped once because they are in the text to be displayed which gives us \". They then still have to be escaped twice just like the above stuff. They are escaped a second time which gives us \\\". Finally, all characters have to be escaped that third time. There are four characters to escape so that gives us \\\\\\\"

You also had some slashes that were not needed in this portion: tellraw @p [\\{

Here is your command with proper escaping of special characters:

/blockdata ~ ~1 ~ {Text1:"{\"text\":\"Right Click\",\"color\":\"blue\",\"bold\":true,\"underlined\":true,\"clickEvent\":{\"action\":\"run_command\",\"value\":\"tellraw @p [{\\\"text\\\":\\\"Welcome to \\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\"World of Lights\\\",\\\"bold\\\":true,\\\"italic\\\":true,\\\"color\\\":\\\"green\\\"},{\\\"text\\\":\\\" \\\",\\\"bold\\\":true,\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\"by \\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\"jackmaster110\\\",\\\"underlined\\\":true,\\\"color\\\":\\\"yellow\\\"},{\\\"text\\\":\\\"!\\\",\\\"underlined\\\":true,\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\"\\\\n\\\"},{\\\"text\\\":\\\"Info:\\\\nTo play you must click the \\\\\\\"play\\\\\\\" sign behind you. Then you will be dropped into the map.\\\\nThis is a map where you must get through the \\\\\\\"World of Lights.\\\\\\\" There will be challenges such as parkour,puzzles,and some other kinds of awesomeness.\\\\nIf you enjoy the map please check out the other maps and minigames available on the server.\\\",\\\"color\\\":\\\"gold\\\"},{\\\"text\\\":\\\"\\\\n\\\"},{\\\"text\\\":\\\"Have fun!!!!\\\",\\\"color\\\":\\\"gold\\\"}]\"}}",Text2:"{\"text\":\"asdasdfasdgdasfeasdf\",\"color\":\"green\",\"underlined\":true,\"strikethrough\":true,\"obfuscated\":true}",Text3:"{\"text\":\"asdasdfasdgdasfeasdf\",\"color\":\"green\",\"underlined\":true,\"strikethrough\":true,\"obfuscated\":true}",Text4:"{\"text\":\"For Info\",\"color\":\"blue\",\"bold\":true,\"underlined\":true}"}

Which gives us: Sign

My head hurts. Tough question.

  • Thank you, it works perfectly. In relation to the command generators, I know enough about tellraw commands, so I wrote that myself, but you're right about the sign generator. Also, I added the escapes to the [\\{ because earlier it was giving me an error there, so I wasn't sure if that would fix it or not. Again, thank you, and I'm sorry I made your head hurt. – Bob the Gamer Nov 15 '17 at 22:39
  • 2
    No problem on the hurting head. A good challenge is wonderful exercise for the grey matter. Glad you have your solution. Hopefully I explained the escaping clearly. Hard to explain when it gets that deep. – IronAnvil Nov 15 '17 at 22:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.