End of Input Error in Tellraw

End of Input Error in Tellraw - Black and Red Laptop Computer

I have a /tellraw command, straight from my map:

 /tellraw @a [{"text":"I am a "},{"text": "DOOFUS",
 "color":"red"},{"text":".
 "},{"text":"Yes","color":"red","clickEvent":{"action":"run_command","value":"/tellraw
 @a [{\"text\":\"You are \"},{\"text\":\"OFFICIALLY
 \",\"color\":\"red\"},{\"text\":\"a
 \"},{\"text\":\"DOOFUS\",\"color\":\"red\"},{\"text\":\"\nGo to the
 bottom-left of the map
 name.\"}]"}},{"text":"No","color":"green","clickEvent":{"action":"run_command",
 "value":"/tellraw @a {\"text\":\"\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\"}"}}]

When I run it, the chat reports I am a DOOFUS. YesNo, but when I click Yes, it says Invalid json: End of Input at line at line 1 column 89. Clicking No works.



Best Answer

When a player runs a command from a click event via /tellraw, they are running the command as if they have typed the command themselves into the chat. This means they are subject to standard chat limitations, such as the requirement of being OP'd and a 100-character limit.

The command you're trying to have them run exceeds that limit at 192 characters.

You will need to use a shorter command instead. If OP status is a concern, you have to use /trigger, which will modify the executor's score of the "trigger" type without needing to be OP'd.

Prerequisites

  1. Adding the "trigger" objective-type, which is the only objective-type that can be used with the /trigger command (meaning you cannot use "dummy").

    /scoreboard objectives add CLICKED trigger
    
  2. The commands you would run in /tellraw's click event would instead be:

    /trigger CLICKED set 1
    /trigger CLICKED set 2
    

Clock commands

The following must be run in numerical order on a clock.

  1. If a player activates their trigger, it becomes locked and cannot be activated again. You can constantly enable their trigger to avoid locking, though it would be up to you to determine if there's a need to keep it locked.

    /scoreboard players enable @a CLICKED
    
  2. Run the nested /tellraw command if the player clicked "Yes", which set their score to 1.

    /tellraw @a[score_CLICKED_min=1,score_CLICKED=1] [{"text":"You are "},{"text":"OFFICIALLY","color":"red"},{"text":"a"},{"text":"DOOFUS","color":"red"},{"text":"\nGo to the bottom-left of the mapname."}]
    
  3. Run the nested /tellraw command if the player clicked "No", which set their score to 2.

    /tellraw @a[score_CLICKED_min=2,score_CLICKED=2] {"text":"\n\n\n\n\n\n\n\n\n\n"}
    
  4. Reset the player's "CLICKED" score to 0.

    /scoreboard players set @a[score_CLICKED_min=1] CLICKED 0
    



Pictures about "End of Input Error in Tellraw"

End of Input Error in Tellraw - Black and Red Laptop Computer
End of Input Error in Tellraw - Expressive angry businessman in formal suit looking at camera and screaming with madness while hitting desk with fist
End of Input Error in Tellraw - Woman in White Long Sleeve Shirt Using Macbook Pro





expect '}' at end of input e expected declaration before '}' token no arduino




More answers regarding end of Input Error in Tellraw

Answer 2

Here is another (possibly easier) way:

Make the Yes command run a /setblock x y z redstone_block. The x y z are linked to two command blocks with what the Yes was originally connected to (except without the extra backslashes), and a /setblock x y z air.

Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Foysal Ahmed, Foysal Ahmed, Andrea Piacquadio, cottonbro