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 Stylish scoreboards 50mb

Discussion in 'Skript' started by Adrihun, May 10, 2017.

Thread Status:
Not open for further replies.
  1. Adrihun

    Adrihun Member

    Joined:
    Feb 1, 2017
    Messages:
    368
    Likes Received:
    6
    So I'm trying to make A scoreboard animation with skelett scoreboard.
    Code (Skript):
    1. on join:
    2.     player has permission "scoreboarddzz.use"
    3.     wait 1 second
    4.     while player is online:
    5.         set title of stylish scoreboard "test-%player%" to "&dLol"
    6.         if player is not online:
    7.             stop
    8.         wait 7 ticks
    9.         if player is not online:
    10.             stop
    11.         set title of stylish scoreboard "test-%player%" to "&aLol"
    12.         if player is not online:
    13.             stop
    14.         wait 7 ticks
    15.         if player is not online:
    16.             stop
    17.         set title of stylish scoreboard "test-%player%" to "&bLol"
    18.         if player is not online:
    19.             stop

    And i have a stylish scoreboard for each groups (and i have like 15 groups), I don't really want to copy & paste this whole code 15 times and change "test-" to "owner-" "admin-" etc... -- wouldn't that lag the server? Is there another way to do it? Like... set it for all people?

    @LimeGlass ? :emoji_slight_smile:
     
  2. LimeGlass

    VIP Supporter ++ Regular Diner Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    623
    Likes Received:
    439
    Medals:
    I have made a function API to make this even more simple, which I have shared with you before.

    Add these function anywhere:

    Code (Skript):
    1. function createBoard(p: player, t: text, size: integer = 15):
    2.     add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    3.     if stylish scoreboard "%{_t}%-%{_p}%" does not exist:
    4.         create new stylish scoreboard named "%{_t}%-%{_p}%"
    5.         loop {_size} times:
    6.             create a new id based score "%{_p}%Slot%loop-number%" with text "%{_d::%loop-number%}%" slot loop-number for stylish scoreboard "%{_t}%-%{_p}%"
    7. function deleteBoard(p: player, t: text):
    8.     loop 15 times:
    9.         delete the id based score "%{_p}%Slot%loop-number%" in stylish scoreboard "%{_t}%-%{_p}%"
    10.     delete stylish scoreboard "%{_t}%-%{_p}%"
    11. function setSlot(p: player, board: text, slot: integer, t: text):
    12.     add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    13.     if {_slot} is between 1 and 15:
    14.         set text of id "%{_p}%Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_t}%"
    Then here is your spoon fed coding:
    Code (Skript):
    1. function updateBoard(p: player):
    2.     setSlot({_p}, "Test", 1, "&c&lThis is slot 1")
    3.     setSlot({_p}, "Test", 15, "&c&lThis is slot 15")
    4.     setSlot({_p}, "Test", 5, "&c&lThis is slot 5")
    5. on join:
    6.     player has permission "scoreboarddzz.use"
    7.     createBoard(player, "Test", 15) #Creates a board with 15 slots named "Test"
    8.     set title of stylish scoreboard "Test-%player%" to "&dLol"
    9.     set stylish scoreboard of player to "Test-%player%"
    10.     while player is online:
    11.         updateBoard(player)
    12.         wait a second
    13. on quit:
    14.     deleteBoard(player)
    Hope this helps
     
    #2 LimeGlass, May 10, 2017
    Last edited: May 10, 2017
    L0v0lup likes this.
  3. Adrihun

    Adrihun Member

    Joined:
    Feb 1, 2017
    Messages:
    368
    Likes Received:
    6
    @LimeGlass I still need help. Is there a way to do it like i did but to all groups?
    like, can you add something like "set title of stylish scoreboard of all groups to "&aTest" to your plugin?
    It would be really useful.
     
  4. LimeGlass

    VIP Supporter ++ Regular Diner Addon Developer

    Joined:
    Jan 24, 2017
    Messages:
    623
    Likes Received:
    439
    Medals:
    Just don't make it specified towards a player then.

    Example:

    Code (Skript):
    1. function createBoard(t: text, size: integer = 15):
    2.     add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    3.     if stylish scoreboard "%{_t}%" does not exist:
    4.         create new stylish scoreboard named "%{_t}%"
    5.         loop {_size} times:
    6.             create a new id based score "Slot%loop-number%" with text "%{_d::%loop-number%}%" slot loop-number for stylish scoreboard "%{_t}%"
    7. function deleteBoard(t: text):  
    8.     loop 15 times:
    9.         delete the id based score "Slot%loop-number%" in stylish scoreboard "%{_t}%"
    10.     delete stylish scoreboard "%{_t}%"
    11. function setSlot(board: text, slot: integer, t: text):
    12.     add "&a", "&b", "&c", "&d", "&e", "&1", "&2", "&3", "&4", "&5", "&6", "&7", "&8", "&9" and "&f" to {_d::*}
    13.     if {_slot} is between 1 and 15:
    14.         set text of id "Slot%{_slot}%" to "%{_d::%{_slot}%}%%{_t}%"
    15. function updateBoard(empty: boolean = true):
    16.     setSlot("Test", 1, "&c&lThis is slot 1")
    17.     setSlot("Test", 15, "&c&lThis is slot 15")
    18.     setSlot("Test", 5, "&c&lThis is slot 5")
    19.     set title of stylish scoreboard "Test" to "&dLol"
    20. on script load:
    21.     createBoard(player, "Test", 15) #Creates a board with 15 slots named "Test"
    22. on script unload:
    23.     deleteBoard("Test")
    24. on join:
    25.     player has permission "scoreboarddzz.use"
    26.     set stylish scoreboard of player to "Test-%player%"
    27. every second:
    28.     updateBoard(player)
     
  5. Adrihun

    Adrihun Member

    Joined:
    Feb 1, 2017
    Messages:
    368
    Likes Received:
    6
    @LimeGlass But i stil have to give it to the groups on the server so say i got 3 players who have Rank Premium and 2 players who are owners i still have to copy & paste the script twice, and it will slow down the server pefromance...
     
  6. BrettPlayMC

    Supporter

    Joined:
    Jan 26, 2017
    Messages:
    715
    Likes Received:
    53
    Just a question, what is the difference between a stylish and normal scoreboard?
    READ THE WIKI!
     
  7. Adrihun

    Adrihun Member

    Joined:
    Feb 1, 2017
    Messages:
    368
    Likes Received:
    6
    @BrettPlayMC I did read the wiki also the normal skrayfall scoreboards don't work, they are buggy and they give errors, the dev needs to fix it ffs! Skelett (stylish) scoreboards are more complicated but no errors.

    @LimeGlass Your code is complicated and i don't understand it, can you try doing it like i did ? https://hastebin.com/ahajezozul.sql
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    The way you did it is really bad and really non-performant. If you don't want a 50mb script, you need to use functions and loops to reduce repetitive code. You either need to take the time to learn how the code that's being given to you works or stop asking for help, because nobody is going to intentionally write code that looks like that for you because it's really poorly done and is the exact opposite of what you should want if you want your code optimized.
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    50Mb Script - i can't even imagine how that code has been written.
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    The old saying also goes, "You live and you learn". The OP is living but not learning.
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    [​IMG]
    Then maybe you should read through it until you understand it
     
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    @Pikachu They don't work, I tried to contact the Dev but no response.
    --- Double Post Merged, May 12, 2017, Original Post Date: May 12, 2017 ---
    @ImOfflinezzz Well if i would copy & paste the animation code 20 times it would probably be 50MB
    thats why i want this new thing in @LimeGlass 's Plugin but he won't add it. Like it would be good if you could just set everyones stylish scoreboard title with 1 line of code.
    example: "set title of all stylish scoreboards to "&btest" "
    @Mr_Simba The way i did it? What the animation code? There is no other way to do it. I would rather use this then "every 2 seconds"
    @BrettPlayMC lol
     
  13. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    If you want something simpler than this 15 line function code. You can look at my simple scoreboard script https://forums.skunity.com/resources/simpleboard.159/

    It allows you to configure and adjust everything in a yaml that is easy to understand. Even a 8 year old could understand.
     
  14. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Yes I get that but this Post is about fixing animated scoreboards not how to make easy skelett scoreboards.

    You should add this to skelett:
    "set title of all stylish scoreboards to "&btest" "

    Or is it hard to do in java?
    --- Double Post Merged, May 13, 2017, Original Post Date: May 12, 2017 ---
    @LimeGlass Come on man.. just add it it will be useful
     
  15. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Do you even know what a 50 MB skript file is?
    My whole mimigame only has 0.07 MB and has over 2500 lines.
    And there is no need to fix animated scoreboards.
    There are good how they are at the moment.
    LimeGlass send you to skripts where you can do animated scoreboards in a short version.
     
    Adrihun likes this.
  16. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Stop asking him to add this... If you really want it, it's not hard to make yourself.
     
  17. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    @Pikachu
    Are you dumb?
    I don't have the src
     
  18. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Well, you could have the source. Skellett has a Github repo, and nothing stops you from using something like JD-GUI. Anyway, I was talking about a skript based solution
     
  19. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    If you can't use this scoreboard, find any scoreboard in java with Skript support or PlaceHolders support and use it.

    - Sorry for my english.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...