mojira.dev
MC-17588

/testfor with fake player name

Testfor command for commands blocks doesn't work fine for non-player scores. As we can set scores for non-player, I assume we also can test non-player score as well.

For this test, I simply put a button on a command block, with a comparator out and a redstone lamp

/scoreboard objectives add testObj dummy
/scoreboard players set MyCharacterName testObj 10
/scoreboard players set FakeName testObj 10
/scoreboard objectives setdisplay sidebar testObj
>> OK
/testfor @a[name=MyCharacterName,score_testObj_min=5]
>> OK
/testfor @a[name=FakeName,score_testObj_min=5]
>> NOK

Attachments

Comments 3

/testfor just returns successful if the following finds a player. You're using a player selector, 'a', which will find all online players matching the given criteria. There is no way to find offline players at this time.

Would be nice to have this possibility!

I second that this feature would be nice! dummy scores for fake players is the best way of making scoreboards for teams in vanilla Minecraft games at the moment. A way to test for those scores would make things a lot easier for game mechanics.

Searching around for this there seems to be a fair number of people wanting to do this with testfor, hopefully something like this gets integrated someday!

Walm

(Unassigned)

Unconfirmed

Minecraft 1.5.2

Retrieved