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 our 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.

Saving Player Information

Discussion in 'Skript' started by wesnoah3, Oct 23, 2019.

  1. wesnoah3

    wesnoah3 Well-Known Member

    Joined:
    Aug 18, 2017
    Messages:
    65
    Likes Received:
    3
    Hi all, I'm currently trying to save player information such as their experience in different categories (fire, earth, etc) but I feel as though my current method is inefficient.
    https://pastebin.com/7ZSFTiJB
    Is there a more efficient way of saving this type of information?
    Thanks
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Seems alright, but I would suggest using list variables, ex:
    Code (Skript):
    1. set {savedInfo::%player%::fireXP} to 10
    2. set {savedInfo::%player%::earthXP} to 20
    this way, you can easily clear the players saved info if need be, like:
    Code (Skript):
    1. delete {savedInfo::%player%:*}
    and it will delete all of the player's saved info
     
  3. wesnoah3

    wesnoah3 Well-Known Member

    Joined:
    Aug 18, 2017
    Messages:
    65
    Likes Received:
    3
    Great thanks! One question, why do you use a double colon between savedInfo and %player% instead of a period?
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    the double colon indicates a list variable, these are preferred over regular variables for various reasons, including quick deletion of entires lists, as well as looping.
     
  5. wesnoah3

    wesnoah3 Well-Known Member

    Joined:
    Aug 18, 2017
    Messages:
    65
    Likes Received:
    3
    Wouldn't the double colon between %player% and fireXP be sufficient? Or should every period become a double colon?
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,106
    Likes Received:
    150
    Do whatever you want. I told you why I use double colons throughout, but if you want to use a period, and restrict yourself with how you can use your variables down the road thats up to you!
     
  7. wesnoah3

    wesnoah3 Well-Known Member

    Joined:
    Aug 18, 2017
    Messages:
    65
    Likes Received:
    3
    Sorry if I came out hostile, that wasn't my intention at all. I just noticed it seemed to still define as a list variable with only a double colon at the end and found a period for myself more readable. Thank you for the help.
     
Loading...