Solved Way to make skript more efficient

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

The77Gamer

Member
Aug 16, 2022
10
0
1
20
I have made this code to make a random string of letters however it is very laggy. I am wondering if there is a way to make it better.
Code:
command /genstring:
    permission: the77event.captcha
    trigger:
        set {id::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id1::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id2::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id3::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id4::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id5::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id6::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id7::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id8::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
        set {id9::*} to "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9"
 
        set {_gen} to random element out of {id::*}
        set {_gen1} to random element out of {id1::*}
        set {_gen2} to random element out of {id2::*}
        set {_gen3} to random element out of {id3::*}
        set {_gen4} to random element out of {id4::*}
        set {_gen5} to random element out of {id5::*}
        set {_gen6} to random element out of {id6::*}
        set {_gen7} to random element out of {id7::*}
        set {_gen8} to random element out of {id8::*}
        set {_gen9} to random element out of {id9::*}
        send "%{_gen}%%{_gen1}%%{_gen2}%%{_gen3}%%{_gen4}%%{_gen5}%%{_gen6}%%{_gen7}%%{_gen8}%%{_gen9}%"
        set {captchastring} to "%{_gen}%%{_gen1}%%{_gen2}%%{_gen3}%%{_gen4}%%{_gen5}%%{_gen6}%%{_gen7}%%{_gen8}%%{_gen9}%"
        delete {id::*}
        delete {id1::*}
        delete {id2::*}
        delete {id3::*}
        delete {id4::*}
        delete {id5::*}
        delete {id6::*}
        delete {id7::*}
        delete {id8::*}
        delete {id9::*}
 
If problem of lags is parse time , use this
Code:
set {_chars::*} to "QWERTYUIOPASDFGHJKLZXVBNM0123456789" split at ""
set {_captcha} to random element of {_chars::*}
loop 9 times:
  set {_captcha} to "%{_captcha}%%random element of {_chars::*}%"
 
Status
Not open for further replies.