Sorting the wrong way.

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

  • 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.

Farid

Active Member
Feb 5, 2017
179
11
18
23
My code>

9f8abf10fb1a304514faa32cf0094062.png


My results >

92634a05621a154e52c36db712f02917.png


6b00b224a0898a759e7402b3f14fe339.png


2fb4b9513ece0cc3c550228d2759236b.png

[doublepost=1493688856,1493572501][/doublepost]BUMP,

Basically I'm trying to make a top kills from yml files, not saved variables. but the sorting is wrong. If anyone could help that would be great!


Thanks,
 
I don't think RandomSK sorting works very well anymore (not 100% sure). Try using Bensku's one
```
set {_sorted::*} to sorted {var::*}
```
 
I got a console error.
usefull informantion...

Use this other methode

code_language.skript:
loop {kill::*}:#change here your variables.
            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
        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%{kill::%loop-value%}% Kills"
            add 1 to {_i}
            if {_topnumber} > 9:
                stop
        send "&7&m------------------------------"
 
@ChisleLP

Here's my code

code_language.skript:
        else if arg-1 is "top":
            set {_guilds::*} to directory "AGDATABASE/guilds/"'s files
            send "&c&lCOLLECTING DATA..."
            loop {_guilds::*}:
                set {_guilds2::all::*} to "%loop-value%"
                replace "/home" with "" in {_guilds2::all::*}
                replace "/gs" with "" in {_guilds2::all::*}
                replace "/data" with "" in {_guilds2::all::*}
                replace "/servers" with "" in {_guilds2::all::*}
                replace "/5101781" with "" in {_guilds2::all::*}
                replace "/AGDATABASE/guilds/" with "" in {_guilds2::all::*}
                replace ".yml" with "" in {_guilds2::all::*}
                set {_guilds2::kills::*} to skutilities yml list "kills" from file "AGDATABASE/guilds/%{_guilds2::all::*}%.yml"   
                set {_Toplist::*} to sorted {_guilds2::kills::*} #with output "@index %{_guilds2::all::*}% -- %{_guilds2::kills::*}%"
                loop {_Toplist::*}:
                    add 1 to {_size}
                    if {_low.to.high.list::%loop-value-2%} is not set:
                        set {_low.to.high.list::%loop-value-2%} to loop-index-2
                    else:
                        set {_n} to 0
                        loop {_size} times:
                            set {_n} to {_n}+1
                            {_low.to.high.list::%loop-value-3%.%{_n}%} is not set
                            set {_low.to.high.list::%loop-value-3%.%{_n}%} to loop-index-2
                            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-2
                    set {_n} to {_n}-1
                wait 1 tick
                set {_i} to 0
                send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
                loop {_high.to.low.list::*}:
                    add 1 to {_topnumber}
                    set {_player} to "%loop-value-2%"
                    send "&7%{_topnumber}% - &c%{_player}% &8» &7%{kill::%loop-value-2%}% Kills"
                    add 1 to {_i}
                    if {_topnumber} > 9:
                        stop
                send "&7&m------------------------------"

Here's my results >

f2da001e6cd8c3244f3b7f7ecae549b9.png
 
@ChisleLP

Here's my code

code_language.skript:
        else if arg-1 is "top":
            set {_guilds::*} to directory "AGDATABASE/guilds/"'s files
            send "&c&lCOLLECTING DATA..."
            loop {_guilds::*}:
                set {_guilds} to "%loop-value%"
                replace "/home" with "" in {_guilds}
                replace "/gs" with "" in {_guilds}
                replace "/data" with "" in {_guilds}
                replace "/servers" with "" in {_guilds}
                replace "/5101781" with "" in {_guilds}
                replace "/AGDATABASE/guilds/" with "" in {_guilds}
                replace ".yml" with "" in {_guilds}
                set {_guilds2::kills::*} to skutilities yml list "kills" from file "AGDATABASE/guilds/%{_guilds2::all::*}%.yml"
                set {_Toplist::*} to sorted {_guilds2::kills::*} #with output "@index %{_guilds2::all::*}% -- %{_guilds2::kills::*}%"
            loop {_Toplist::*}:
                add 1 to {_size}
                if {_low.to.high.list::%loop-value-2%} is not set:
                    set {_low.to.high.list::%loop-value-2%} to loop-index-2
                else:
                    set {_n} to 0
                    loop {_size} times:
                        set {_n} to {_n}+1
                        {_low.to.high.list::%loop-value-3%.%{_n}%} is not set
                        set {_low.to.high.list::%loop-value-3%.%{_n}%} to loop-index-2
                        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-2
                    set {_n} to {_n}-1
                wait 1 tick
                set {_i} to 0
                send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
                loop {_high.to.low.list::*}:
                    add 1 to {_topnumber}
                    set {_player} to "%loop-value-2%"
                    send "&7%{_topnumber}% - &c%{_player}% &8» &7%{kill::%loop-value-2%}% Kills"
                    add 1 to {_i}
                    if {_topnumber} > 9:
                        stop
                send "&7&m------------------------------"

Here's my results >

f2da001e6cd8c3244f3b7f7ecae549b9.png
Uhm. little wirred... wait i will try...



code_language.skript:
else if arg-1 is "top":
            set {_guilds::*} to directory "AGDATABASE/guilds/"'s files
            send "&c&lCOLLECTING DATA..."
            loop {_guilds::*}:
                set {_Group} to "%loop-value%"
                replace "/home" with "" in {_Group}
                replace "/gs" with "" in {_Group}
                replace "/data" with "" in {_Group}
                replace "/servers" with "" in {_Group}
                replace "/5101781" with "" in {_Group}
                replace "/AGDATABASE/guilds/" with "" in {_Group}
                replace ".yml" with "" in {_Group}
                set {_GroupKills::%{_group}%} to skutilities yml list "kills" from file "AGDATABASE/guilds/%{_Group}%.yml"
           
            loop {_GroupKills::*}:
                add 1 to {_size}
                if {_low.to.high.list::%loop-value-2%} is not set:
                    set {_low.to.high.list::%loop-value-2%} to loop-index-2
                else:
                    set {_n} to 0
                    loop {_size} times
                        set {_n} to {_n}+1
                        {_low.to.high.list::%loop-value-3%.%{_n}%} is not set
                        set {_low.to.high.list::%loop-value-3%.%{_n}%} to loop-index-2
                        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-2
                set {_n} to {_n}-1
            wait 1 tick
            set {_i} to 0
            send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
            loop {_high.to.low.list::*}:
                add 1 to {_topnumber}
                set {_Group} to "%loop-value-2%"
                send "&7%{_topnumber}% - &c%{_player}% &8» &7%{_GroupKills::%loop-value-2%}% Kills"
                add 1 to {_i}
                if {_topnumber} > 9:
                    stop
            send "&7&m------------------------------"


this should works. i have renamed the variables. You don#t need list it... and you don#t need Sorted. :emoji_slight_smile:


##edit

sorry. forget to changed variables in replace
 
Uhm. little wirred... wait i will try...



code_language.skript:
else if arg-1 is "top":
            set {_guilds::*} to directory "AGDATABASE/guilds/"'s files
            send "&c&lCOLLECTING DATA..."
            loop {_guilds::*}:
                set {_Group} to "%loop-value%"
                replace "/home" with "" in {_Group}
                replace "/gs" with "" in {_Group}
                replace "/data" with "" in {_Group}
                replace "/servers" with "" in {_Group}
                replace "/5101781" with "" in {_Group}
                replace "/AGDATABASE/guilds/" with "" in {_Group}
                replace ".yml" with "" in {_Group}
                set {_GroupKills::%{_group}%} to skutilities yml list "kills" from file "AGDATABASE/guilds/%{_Group}%.yml"
         
            loop {_GroupKills::*}:
                add 1 to {_size}
                if {_low.to.high.list::%loop-value-2%} is not set:
                    set {_low.to.high.list::%loop-value-2%} to loop-index-2
                else:
                    set {_n} to 0
                    loop {_size} times
                        set {_n} to {_n}+1
                        {_low.to.high.list::%loop-value-3%.%{_n}%} is not set
                        set {_low.to.high.list::%loop-value-3%.%{_n}%} to loop-index-2
                        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-2
                set {_n} to {_n}-1
            wait 1 tick
            set {_i} to 0
            send "&7&m-----------&8< &6Top10 &8>&7&m-----------"
            loop {_high.to.low.list::*}:
                add 1 to {_topnumber}
                set {_Group} to "%loop-value-2%"
                send "&7%{_topnumber}% - &c%{_player}% &8» &7%{_GroupKills::%loop-value-2%}% Kills"
                add 1 to {_i}
                if {_topnumber} > 9:
                    stop
            send "&7&m------------------------------"


this should works. i have renamed the variables. You don#t need list it... and you don#t need Sorted. :emoji_slight_smile:


##edit

sorry. forget to changed variables in replace

d0a86ed2d9703c9df9e125c4c59a2fcc.png
 
well... wtf... this is the reason... uhmmm wait then do this


code_language.skript:
set {_Kills::*} to yaml list "kills" from file "AGDATABASE/guilds/%{_groups}%"
set {_GroupsKills::%{_Groups}%} to {_Kills::1}

I get no results

170a04b996ecb16beee614df20bba526.png


Add me on discord for futher help, I do not wish to spam the forums. Farid#1313
[doublepost=1494176860,1494174621][/doublepost]Solved. Thanks to @ChisleLP
 
Status
Not open for further replies.