You can use CommandStats to simulate an OR gate while reducing the amount of required command blocks (since you'd essentially be running two commands for the price of one).
Prerequisites
Objective to hold the CommandStats result.
/scoreboard objectives add Condition dummy
Single armor stand to summon, which could also be used for other chains that needs it (as its score is to be reset at the beginning of the chains). This will be the entity subject to CommandStats.
/summon ArmorStand ~ ~ ~ {Tags:["conditional"]}
Mechanism
Example mechanism (you can swap out the impulse for a repeating block):
Command blocks 2 and 3 will be the initial conditional blocks, where if either are successful you would run more commands. Place a temporary command block above each of them, place the following command inside it, and activate it (you would otherwise just run the command yourself, but the character limit was exceeded):
/stats block ~ ~-1 ~ set SuccessCount @e[type=ArmorStand,tag=conditional,score_Condition=0] Condition
Now if either of those two commands run, the armor stand will have their "Condition" score set equal to the number of successful iterations of the command.
However, it will only target the armor stand if it has a "Condition" score of 0. This means that if either of them are successful, the score will be 1 and will remain at 1 even if the next command block is unsuccessful.
Commands
The following are the commands for the example mechanism above.
Set the armor stand's "Condition" score to 0. This is needed so it can be targeted by this chain again.
/scoreboard players set @e[type=ArmorStand,tag=conditional] Condition 0
One of the conditionals to check. The success of this command will trigger its stored CommandStats.
/scoreboard players test #DAYTIME daytime 0 1000
The second conditional to check.
/scoreboard players test #DAYTIME daytime 12000 13000
After the conditionals have finished, the armor stand will have a score of 1 if either of them were successful. You can then detect this armor stand with a score of 1.
/testfor @e[type=ArmorStand,tag=conditional,score_Condition_min=1,c=1]
Command(s) to run if either of the conditionals were successful.
/say The time is either 0-1000 or 12000-13000.
My first recommendation would be to use a different method of running three commands. Two other possibilities you could use are chained command blocks or a function. If you absolutely need it in one command block then use a function, otherwise, use a chain of command blocks as it is simpler. To do the latter, place three command blocks next to each other so that they point into each other. Then when putting commands into the final two blocks, click the buttons below until they say Chain / Conditional / Always Active.
If you still want to use the falling block method, there are several problems that I see with your command.
You used escaped quotation marks(\”
) which are not needed in this case and cause a problem. You also used the wrong kind of quotation marks (”
vs "
)
You used the @s
target selector which targets the entity executing the command. The command block would output Entity '@s' cannot be found
. You will have to use an appropriate target selector. You could use @p
to target the player nearest the command blocks.
The first use of Passengers
(Passengers [{id:falling_block
) is missing :
.
The last command block command fill ~ ~-5 ~-1 ~~50 ~-1 redstone_block
has no space between x2 and y2(~~50
should be ~ ~50
). Also, the redstone blocks only need to be next to the blocks that need to be activated. With the current coordinates, you are producing a stack from one below the original command block, all the way to 50 above the last command block. I changed the fill coordinates to ~ ~-3 ~-1 ~ ~-1 ~-1
and it only puts the blocks where they are needed.
Another change. While it is not required to be changed, command block commands do not need to start with /
With all of these changes the command is:
summon falling_block ~ ~1 ~ {Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:bow 1"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"give @p minecraft:arrow 64"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"tp @p 384.700 7 400.700"},Passengers:[{id:falling_block,Block:command_block,Time:1,TileEntityData:{Command:"fill ~ ~-3 ~-1 ~ ~-1 ~-1 redstone_block"},Passengers:[{id:falling_block,Block:redstone_block,Time:1}]}]}]}]}
Note:This will only successfully run one time. After that, the command blocks and redstone blocks are already in place so if you run it again, it will cause command blocks and redstone blocks to break and be dropped as items.
You could correct this by removing all of the command blocks and redstone blocks that were created by the original command block. Either manually or with another command block.
Best Answer
You can run the function from a command block and in the function you can modify a command block later in the chain.
For example, I just tested this:
Regular command block that points into the chain command block:
function test:test
Function file:
data merge block <coordinates> {Command:"say a"}
with the coordinates of the chain command blockChain command block:
say test
I activated the regular command block and the output was:
And since it's a command block chain, everything happened in the same tick.
Note that it's impossible to run a function in a new thread or to do anything else in the middle of a function that you didn't specify in the function itself, because the function (and all the functions it calls) are executed as soon as possible, pausing everything else on the server in the meantime. It's true that some actions, like summoning entities, has effects that can be detected rightaway in the function, but none of those things can execute an arbitrary command instantly:
auto:1
(even the same one that ran the function)So the best you can currently do is to run the command that changes the chain command block's data as the last command in the function (or function call chain) and then do everything later in another function, triggered by another chain command block after that.