#Gui Leaderboards

1 messages · Page 1 of 1 (latest)

round saddle
#

we arent here to send you code

#

you need to make it yourself, we just explain errors you might need help with

river mesa
round saddle
#

well, you'd need your stats, to start

#

are you tracking whatever this leaderboard stat is (kills, balance, etc)?

river mesa
#

{test::%uuid of player%}

river mesa
#

all it is it has to be top 10 gui leaderboard

round saddle
#

okay, so then you'd likely want to make a list of this variable thats sorted

woeful lagoonBOT
#

x8ight suggests that you read this embed

Sorted Indices

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}%}`

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%}%"```
river mesa
#

hmm

#

so thats like not as gui

#

so i understand how that owrk

#

bc thats like more easie

#

bc you cna like send the message but in gui you have to loop all at once

#

and set

#

theres error here

#

loop first 10 elements of {_sorted::*}:

#

it cant understand

round saddle
#

can I see the code

river mesa
#

command /baltop:
trigger:
set {_sorted::} to sorted indices of {balance::} in descending order
send "<aqua>Baltop"
loop first 10 elements out of {_sorted::*}:
send "<gold>%loop-iteration%. <white>%offlineplayer(loop-value)% <gray>- <green>$%{balance::%loop-value%}%"