mojira.dev
MC-52036

using testfor in execute command failure

What I did: I used the command

execute @e[name="name"] ~ ~ ~ testfor @a[team=B]

What I expected to happen: It would output a redstone energy signal depending on the amount of players in that team around the entity.

What actually happened: It would only output because the testfor command succeeded, not because it had detected multiple players. It had not given a different redstone energy level (2 instead of 1).

Linked issues

Comments 20

Yeah, it seems to output a signal based on how many time the execute command succeeded, instead of how many times the testfor succeeded, so it only outputs a power of 1, because only one entity executed the testfor command. I don't know if this is intended or not.

Yeah, I was making a domination point system, but then I discovered that it would only go up one at a time instead of two, which meant that it would've only output a signal of 1.

Why're you using an entity as a domination point, can't you use coords, you won't need an execute command then, just add the coords to the command. Unless you want the domination point to move, then entities would be useful.

The reason I'm using entities is because when I want to copy/paste the domination point, all I have to do is replace all entity names and player names in the whole build with the new ones, instead of using all kind of different coords.

Works as intended, the command block bases its output on the command it does, /execute in this case. That /execute triggers a command from another entity is not important.

Also: The comparator output of a /execute command is based on how many entities it selects at the first parameter, @e[name="name"] in this case. This means that if 2 entities are found that are called "name", the comparator will give a signal strength of 2.

10 more comments

The enviroment is supposed to contain pc details.

Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.

This is an automated comment on any open or reopened issue with out-of-date affected versions.

i think this issue is unworthy to fix.
/stats and /scoreboard can return a correct number of selected entities/players.
also,it's powerless to test more than 15 entities/blocks.

/testfor is gone in 1.13 so this is no longer an issue.

Probably rather fixed if the issue was really that /execute did not properly pass the success count.

A 18w03b equivalent should be the following command which works as expected, passing the success count of spreadplayers.

/execute as @e run spreadplayers ~ ~ 0.0 10.0 false @e

bananenbroek4

(Unassigned)

Confirmed

/execute, command, output, redstone, signal-strength, testfor

Minecraft 14w11b, Minecraft 1.8.3, Minecraft 16w33a

Minecraft 18w03b

Retrieved