5 Star Rating System + Top List (Like Amazon's Star Rating)

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

DarkKingMW

Member
Jun 22, 2018
11
0
1
Germany
Category: Rating, Toplist

Suggested name: 5 Star Rating System + Top List (Like Amazon's Star Rating)

What I want:

I would like to have a function where you have a 5 star rating system like the one at Amazon and a function where you can get the top ratings from it, unfortunately I have no idea how to do that and how the calculation of the top list works.

When I'd like it by: As long as needed for this
 

Attachments

  • opera_7NcxzvVkos.png
    opera_7NcxzvVkos.png
    19.6 KB · Views: 53
Category: Rating, Toplist

Suggested name: 5 Star Rating System + Top List (Like Amazon's Star Rating)

What I want:

I would like to have a function where you have a 5 star rating system like the one at Amazon and a function where you can get the top ratings from it, unfortunately I have no idea how to do that and how the calculation of the top list works.

When I'd like it by: As long as needed for this
While I couldn’t tell you exactly how to do this (I‘ve not made this kind of thing before), I do have an idea of where you could start. You should look into leaderboards. With list variables, you’re able to sort things like custom currencies using loops and such. If you can figure out the workings of code like that, a rating system should be a breeze.
 
i know leaderboards i use
Code:
function sort(indices: strings, values: numbers, descending: boolean = true) :: strings:
    loop {_indices::*}:
        set {_sort::%{_values::%loop-index%}%.%loop-index%} to loop-value
    return (reversed {_sort::*}) if {_descending} is true, else {_sort::*}
this in my skripts for Toplist but idk how i can make it with a 5 Star Rating Algorithm
 
Like what, a gui? or does it send the list and everything to you? I need a better description or an example or something.
 
I use a command like this from my economy skript
Code:
command /economy [<text>] [<text>]:
    permission: *
    trigger:
        if arg-1 is "top":
            set {_sorted::*} to sort((indices of {coins::*}), {coins::*})
            set {_a} to (arg-2 parsed as integer) if (arg-2 is set), else 10
            send "%{Prefix::Server}% &7Load Top &e&o%{_a}% &7Money Account's&8..."
            send "&8&l&m»---------------«&r &c&lTOP %{_a}% &8&l&m»---------------«%nl%"
            loop {_a} times:
                send "&8   ∙ &7Place &6%loop-value%&8: &e%({_sorted::%loop-value%} parsed as offlineplayer) ? "No Player"%&8: &b%{coins::%{_sorted::%loop-value%}%}%$"
            send "%nl%&8&l&m»---------------«&r &c&lTOP %{_a}% &8&l&m»---------------«"
but dont know how it works for the 5 Star Algorithm for a Top 5 List