How to create a balance top

  • 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 community!

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

KroterPvP

Active Member
Apr 10, 2017
178
7
18
Hello,

I want to create a balance top to display the player who has more money in a top list.
I've done a total balance counter:
code_language.skript:
set {_seco.bal::global-bal} to size of {seco.bal::*}
send "Total server balance: %{_seco.bal::global-bal}% $"
Now I need a player balance top like Essentials economy baltop.
 
Use RandomSK: http://skunity.com/search?search=sorting

code_language.skript:
set {_temp::*} to {seco.bal::*} sorted from highest to lowest with output "@index::;@value"
loop {_temp::*}:
    add 1 to {_}
    if {_} > 15:
        exit loop
    set {_x::*} to loop-value split at "::;"
    send "%{_x::1}%: %{_x::2}%€"
 
Use RandomSK: http://skunity.com/search?search=sorting

code_language.skript:
set {_temp::*} to {seco.bal::*} sorted from highest to lowest with output "@index::;@value"
loop {_temp::*}:
    add 1 to {_}
    if {_} > 15:
        exit loop
    set {_x::*} to loop-value split at "::;"
    send "%{_x::1}%: %{_x::2}%€"
I have this error:
code_language.skript:
[23:59:24 ERROR]: '::*} sorted from highest to lowest with output "@index::@value"' is not a valid item data (SuperEconomy.sk, line 36: set {_temp::*} to {seco.bal::*} sorted from highest to lowest with output "@index::@value"')
Thanks a lot :emoji_slight_smile:
[doublepost=1495231684,1495230458][/doublepost]I'm trying using this code to try if it runs and I recive this error:
code_language.skript:
An international error has ocurred message in chat

And this error in console:

[00:05:04 INFO]: [Skript] Encountered 1 error while reloading the config and all scripts!
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! [Skript] Severe Error:
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! If you're developing an add-on for Skript this likely means that you have done something wrong.
[00:05:08 ERROR]: #!#! If you're a server admin however please go to https://github.com/bensku/Skript/issues/
[00:05:08 ERROR]: #!#! and check whether this error has already been reported.
[00:05:08 ERROR]: #!#! If not please create a new ticket with a meaningful title, copy & paste this whole error into it (or use paste service),
[00:05:08 ERROR]: #!#! and describe what you did before it happened and/or what you think caused the error.
[00:05:08 ERROR]: #!#! If you think that it's a trigger that's causing the error please post the trigger as well.
[00:05:08 ERROR]: #!#! By following this guide fixing the error should be easy and done fast.
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! Stack trace:
[00:05:08 ERROR]: #!#! ch.njol.skript.SkriptAPIException: UnparsedLiterals must be converted before use
[00:05:08 ERROR]: #!#!     at ch.njol.skript.lang.UnparsedLiteral.invalidAccessException(UnparsedLiteral.java:273)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.lang.UnparsedLiteral.getAll(UnparsedLiteral.java:283)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.expressions.ExprSortedList.get(ExprSortedList.java:67)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.lang.util.SimpleExpression.getArray(SimpleExpression.java:103)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.effects.EffChange.execute(EffChange.java:268)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.lang.Effect.run(Effect.java:52)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:220)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:182)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:268)
[00:05:08 ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:163)
[00:05:08 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[00:05:08 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[00:05:08 ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[00:05:08 ERROR]: #!#!     at java.lang.reflect.Method.invoke(Unknown Source)
[00:05:08 ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306)
[00:05:08 ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[00:05:08 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502)
[00:05:08 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1154)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13)
[00:05:08 ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[00:05:08 ERROR]: #!#!     at java.util.concurrent.FutureTask.run(Unknown Source)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654)
[00:05:08 ERROR]: #!#!     at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557)
[00:05:08 ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! Version Information:
[00:05:08 ERROR]: #!#!   Skript: 2.2-dev27
[00:05:08 ERROR]: #!#!   Bukkit: 1.8.8-R0.1-SNAPSHOT
[00:05:08 ERROR]: #!#!   Minecraft: 1.8.8
[00:05:08 ERROR]: #!#!   Java: 1.8.0_131 (Java HotSpot(TM) 64-Bit Server VM 25.131-b11)
[00:05:08 ERROR]: #!#!   OS: Windows 10 amd64 10.0
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! Running CraftBukkit: false
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! Current node: null
[00:05:08 ERROR]: #!#! Current item: set {_toplist::*}(as java.lang.Object) to sorted list
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! Thread: Server thread
[00:05:08 ERROR]: #!#!
[00:05:08 ERROR]: #!#! End of Error.
[00:05:08 ERROR]: #!#!
code_language.skript:
command /toplist:
    trigger:
        set {kills::1} to 10
        set {kills::2} to 5
        set {kills::3} to 2
        set {_toplist::*} to sorted {kills::*} from highest to lowest with output "@index has killed a total of @value"
        message "Top Kills:"
        loop {_toplist::*}:
            message "%loop-index%: %loop-value%"
 
Last edited by a moderator:
RandomSK Sorting doesn't work in 1.8.8.

You could try to edit CrisisLP's sorting code:

code_language.skript:
command /ranking:
    trigger:
        loop {Kills::*}:
            add 1 to {_size}
            if {_low.to.high.list::%loop-value%} is not set:
                set {_low.to.high.list::%loop-value%} to loop-index
            else:
                set {_n} to 0
                loop {_size} times:
                    set {_n} to {_n}+1
                    {_low.to.high.list::%loop-value-1%.%{_n}%} is not set
                    set {_low.to.high.list::%loop-value-1%.%{_n}%} to loop-index
                    stop loop
        wait 1 tick
        set {_n} to size of {_low.to.high.list::*}
        loop {_low.to.high.list::*}:
            set {_high.to.low.list::%{_n}%} to loop-value
            set {_n} to {_n}-1
        wait 1 tick
        set {_i} to 0
#THIS IS THE MESSAGE WITH TOP KILLS
        send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
        loop {_high.to.low.list::*}:
            add 1 to {_topnumber}
            set {_player} to "%loop-value%" parsed as offlineplayer
            send "&7%{_topnumber}% - &c%{_player}% &8» &7%{Kills::%loop-value%}% Kills"
            add 1 to {_i}
            if {_topnumber} > 10: #this is top 10 you can change it
                stop
        send "&7&m------------------------------"
(from https://forums.skunity.com/threads/how-to-sort-things-in-list-variables.3664/)
 
Status
Not open for further replies.