Most numerous thing in a variable

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

Goetheus

Hi everybody!

Still meeeeee! :emoji_grinning:
There is an aliase or something to get the highest iteration in a variable?

E.g. I have 5 words in a variable: "hey", "test", "a word", "test", "test"
How can I know that "test" is the most numerous?

Thank you for help!
Kiss <3
 
I'm sure there is a easier way, but this should work

code_language.skript:
loop {words::*}:
    add 1 to {_countwords::%loop-value%}
    set {_} to 0
loop {_countwords::*}:
    loop-value > {_}
    set {_mostnumerous} to loop-index
send "%{_mostnumerous}%"
 
Thank you for your answer!
But I don't understand your code, and it doesn't work ^^'

Why "set {_} to 0" and "loop-value > {_}" ?
 
Last edited by a moderator:
Status
Not open for further replies.