#leaderboards
1 messages · Page 1 of 1 (latest)
The sorted indices expression returns a new list of indices sorted by the value of the index. This can be very helpful for making all sorts of leaderboards. Lets say we have the balances of our players saved in the variable {balance::%player's uuid%}. To create our leaderboard we can use
set {_sorted::*} to sorted indices of {balance::*} in descending order
{_sorted::*} will be a list of uuids with {_sorted::1} being the person with the most money. If we wanted to check how much money they had we could plug the uuid back into the original variable: {balance::%{_sorted::1}%}
Leaderboard Example
command /baltop:
trigger:
set {_sorted::*} to sorted indices of {balance::*} in descending order
send "<aqua>Baltop"
loop first 10 elements of {_sorted::*}:
send "<gold>%loop-iteration%. <white>%offlineplayer(loop-value)% <gray>- <green>$%{balance::%loop-value%}%"```
A okay