3

I've went through various wiki pages and commands. I'm still stuck on the most basic command trying to make it work.

Here's the code:

/execute if block -272 70 199 minecraft:stone_button[powered=true] run say Hello, blocks!

Now the wiki says if block execute command works like /execute if block <position> <block> <command>. If I understood correctly, it should be:

  • if (block at -272 70 199 = powered stone button)
  • say "Hello, blocks!"

but well it doesn't do anything. Is there something wrong with the syntax?

enable-command-blocks is set to true, command block set to impulse-unconditional-always on, and I am the server admin.

※P.S. If somebody can tell me how the code structures work in this thing, it'd be greatly appreciated (mostly about what NBT tags are).

enter image description here enter image description here

4
  • Of course that only works if the button is pressed and the command block is activated at the same time. I tried it in a repeating command block and it works. Jun 15, 2019 at 9:25
  • I'm voting to close this (temporarily hopefully) as "unclear", because that's what comes closest to "we need more details". The given command (with changed coordinates, because I'm too lazy to go to the given coordinates) works fine for me, so there must be something else going on. Jun 15, 2019 at 9:28
  • Oh, yea, yep. That was pretty obvious darnit. that being said, do you know a way of running the code only once? or, for that matter, triggering the effect only once.
    – user233088
    Jun 15, 2019 at 9:41
  • You could put a conditional chain command block behind that merges {auto:0} into the repeating command block's data. Jun 15, 2019 at 10:52

3 Answers 3

1

The command has to be executed at the same time as the button is pressed, otherwise the check will fail.

0

You must have the command block executing repeatedly.

0

You gotta make it repeat-unconditional-always active because impulse and always active means it only activates once the first time you enter a command, and after that the command block is basically turned off.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .