Skript player data system whiteout addons ?

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

Mich

Active Member
Jul 15, 2020
148
6
18
23
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:
function savedata(p: player):
    set {_item} to paper
    set line 1 of lore of {_item} to "%{money::%{_p}%}%"
    set line 2 of lore of {_item} to "%{example_string::%{_p}%}%"
    set slot 0 of {_p}'s inventory to {_item}
function deletedata(p: player):
    delete {money::%{_p}%}
    delete {example_string::%{_p}%}
on disconnecting:
    savedata(player)
    wait 1 second
    deletedata(player)

Loading PlayerData into variables again:

Code:
function loaddata(p: player):
    if {_p} has a piece of paper:
        set {_lore1} to line 1 of lore of tool of {_p}
        set {_lore2} to line 2 of lore of tool of {_p}
        set {money::%{_p}%} to {_lore1} parsed as integer
        set {example_string::%{_p}%} to "%{_lore2}%"
        set slot 0 of {_p}'s inventory to air
on join:
    loaddata(player)

Test commands:

Code:
#test commands
command /test:
    trigger:
        set {money::%player%} to 10
        set {example_string::%player%} to "hello"
command /variables:
    trigger:
        message "%{money::%player%}%"
        message "%{example_string::%player%}%"
command /load:
    trigger:
        loaddata(player)
command /save:
    trigger:
        savedata(player)
command /delete:
    trigger:
        deletedata(player)

hope this can be a temporary alternative until skript yml is updated


 
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:
set {_lore1} to line 1 of lore of tool of {_p}
        set {_lore2} to line 2 of lore of tool of {_p}
        set {money::%{_p}%} to {_lore1} parsed as integer
        set {example_string::%{_p}%} to "%{_lore2}%"
        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.