OmniLotus00 Posted August 10, 2021 Share Posted August 10, 2021 (edited) Part1: I wanted to make a shop system that was very easy to update and fast. However I'm worried about the performance & speed while looping through a list (that has like 125+ items) splitting and then comparing E.G. Section 1 contains "Bruh" . Part2: To make the shop above I was thinking of using a list with a string like this "name||currency||amount||limit", so how would I make a big list. If you know how to answer to my 2 questions or a better way to do it, please leave some examples. Edited August 10, 2021 by OmniLotus00 Link to comment Share on other sites More sharing options...
Deflecto Posted August 12, 2021 Share Posted August 12, 2021 You could preload the inventory once when the script is loaded, and then make each player open this inventory as long as it can't be edited by players. If you have concern that looping over the list will cause a lot of lag even just when preloading the inventory, enough to cause a crash, you could make your script slow down whenever what you're doing takes more than a tick. Example: on script load: set {_inv} to inventory with 6 rows named "Example Shop" set {_lag} to 1 tick after now loop {shopcontents::*}: set {_i} to loop-index set {_i} to {shopcontents::%{_i}%} #do any modifications to {_i} here add {_i} to {_inv} {_lag} is not more than now: wait 1 tick set {_lag} to 1 tick after now #Skript has delayed an entire tick, so rather than letting this continue, we're going to wait a tick set {shopinv} to {_inv} #Finish loading the shop command /shop: trigger: open {shopinv} for the player #Remember to cancel inventory click and drop events! https://forums.skunity.com/threads/vanilla-guis.8939/ Also just putting this link here in case you have any trouble creating the GUI itself. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now