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!

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

Skript player data system whiteout addons ?

Discussion in 'Tutorials' started by Mich, Sep 28, 2020.

  1. Mich

    Mich Active Member

    Jul 15, 2020
    Likes Received:
    i think figuring out a way to save variables by removing them from server ram. I want to share this with everyone since in version 1.14 to 1.16 there is no script yml. This is about saving the server variables in the lore of an object, deleting them and when joining, passing them back from the object to a variable.but honestly i don't know if this really helps the ram or not but i think i could be right let me know.

    Unloading PlayerData into a piece of paper:
    Code (Text):
    1. function savedata(p: player):
    2.     set {_item} to paper
    3.     set line 1 of lore of {_item} to "%{money::%{_p}%}%"
    4.     set line 2 of lore of {_item} to "%{example_string::%{_p}%}%"
    5.     set slot 0 of {_p}'s inventory to {_item}
    6. function deletedata(p: player):
    7.     delete {money::%{_p}%}
    8.     delete {example_string::%{_p}%}
    9. on disconnecting:
    10.     savedata(player)
    11.     wait 1 second
    12.     deletedata(player)
    Loading PlayerData into variables again:

    Code (Text):
    1. function loaddata(p: player):
    2.     if {_p} has a piece of paper:
    3.         set {_lore1} to line 1 of lore of tool of {_p}
    4.         set {_lore2} to line 2 of lore of tool of {_p}
    5.         set {money::%{_p}%} to {_lore1} parsed as integer
    6.         set {example_string::%{_p}%} to "%{_lore2}%"
    7.         set slot 0 of {_p}'s inventory to air
    8. on join:
    9.     loaddata(player)
    Test commands:

    Code (Text):
    1. #test commands
    2. command /test:
    3.     trigger:
    4.         set {money::%player%} to 10
    5.         set {example_string::%player%} to "hello"
    6. command /variables:
    7.     trigger:
    8.         message "%{money::%player%}%"
    9.         message "%{example_string::%player%}%"
    10. command /load:
    11.     trigger:
    12.         loaddata(player)
    13. command /save:
    14.     trigger:
    15.         savedata(player)
    16. command /delete:
    17.     trigger:
    18.         deletedata(player)
    hope this can be a temporary alternative until skript yml is updated

  2. Govindas

    Govindas Active Member

    Feb 5, 2017
    Likes Received:
    what's wrong with skript-yaml? it works in 1.16.3 very well for me
  3. Runakai

    Moderator Supporter

    Apr 27, 2018
    Likes Received:
    Skript yaml is by far the best add-on ever
  4. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
    I have used Skript-yaml on every version since I started using Skript back in 1.12.2.
    It has worked on every single version.

    Skript-yaml is not version dependant.

    While your idea is a very interesting and unique way of storing data, its also not a good idea. You are reserving slot 0 of the player, what happens if their inventory is full when they log out?

    On top of that, in your code:
    Code (Text):
    1. set {_lore1} to line 1 of lore of tool of {_p}
    2.         set {_lore2} to line 2 of lore of tool of {_p}
    3.         set {money::%{_p}%} to {_lore1} parsed as integer
    4.         set {example_string::%{_p}%} to "%{_lore2}%"
    5.         set slot 0 of {_p}'s inventory to air
    you're getting lore of player's tool, but then setting slot 0 to air??? What if they logout/login with a different hotbar slot selected?
    You're just going to screw up their inventory.

Share This Page