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 Help with decaying list values

Discussion in 'Skript' started by NCSGeek, Feb 25, 2019.

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

    NCSGeek Member

    Joined:
    Jul 22, 2017
    Messages:
    19
    Likes Received:
    3
    Full script: https://pastebin.com/dJxWdCEW

    Hello all! In my script, im looking to have values in {%player%-tpa::*} be removed from that list after a given amount of time. Im not quite sure how to go about this, however. Above is my current script.

    I have no addons installed, and I'm on Skriptv2.3.5 Minecraft 1.13.2. Thanks!

     
  2. Best Answer:
    Post #6 by TPGamesNL, Feb 27, 2019
  3. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    You can add a delay, then after that delay you simply add delete {%player%-tpa::*}. However, I recommend you to not put an expression (e.g. player) at the start of a variable. You will be better of doing something like {tpa::%player%::*}, since you can easily manage lists that way.
     
  4. NCSGeek

    NCSGeek Member

    Joined:
    Jul 22, 2017
    Messages:
    19
    Likes Received:
    3
    Well, here's the thing, the {%player%-tpa::*} list is all requests. I'd rather individual requests 'decay' individually. So basically, I'd need {%player%-tpa::%arg-1%} to be deleted rather than the entire list.

    Also, do you mean to just append a 'wait' then delete it after that? Because I considered that, but it seemed like a bad way to do it. Seems to me like it'd be better to do it sort of "asynchronously". (detached from the command's trigger)
     
  5. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    You can add a method to set a list with a specific index to the variable, and delete that {list::index} later. And yes, I think you can add a normal wait here since it's not required for the delay to remain after server restart (at least I think so) and then you should also add a thing that deletes all of the lists on skript load.
     
  6. NCSGeek

    NCSGeek Member

    Joined:
    Jul 22, 2017
    Messages:
    19
    Likes Received:
    3
    It has been a while since I've done skript, could you shoe an example of what you mean regarding that method to delete a specific index? Also, yeah, I probably should have a delete on script load, you're right. The server will be online 24/7 am it won't happen often, but still move to have.
     
  7. TPGamesNL

    Moderator Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    108
    Medals:
    Something like this:
    Code (Text):
    1. set {_index} to size of {list::*} + 1
    2. while {list::%{_index}%} is set:
    3.     set {_index} to {_index} + 1
    4. set {list::%{_index}%} to {_value}
    5. wait 1 second
    6. delete {list::%{_index}%}
     
  8. NCSGeek

    NCSGeek Member

    Joined:
    Jul 22, 2017
    Messages:
    19
    Likes Received:
    3
    Alright, thanks for the tip! I might simply delete the index after waiting an amount of time, but this would be better anyway so If I do feel like going this route, then this will come in handy. Cheers!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...