-2

I need help with this command:

/setblock 262 73 -253 command_block[facing=east,conditional=false]{Command:"/execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}"} replace

Could someone fix this for me?
I have tried for hours and can't get it to work. It's supposed to place a command block with the command /execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}, but it just won't work. It needs to be facing east, with its conditional set to false. I did that, but it still won't work.

Note: my Minecraft version is 1.14.2

8
  • What part is failing? I have a good idea of some of the problems, and there are multiple, but it helps everyone if you describe in more detail how things aren't working.
    – MBraedley
    Jun 14 '19 at 18:33
  • The Part That Is Failing Is The "minecraft:tripwire_hook"}]}"} It Doesn't Seem To Like " Jun 14 '19 at 18:40
  • Msg Me Back If You See The Message @Virusbomb Jun 14 '19 at 18:42
  • I can't help with any Minecraft commands. I'm just a user here and help with reviewing and editing and cleaned up your question so it was more direct and the commands were easier to read.
    – Virusbomb
    Jun 14 '19 at 19:02
  • 3
    Escaping. You have quotation marks inside quotation marks, replace them with \". Jun 14 '19 at 19:04
2

You can´t have quotation marks within quotation marks, the game thinks that you have two text strings and some text in between.

You can use ' instead of the outer quotation mark, or you can mark a quotation mark as part of a string by using \

So either of these would work:

/setblock 262 73 -253 command_block[facing=east,conditional=false]{Command:'/execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}'} replace
/setblock 262 73 -253 command_block[facing=east,conditional=false]{Command:"/execute if block 258 73 -254 chest{Items:[{id:\"minecraft:tripwire_hook\"}]}"} replace

The easiest way to get a complex /setblock command that works propperly is to create the block that you want to set and then to look at it and press F3+I. This will put a setblock command into your clipboard, that you can paste in with Ctrl+V:

/setblock 262 73 -253 minecraft:command_block[conditional=false,facing=east]{auto:0b,powered:0b,LastExecution:1497985L,SuccessCount:1,UpdateLastExecution:1b,conditionMet:1b,CustomName:'{"text":"@"}',Command:'/execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}',LastOutput:'{"extra":[{"translate":"commands.execute.conditional.pass"}],"text":"[16:14:24] "}',TrackOutput:1b}

You can then remove the parts that are unimportant for your situation, to make the command shorter:

/setblock 262 73 -253 minecraft:command_block[conditional=false,facing=east]{Command:'/execute if block 258 73 -254 chest{Items:[{id:"minecraft:tripwire_hook"}]}'}

I suggest doing that in a text editor, as it is easier to format text there and the minecraft chat line is limited and cuts the end of the command. A command block is limited, too, but the limit is much higher. It is still not optimal for editing long commands though.

This works for creating /summon commands, too, simply look at an entity instead.

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