TransWikia.com

How to embed quoted commands in a sign?

Arqade Asked on April 17, 2021

I am trying to run a title command when a player right clicks a sign. Here is my command for spawning the sign (generated here):

/give @p sign 1 0 {
    BlockEntityTag: {
        Text1: "{"text":"---------------","clickEvent":{"action":"run_command","value":"tp @s 0 66 13"}}",
        Text2: "{"text":"Right click once","clickEvent":{"action":"run_command","value":"playsound entity.player.levelup master @s ~ ~ ~ 10 1"}}",
        Text3: "{"text":"accepted!","clickEvent":{"action":"run_command","value":"/title @s title {"text":"Welcome to the Server!", "bold":true, "italic":false, "color":"green"}"}}",
        Text4: "{"text":"---------------"}"
    },
    display: {
        Name: "Custom Sign"
    }
}

However I get an error here:

{"t <---

I assume because of the double escape characters or nested quotes, but I tried single quotes and tried single escape characters to no avail. How would I run this command?

One Answer

You were very close. You saw that the title command required double escapement of the special characters. In your case, you tried ". A quote which is single escaped is ". To double escape it, you have to escape both characters which gives "

Here is a working command with the changes:

/give @p sign 1 0 {BlockEntityTag:{Text1:"{"text":"---------------","clickEvent":{"action":"run_command","value":"tp @s 0 66 13"}}",Text2:"{"text":"Right click once","clickEvent":{"action":"run_command","value":"playsound entity.player.levelup master @s ~ ~ ~ 10 1"}}",Text3:"{"text":"accepted!","clickEvent":{"action":"run_command","value":"/title @s title {"text":"Welcome to the Server!", "bold":true, "italic":false, "color":"green"}"}}",Text4:"{"text":"---------------"}"},display:{Name:"Custom Sign"}}

Correct answer by IronAnvil on April 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP