1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Server crashes when I reload

Discussion in 'Skript' started by Harro, Mar 12, 2020.

Tags:
Thread Status:
Not open for further replies.
  1. Harro

    Harro Member

    Joined:
    Mar 12, 2020
    Messages:
    12
    Likes Received:
    1
    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!

     
  2. Best Answer:
    Post #8 by Lego_freak1999, Mar 12, 2020
  3. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    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?
     
  4. Harro

    Harro Member

    Joined:
    Mar 12, 2020
    Messages:
    12
    Likes Received:
    1
    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
     
  5. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Code (Text):
    1. function getRating(p: player) :: number:
    2.     set {_i} to 0
    3.     set {_c} to 0
    4.     loop 10 times:
    5.         if loop-number is not 10:
    6.             set {_s} to slot (loop-number - 1) of {_p}
    7.         else:
    8.             set {_s} to {_p}'s chestplate
    9.         if "%lore of {_s}%" contains "Rating":
    10.             loop lore of {_s}:
    11.                 if loop-value-2 contains "Rating":
    12.                     set {_l::*} to loop-value-2 split at "» &e"
    13.                     if loop-number is not 10:
    14.                         add {_l::2} parsed as a number to {_a::*}
    15.                     else:
    16.                         set {_c} to {_l::2} parsed as a number
    17.     set {_s} to size of {_a::*}
    18.     if {_s} > 1:
    19.         set {_a::*} to sorted {_a::*}
    20.         set {_i} to {_a::%{_s}%}
    21.     else:
    22.         set {_i} to {_a::1}
    23.     set {_i} to {_c} + {_i}
    24.     return {_i}
    25.  
    26. command /getRating:
    27.     trigger:
    28.         set {_i} to getRating(player)
    29.         send "%{_i}%"
     
  6. Harro

    Harro Member

    Joined:
    Mar 12, 2020
    Messages:
    12
    Likes Received:
    1
    upload_2020-3-12_16-30-15.png

    There's an error (btw I really appreciate this <3)
     
  7. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Wait whut can u do /ver skript
     
  8. Harro

    Harro Member

    Joined:
    Mar 12, 2020
    Messages:
    12
    Likes Received:
    1
    2.4.1-MH
     
  9. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    Code (Text):
    1. function getRating(p: player) :: number:
    2.     set {_i} to 0
    3.     set {_c} to 0
    4.     loop 10 times:
    5.         if loop-number is not 10:
    6.             set {_s} to slot (loop-number - 1) of {_p}
    7.         else:
    8.             set {_s} to {_p}'s chestplate
    9.         if lore of {_s} contains "Rating":
    10.             set {_l::*} to lore of {_s} split at "||"
    11.             loop {_l::*}:
    12.                 if loop-value-2 contains "Rating":
    13.                     set {_l::*} to loop-value-2 split at "» &e"
    14.                     if loop-number is not 10:
    15.                         add {_l::2} parsed as a number to {_a::*}
    16.                     else:
    17.                         set {_c} to {_l::2} parsed as a number
    18.     set {_s} to size of {_a::*}
    19.     if {_s} > 1:
    20.         set {_a::*} to sorted {_a::*}
    21.         set {_i} to {_a::%{_s}%}
    22.     else:
    23.         set {_i} to {_a::1}
    24.     set {_i} to {_c} + {_i}
    25.     return {_i}
    26.  
    27. command /getRating:
    28.     trigger:
    29.         set {_i} to getRating(player)
    30.         send "%{_i}%"
    31.  
     
  10. Harro

    Harro Member

    Joined:
    Mar 12, 2020
    Messages:
    12
    Likes Received:
    1
    Awesome, works like a charm.
    Thanks man <3
     
    Lego_freak1999 likes this.
  11. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    np
     
Thread Status:
Not open for further replies.

Share This Page

Loading...