Solved Random ID's generator

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

Wolwer

Active Member
Feb 8, 2018
53
5
8
Hi!
I need to create a random ID's (numbers with letters value) generator.

Smith like:
Code:
set {_id} to "%random integer between 111111 and ZZZZZZ%"

Please, help. <3
 
With Skript? I'm not sure, MD5 a string and cut characters
Hrm, I watched a thread on spigot and saw interesting skript:
https://www.spigotmc.org/threads/skript-help-w-random-chars-letters.319994/

Maybe we should create a list with chars and than randomize them. For example:
Code:
command /abcd:
    trigger:
        set {id::*} to "A", "E", "Z", "O", "F", "P" and "L"
        set {id1::*} to "A", "E", "Z", "O", "F", "P" and "L"
        set {id2::*} to "A", "E", "Z", "O", "F", "P" and "L"

      
command /genabcd:
    trigger:
        set {_gen} to random element out of {id::*}
        set {_gen1} to random element out of {id1::*}
        set {_gen2} to random element out of {id2::*}
        send "%{_gen}%%{_gen1}%%{_gen2}%"
It will generate 3 random chars from all objecrs list.
 
Creating multiple variables and allocating them in memory (not static afaik) leads to performance issues.
Ok, so if I will create those variables, than use it and after will remove them, will I get performance issues?
Code:
command /genabcd:
    trigger:
        set {id::*} to "A", "E", "Z", "O", "F", "P" and "L"
        set {id1::*} to "A", "E", "Z", "O", "F", "P" and "L"
        set {id2::*} to "A", "E", "Z", "O", "F", "P" and "L"
        set {_gen} to random element out of {id::*}
        set {_gen1} to random element out of {id1::*}
        set {_gen2} to random element out of {id2::*}
        send "%{_gen}%%{_gen1}%%{_gen2}%"
        delete {id::*}
        delete {id1::*}
        delete {id2::*}
 
Can you not directly print the random element on the string? Also I have no idea on how they delete the variables from memory.
Omg I used really SO many variables in memory, but the performance of my server isn't going down. I think, the performance issue isn't a big problem. Anyway, this code should work. Thank you for your reply.
 
Status
Not open for further replies.