Solved Help with decaying list values

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

NCSGeek

Member
Jul 22, 2017
19
3
0
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!
 
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.
 
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.

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

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.
 
Something like this:
Code:
set {_index} to size of {list::*} + 1
while {list::%{_index}%} is set:
    set {_index} to {_index} + 1
set {list::%{_index}%} to {_value}
wait 1 second
delete {list::%{_index}%}
 
Something like this:
Code:
set {_index} to size of {list::*} + 1
while {list::%{_index}%} is set:
    set {_index} to {_index} + 1
set {list::%{_index}%} to {_value}
wait 1 second
delete {list::%{_index}%}

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!
 
Status
Not open for further replies.