How can I run a command if one or more conditions in /execute are satisfied?
In Minecraft 1.16.1, I’m trying to make a system thats detects when one of several fake players doesnt have a specific score. Here is my first attempt:
execute unless score sticks_have page-2 matches 2.. unless score plank_have page-2 matches 1.. run ...
After trying this, I realized that all scores need to be in the correct range before it runs the command! But I want it to run the command when any of the scores are in range.
I thought of using the following command, but it doesn’t detect fake players:
execute unless entity @a[scores={sticks_have=2..,plank_have=1..}] run...
I know I can use multiple command blocks, but I would rather not, just do I can conserve space.
What can I do?
Solution 1:
Unfortunately, combining if
and unless
arguments using OR is hard to achieve. Most of the time, you'll have to have one command per possibility. When you have many different possibilities, try using functions1 for each possibility.
1If you are using older versions of Minecraft, you'll need to find the correct version of the page in the history.
A similar problem exists when trying to combine target selector arguments using OR. See the other question here.