#Sorting list of variables
1 messages · Page 1 of 1 (latest)
x8ight suggests that you read this embed
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```vb
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}%}`
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%}%"```
loop {%{_leaderboard}%::*}:
if {%{_leaderboard}%::%loop-value%} > 0:
is the this proper syntax for this part {%{_leaderboard}%::%loop-value%}