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.

Help with variables

Discussion in 'Skript' started by AlfaLe0, Mar 3, 2018.

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

    AlfaLe0 Active Member

    Joined:
    Mar 2, 2018
    Messages:
    25
    Likes Received:
    0
    Which are the differences between {xp.%player%} and {xp::%player%} ? I don’t understand
     
  2. TPGamesNL

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,311
    Likes Received:
    73
    Medals:
    If you use {xp.%player%}, and for some reasons you want to delete all the xp variables, you need to have a offline player list, loop it and delete it for every player. If you use {xp::%player%}, and want to delete it, you can easily use
    Code (Skript):
    1. delete {xp::*}
    also {xp::%player%} can easily be called with {xp::*} if you want to get all of them.
    EDIT:
    The old Skript documentation says it as well:
    All you need to do is set the name (The part after the colons) in the variable. You can write it out, or you can even use expressions to set it for you:

    set {list::mod} to 7
    set {list::%player%} to true

    Notice that we no longer use the 'add' effect? This is because we are not simply adding a box to the room (Which would give us the default number system), but we are adding a box with a specific name. So we need to set that box's name to something, and give it a value. You can also use this method to access a specific box in the room (One value out of a list variable) at any time in your code. This makes them work very similar to nested variables.

    This technique allows for the quick deletion of a list of variables. Rather than setting nested variables to a value, you can do the same thing with a list variable, but it will be set up in such a way to be able to easily delete the entire list:

    set {mod.%player%} to true # Old method
    set {mod.list::%player%} to true #New method

    delete {mod.list::*} #When you use the * as the index it refers to the entire room, rather than a specific box

    Looping
    To start a loop of a list variable you start it off with:

    loop {list::*}:
     
    #2 TPGamesNL, Mar 3, 2018
    Last edited: Mar 3, 2018
Thread Status:
Not open for further replies.
Loading...