Mojira Archive
MC-139133

Calculations failing

Marked as private because I put a lot of work into this.

# Calculate % of players sleeping (Var3)
scoreboard players operation Place_Holder Var3 = Place_Holder Sleeping
execute as Stuperfied at @s if score Place_Holder SleepTimer >= 1 Constant run tellraw @a {"text":"Sleeping: ","extra":[{"score":{"name":"Place_Holder","objective":"Var3"}}]}
scoreboard players operation Place_Holder Var3 /= Place_Holder PlayerCount
scoreboard players operation Place_Holder Var3 *= 100 Constant
execute as Stuperfied at @s if score Place_Holder SleepTimer >= 1 Constant run tellraw @a {"text":"% Sleeping: ","extra":[{"score":{"name":"Place_Holder","objective":"Var3"}}]}

In the code above you can ignore the tellraw stuff as its just for troubleshooting. SleepTimer is only use to ensure that tellraw only runs when its night time and someone is sleeping, otherwise i'd just get spammed constantly.

Im still developing this code but I have noticed that with 2 players online, the calculated percentage equates to 0% when it should be 50%. Im tired so maybe I made a mistake but I thought it was worth posting because ive seen conflicting results.

Invalid

Michael Hurt

2018-11-09, 05:15 PM

2018-11-10, 06:47 AM

2018-11-09, 07:05 PM

0

1

Unconfirmed

Minecraft 18w45a

-