How do I fix a command generated by MCStacker? [duplicate]
I'm trying to make a map with a death-checker. I'm not a command pro, so I used MCStacker to generate a command. The below command is a function that I generated:
give @p chain_command_block{display:{Name:'{"text":"Consequence block","color":"blue","bold":true}'},Enchantments:[{}],BlockEntityTag:{Command:"execute if score @p Deaths matches 10 run title @p title {"text":"this is a test","color":"#6BFF93","bold":true}",auto:1b}} 1This will give me a command block, which will check if I'm at 10 deaths and if so, will execute a title. But for some reason it doesn't work. Instead, the command generator wants me to make the code like this:
run title @p title {"}} 1But if I do that, my command doesn't work anymore.
I've been stuck with it for a few hours now. How can I get this command to work? I'd prefer solutions that fix the issue in MCStacker so I can regenerate the command.
My screen with the commands:
The error in Minecraft log:
61 Answer
Look carefully at the help popup that appears when you click the ? next to the Command field.
It says:
The command to execute. Commands containing double quotes will need to be escaped. Prefix any double quotes with a backslash.
For example \"
That gives you all the info you need to fix the command.
The issue that arises when you fail to follow this info is linked at this question. Read it and its accepted answer if you want a technical insight as to what is going on.
In your case...
Your current command is:
/give @s chain_command_block{display:{Name:'{"text":"Consequence block"}'},Enchantments:[{}],BlockEntityTag:{Command:"SEE_BELOW",auto:1b}}Your command that is in the command block is:
execute if score @p deaths matches 10 run title @p title {"text":"this is a test","color":"#60FF93","bold":true}Looking at the quote above, you will need to go through your command and put a \ before every ". Doing it on the following strings of text would look like this:
"""would become\"\"\""hello"would become\"hello\"{"text":"You died!"}would become{\"text\":\"You died!\"}
And your command listed above would become:
execute if score @p deaths matches 10 run title @p title {\"text\":\"this is a test\",\"color\":\"#60FF93\",\"bold\":true}Paste the above into the Command field of MCStacker and it should work just fine.