2

This command is still a work in progress, but I am having issues. It gives me an error message when I click "Check Balance" and the error message says: Invalid json: Unterminated string at line 1 column 89. I don't know what this means. Here is my command:

/tellraw @p ["",{"text":"Welcome, ","color":"green"},{"selector":"@p","color":"dark_blue","bold":"true"},{"text":". How may I help you? -","color":"green","bold":"false"},{"text":" Check Balance","clickEvent":{"action":"run_command","value":"/tellraw @p [{\"text\":\"You currently have: \",\"color\":\"green\"},{\"score\":{\"name\":\"@p\",\"objective\":\"Money\"},\"color\":\"dark_blue\",\"bold\":\"true\",\"underlined\":\"true\"},{\"text\":\" funds in your account.\",\"color\":\"green\"}]"},"color":"none"}]

Can someone explain why this is so?

  • I don't know how the Json has to be build for this command, but, if you use some tool like: www.jsonlint.com and paste the json, this will say you if is correct or not. – Shudy Jun 2 '15 at 10:22
  • 1
    @Shudy I don't think that will work for this code, because it's a Minecraft command and not actual code. I tried it and it gave an error at column one, and that's not the problem he's having. – Dorian Dore Jun 2 '15 at 10:26
  • I used jsonlint to parse the JSON-parts of both the exterior command and the run_command, and both are fine. I pasted the command to [RegExr](regexr.com) to find missing quotation marks using ("|\\"){1}([a-zA-Z \@\,\?\-._:]*)\1 which matches everything inside either " " or \" \", there are none missing. – MrLemon Jun 2 '15 at 12:34
3

run_command has a 100 character limit

After double and triple-checking your quotation marks and brackets, I played around with the run_command itself, and I found that it is subject to the same 100 character limit that chat commands are. The reason for this is that the player is treated as actually having run this command himself (including all permission checks).

This means, that starting with the JSON opening square bracket, only 89 characters are processed, seeing that /tellraw.@p. is 11 characters.

For example

/tellraw @p [{"text":"Check Balance","clickEvent":{"action":"run_command","value":"/tellraw @p [\"........10........20........30.......39.\",{\"score\":{\"name\":\"@p\",\"objective\":\"Money\"}}]"}}]

works. After unescaping the ", the nested command is exactly 100 characters long. On the other hand,

/tellraw @p [{"text":"Check Balance","clickEvent":{"action":"run_command","value":"/tellraw @p [\"........10........20........30........40.\",{\"score\":{\"name\":\"@p\",\"objective\":\"Money\"}}]"}}]

breaks with "End of Input at line 1 column 89", which makes sense considering the closing square bracket is cut off.

Note that the length of the exterior command does not matter at all.

  • I have found some workarounds that work by either summoning an ArmorStand and using execute on them, or by incrementing a scoreboard objective (either trigger or dummy). Unfortunately, this will always cause the command output to appear, i.e. something like "Set score for player" or "Summon successful", which I personally don't really like. – MrLemon Jun 2 '15 at 15:38
-1

It most likely means that you have a string that you haven't ended. So for example, you may have a string that, instead of saying "test", it says "test

When you forgot to close the string it most likely messed up the rest of the code. You have a lot of quotations in there, so it only makes sense that you might make that mistake.

Also, make sure all your brackets and square brackets or properly opened and closed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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