< close page >

Bedrock

Tutorial 1 of 6

You are viewing the Command Block Basics tutorial

YouTubeLinkLinkTwitterLink

Tutorial Selection

Command Block Basics
Target Selectors
Understanding Syntax
Basic Commands
Advanced Commands
Command Systems

Tutorial Contents

Impulse Command Block

Image of an impulse command block

This block is known as an "impulse command block". This type of command block will run any command it is programmed with only once (unless triggered multiple times by redstone). This command block acts as the start of command block systems that only require being ran once. Any player with the "Operator" permission level may access this block and view its contents. This block can only be obtained if cheats are enabled. You can obtain this block by typing the following command into chat:

/give @s command_block

Repeating Command Block

Image of a repeating command block

This block is known as a "repeating command block". This type of command block is similar to the "impulse command block" seen above. However, this command block will repeat any command it is programmed with multiple times until stopped. As mentioned above, this command block also acts as the start of command block systems; this one should be used if you need a command block system to run repeatedly (hence the name). Any player with the "Operator" permission level may access this block and view its contents. This block can only be obtained if cheats are enabled. You can obtain this block by typing the following command into chat:

/give @s repeating_command_block

Chain Command Block

Image of a chain command block

This block is known as a "chain command block". This type of command block chains commands together once triggered by an "impulse command block" or "repeating command block". The "chain command block" will run things only once (unless attached to a "repeating command block" or triggered multiple times by redstone). If placed correctly, you can run multiple commands in a row, one after the other, in the order that the commands are chained in. This command block will not work on its own, it must be triggered by one of the other command block types first. Any player with the "Operator" permission level may access this block and view its contents. This block can only be obtained if cheats are enabled. You can obtain this block by typing the following command into chat:

/give @s chain_command_block

Command Block UI (Left Side)

The command block UI is the menu you see appear when you open a command block. This section will discuss all the settings and quirks of the UI that you see on the left side. To view the UI, please make sure you have the "Operator" permission level and are in creative mode.

Hover Note

The "Hover Note" is quite literally what it says it is. It's a short note that floats above the command block when you look directly at it. This setting is optional, you do not have to fill it in. If you choose to fill it in, the text you enter will float above the command block as discussed. You may use this feature to help organise your command blocks. If a command block is renamed in an anvil, the name will be used as the hover note.

Note: If using the command /say, you will see the hover note appear as the "speaker" when the command is run. The hover note would appear before the message, in square brackets. If the hover note is left blank, you will still see the hover note; however, it will default as an exclamation mark.

Conditional

Image of a conditional chain command block

If the arrow on a command block looks like this, the command block is set to "conditional". The conditional setting means that in order for the command to run, it must first get a successful output from the command block behind it. If the command block behind it gives a failed output, the command block next in the chain will not run if it is set to "conditional". As this setting requires checking the output of the command block behind it, it is rendered useless in "impulse" and "repeating" command blocks. Command block textures matter, the arrows are the direction they are facing and the way the chain will run. Command blocks set to "conditional" require another command block behind them, or they will never run (this is because it has no "condition" to check).

Got an impulse or repeating command block not working? Make sure you have it set to "unconditional", they don't work otherwise remember! They're not chainable.

Unconditional

Image of an unconditional chain command block

If the arrow on a command block looks like this, the command block is set to "unconditional". The unconditional setting is the opposite of the conditional setting. A command block set to unconditional does not require a previous successful out (or any output) from a command block directly behind it for it to run. This means you can easily turn command block systems different directions, without a command block needing to be placed behind it giving a successful output. An unconditional command block will run, even if the command block behind it gives a failed output (as it never actually checks for an output).

Having trouble deciding which setting to use in your chain command block? It's easy! Use "conditional" if you want the command block behind it in the chain to run successfully first and "unconditional" if you don't care what that other command block is doing.

Always Active

Did you know that command blocks interact with redstone? Well, you do now. A command block that is set to "always-active" means it will run the command even if it does not get powered by redstone. A command block set to this will be always active (funny how that works, huh?). An "impulse" command block set to this setting will run the command it is programmed with once, immediately after it is set to this setting; the command block will then never do anything until it is changed (even if you power it with redstone). A "repeating" command block set to this setting will run continuously until stopped (it is also unaffected by redstone). Finally, a "chain" command block set to this setting will run the command it is programmed with once, provided that it is triggered by an "impulse" or "repeating" command block (or "chain", if it is in one - though, remember they need to be triggered by the other types). Make sure to keep all your "chain" command blocks on "always-active", as they're not run without being triggered anyway.

Needs Redstone

The "needs-redstone" setting means that command blocks to be powered by a redstone signal before it can run the command. A command block set to "needs-redstone" without a positive redstone signal will remain stagnant. An "impulse" command block set to "needs-redstone" and powered will run the command once. Unpowering and repowering an "impulse" command block will make the command run each time it is powered. A "repeating" command block set to "needs-redstone" with a positive redstone signal will run the command repeatedly until it is unpowered. Again, you can do some redstone to make this start and stop when you'd like. A "chain" command block really shouldn't need to be set to "needs-redstone", as they require being triggered by the other command block types first. However, if they are set to "needs-redstone", they'll require a redstone signal for the chain to work.

Tick Delay

The "tick delay" in a command block is used when you want to delay the command before it runs. If a tick delay is added, the command block will wait the amount of ticks specified until it runs the command. If no tick delay is added, the command is run on the first tick (or every tick, if the command block is a "repeating" command block). Tick delays require a continuous signal for them to work correctly. A command block set to "always-active" will mean that tick delays will always work correctly due to them always being powered. A command block set to "needs-redstone" will result in the command block needing a continuous positive redstone signal for the duration of the tick delay. If during the tick delay the signal drops, the command will not run. Here are some common conversions of real time into ticks, for your convenience:

Note: The "execute on first tick" setting can be changed if you have set a tick delay. If this toggle is enabled, the command block will run the command on the first tick that it is triggered. If the toggle is disabled, the command block will wait the tick delay before it runs the command when it is first triggered. Regardless of the setting, the command block will always wait the delay after it executes the first time.

Command Block UI (Right Side)

Reminder, the command block UI is the menu you see appear when you open a command block. This section will discuss all the settings and quirks of the UI that you see on the right side. Don't forget, to view the UI, please make sure you have the "Operator" permission level and are in creative mode.

Command Input

The command input box is where you'll type out the command you want the command block to run. Each command block may only run one command at a time (excluding the /execute command, as it is technically two commands in one).

Command Output

The "command output" toggle will change whether or not the command block provides feedback in the output box located under this setting. If the toggle is enabled, all feedback is displayed in the output box. If you make an error, the output box will tell you (reopen the command block's UI to update the feedback). If a command runs successfully from the command block, the results of the command will be displayed in the output box. This feedback is helpful when you want to find out why things aren't working and what happened when things did work.

Note: If the game rule commandblockoutput is set to true, the game will automatically enable the "command output" toggle in newly placed command blocks. If the game rule is set to false, the toggle will automatically be disabled in newly placed command blocks.

Â