3

So this is fairly complicated. I am making a sign, that when clicked, will give you a book, that when you click the text will execute a give command:

/blockdata ~ ~ ~-1 { Text1: "{ text:\"[Click For Book]\", color:dark_blue,clickEvent: { action:run_command, value:{"command":"/give @p written_book 1 0 {pages:%s,title:Book,author:Shop}","jobject":[{"text":"Click For 1 Gold","color":"gold","clickEvent":{"action":"run_command","value":"/scoreboard players add @p Gold 1"}},{"text":"     --------------                                                          "},{"text":"Click For 5 Gold","color":"gold","clickEvent":{"action":"run_command","value":"/scoreboard players add @p Gold 5"}},{"text":"     --------------                                                          "},{"text":"Click For 10 Gold","clickEvent":{"action":"run_command","value":"/scoreboard players add @p Gold 10"}}],"jtemplate":"book"} }}"} 

However when I execute this command it gives me:

[17:10:33] Data tag parsing failed: Unexpected token 'c' at: command":"/give @p written_book 1 0 {pages:%s,title:Book,author:Shop}","jobject":[{"text":"Click For 1 Gold","color":"gold","clickEvent":{"action":"run_command","value":"/scoreboard players add @p Gold 1"}},{"text":"     --------------                                                          "},{"text":"Click For 5 Gold","color":"gold","clickEvent":{"action":"run_command","value":"/scoreboard players add @p Gold 5"}},{"text":"     --------------                                                          "},{"text":"Click For 10 Gold","clickEvent":{"action":"run_command","value":"/scoreboard players add @p Gold 10"}}],"jtemplate":"book"} }}"

I do not understand why I am getting this error, can someone who is good at command proof-scan the command to make sure there are no errors? Thanks!

  • Sounds like you've either got an extra "c" or a missing character. Maybe a bracket? Either that or code is just wrong in that area. – Fezodge Oct 22 '15 at 21:16
  • 1
    @FezodgeIII It is complaining about the "c" in command, not an extra one, and no, I do not have any extra or missing brackets – David Oct 22 '15 at 21:17
4

You didn't escape any of the quotation marks in any of the string fields except for the text:\"[Click For Book]\" part.

If you want everything to be part of the Text1 string, then every time you write ", you should instead write \", except for the first and last instance. You have already done this in the part I mentioned, you just have to do it in the rest of the command.

|improve this answer|||||
-2

Try this. It works in 1.8

/setblock x y z wall_sign 0 replace {Text1:"{text:\"Click for book\",color:color,clickEvent:{action:run_command,value:\"/give @p book\"}}",Text2:"{text:\"\",color:color}",Text3:"{text:\"\",color:color}",Text4:"{text:\"\",color:color}"}

Don't mind the text 2-4 coz I just copied this from my Notepad.

|improve this answer|||||

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