Solved Server crashes when I reload

  • 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.
Skript Version: 2.4
Minecraft Version: 1.15.2

So I've been trying to make a skript which tests for lore within every slot of their hotbar and their chest. But for some reason when I reload the skript my server will crash.

Script Code : https://hastebin.com/liyubefofi.sql
Crash Report : https://hastebin.com/vihaxifiju.php
Crash Logs : https://hastebin.com/fozutujimo.md

Reply to this thread if you have a suggestion/idea/solution,
Thanks!

This purely just happens because u ask for alot of resource heavy calls. This code is way to inefficiënt can u briefly explain what u want it to do?
 
This purely just happens because u ask for alot of resource heavy calls. This code is way to inefficiënt can u briefly explain what u want it to do?
Ok so basically there's a lore in all weapons/armor. (Rating » [number]) I'm trying to make it so it finds the highest rated item in the players hotbar and adds that rating with the rating of the player's chestplate.

I believe this system will work but I do agree it is really heavy
 
Ok so basically there's a lore in all weapons/armor. (Rating » [number]) I'm trying to make it so it finds the highest rated item in the players hotbar and adds that rating with the rating of the player's chestplate.

I believe this system will work but I do agree it is really heavy
Code:
function getRating(p: player) :: number:
    set {_i} to 0
    set {_c} to 0
    loop 10 times:
        if loop-number is not 10:
            set {_s} to slot (loop-number - 1) of {_p}
        else:
            set {_s} to {_p}'s chestplate
        if "%lore of {_s}%" contains "Rating":
            loop lore of {_s}:
                if loop-value-2 contains "Rating":
                    set {_l::*} to loop-value-2 split at "» &e"
                    if loop-number is not 10:
                        add {_l::2} parsed as a number to {_a::*}
                    else:
                        set {_c} to {_l::2} parsed as a number
    set {_s} to size of {_a::*}
    if {_s} > 1:
        set {_a::*} to sorted {_a::*}
        set {_i} to {_a::%{_s}%}
    else:
        set {_i} to {_a::1}
    set {_i} to {_c} + {_i}
    return {_i}

command /getRating:
    trigger:
        set {_i} to getRating(player)
        send "%{_i}%"
 
Code:
function getRating(p: player) :: number:
    set {_i} to 0
    set {_c} to 0
    loop 10 times:
        if loop-number is not 10:
            set {_s} to slot (loop-number - 1) of {_p}
        else:
            set {_s} to {_p}'s chestplate
        if "%lore of {_s}%" contains "Rating":
            loop lore of {_s}:
                if loop-value-2 contains "Rating":
                    set {_l::*} to loop-value-2 split at "» &e"
                    if loop-number is not 10:
                        add {_l::2} parsed as a number to {_a::*}
                    else:
                        set {_c} to {_l::2} parsed as a number
    set {_s} to size of {_a::*}
    if {_s} > 1:
        set {_a::*} to sorted {_a::*}
        set {_i} to {_a::%{_s}%}
    else:
        set {_i} to {_a::1}
    set {_i} to {_c} + {_i}
    return {_i}

command /getRating:
    trigger:
        set {_i} to getRating(player)
        send "%{_i}%"
upload_2020-3-12_16-30-15.png


There's an error (btw I really appreciate this <3)
 
Code:
function getRating(p: player) :: number:
    set {_i} to 0
    set {_c} to 0
    loop 10 times:
        if loop-number is not 10:
            set {_s} to slot (loop-number - 1) of {_p}
        else:
            set {_s} to {_p}'s chestplate
        if lore of {_s} contains "Rating":
            set {_l::*} to lore of {_s} split at "||"
            loop {_l::*}:
                if loop-value-2 contains "Rating":
                    set {_l::*} to loop-value-2 split at "» &e"
                    if loop-number is not 10:
                        add {_l::2} parsed as a number to {_a::*}
                    else:
                        set {_c} to {_l::2} parsed as a number
    set {_s} to size of {_a::*}
    if {_s} > 1:
        set {_a::*} to sorted {_a::*}
        set {_i} to {_a::%{_s}%}
    else:
        set {_i} to {_a::1}
    set {_i} to {_c} + {_i}
    return {_i}
 
command /getRating:
    trigger:
        set {_i} to getRating(player)
        send "%{_i}%"
 
Code:
function getRating(p: player) :: number:
    set {_i} to 0
    set {_c} to 0
    loop 10 times:
        if loop-number is not 10:
            set {_s} to slot (loop-number - 1) of {_p}
        else:
            set {_s} to {_p}'s chestplate
        if lore of {_s} contains "Rating":
            set {_l::*} to lore of {_s} split at "||"
            loop {_l::*}:
                if loop-value-2 contains "Rating":
                    set {_l::*} to loop-value-2 split at "» &e"
                    if loop-number is not 10:
                        add {_l::2} parsed as a number to {_a::*}
                    else:
                        set {_c} to {_l::2} parsed as a number
    set {_s} to size of {_a::*}
    if {_s} > 1:
        set {_a::*} to sorted {_a::*}
        set {_i} to {_a::%{_s}%}
    else:
        set {_i} to {_a::1}
    set {_i} to {_c} + {_i}
    return {_i}
 
command /getRating:
    trigger:
        set {_i} to getRating(player)
        send "%{_i}%"

Awesome, works like a charm.
Thanks man <3
 
  • Like
Reactions: Lego_freak1999
Status
Not open for further replies.