1

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?

1
  • 2
    psst... the 2nd command also combines the scores using AND, not OR! So even if it could detect fake players, it wouldn't work! Jun 27, 2020 at 3:17

2 Answers 2

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.

0

In your case you only need two commands, not one per case, by using AND and inverting the result. I assume here that you want to trigger something if either page-2 of sticks_have is in 2.. or page-2 of plank_have is in 1.. (weird naming scheme BTW).

/execute unless score sticks_have page-2 matches 2.. unless score plank_have page-2 matches 1.. run tag @s neither
/execute unless entity @s[tag=neither] run …

You can use anything other than a tag as well, of course, as long as you can check the inverted case.

Here is the logic table of this:

┌─┬─┬──┬──┬─────┬────────┬───┐
│s│p│!s│!p│!s&!p│!(!s&!p)│s|p│
├─┼─┼──┼──┼─────┼────────┼───┤
│0│0│ 1│ 1│  1  │    0   │ 0 │
│0│1│ 1│ 0│  0  │    1   │ 1 │
│1│0│ 0│ 1│  0  │    1   │ 1 │
│1│1│ 0│ 0│  0  │    1   │ 1 │
└─┴─┴──┴──┴─────┴────────┴───┘

You must log in to answer this question.