mojira.dev
MC-50601

Scoreboard reset not equal to 0

Using a @a[score_test=0] argument doesn't affect players that have been reset with the "/scoreboard players reset <players>" command.

*What I expected to happen was*
The reset players would be considered as having a score of 0 and be affected by commands that use the @a[score_test=0] argument.

*What actually happened was*
they are not affected by the commands

*Steps to Reproduce* (example used in attached file)
1. create a scoreboard objective (/scoreboard objectives add test dummy)
2. set two commands on a clock
    Bottom: tell @a[score_test=0] testing
    Top: scoreboard players set @a[score_test=0] test 1
3. when using the (scoreboard players set @a test 0) the commands do what they should. saying "testing" and setting your test score to 1.
4. when reseting the score (scoreboard players reset @a) the commands does not affect you.

Linked issues

MC-51848 Testfor player of score 0 is not equal anymore to a player with reseted score Resolved MC-51983 Player score does not default to 0 in objectives. Resolved MC-52654 Scoreboard cannot test 0 after reset Resolved MC-53014 Scoreboard objectives don't work properly with command parameters Resolved MC-54305 Minecraft 14w18a snapshot Scoreboard problems Resolved

Attachments

Comments 26

Stephen Kowalski

Environment: Mac OSX 10.9.2 Java 7 update 51
I believe this is the same as the bug I'm experiencing. Here's another way to explain it:

In previous versions (confirmed in 1.7.5), executing the command "/scoreboard players set @a[score_ones=0] ones 1" would set all online players with score 0 or less AND all players who were not on the ones scoreboard.

in 14w10c, the same command only sets the score for players who are already on that scoreboard.

Stephen Kowalski

Image 1: Showing two players online, one has no value for the ones objective, the other has 0.
Image 2: Showing the command to be executed "/scoreboard players set @a[score_ones=0] ones 1"
Image 3: Showing the results. The player with 0 in ones was set to 1. The player with no value for ones was not set.

Confirmed (on Windows 8)

Related to MC-51330 ?

This behaviour may be intended, @unknown wrote in MC-50145:

Use "/scoreboard players reset * score" instead of "/scoreboard players set * score 0" to remove scores from the players.

16 more comments

Can you also explain me why this should be WAI?

Alright maybe this works as intended, but then these bugs need to be fixed:

  • MC-61657 which is caused by this

  • MC-61662 which IS a bug, because you cannot test for this, even if it is NULL!

???
Because

the reset subcommand removes a score from a player completely. this is not the same as setting it to 0 using the scoreboard player set command.

or with other words: Because @unknown coded this to work that way.

Then it would be null... I guess

Each class variable, instance variable, or array component is initialized with a default value when it is created:
For all reference types, the default value is null.

http://stackoverflow.com/questions/2707322/what-is-null-in-java

Would be very nice if I get an answer 🙂

It would be nice if we could test for a null score, like we can with teams:

@a[score_objective=]

In the meantime (or if it never happens), I have a workaround.

/scoreboard players set @a nullObjective 1
/scoreboard players reset @a[score_objective_min=0] nullObjective

Now, all players who have a null score for "objective" will have a score of 1 for "nullObjective".

The two commands must be run in the order listed, and both must be run before any command blocks looking for a player with a score of 1 for "nullObjective".

JaRsCrafted

michael

Community Consensus

Minecraft 14w10c, Minecraft 14w11b, Minecraft 14w19a, Minecraft 14w20b

Retrieved