- Joined
- Dec 15, 2009
- Messages
- 1,386
- Reaction score
- 236
You must be registered to see links
how can I only retrieve an element from var arrays one at a time in an arranged number?
no math.random pls
Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!
Join Today!How can make it infinite loop? Haven't check the codes thoUltimately the best way for you to iterate over the array depends on what kind of content you have in there - e.g. whether they're meant to repeat or be used only once, but here's one approach assuming messages are something that appear at random times and do get shown only once.
You must be registered to see links
Just code that damn ring buffer yourself, it'll do good for you.
For an extremely naive solution though that will work in 10 seconds (that you should not consider a proper implementation and never quote on me telling you to write it like that), on every iteration just shift out the first element from the array and when you're done with it just push it back to the end of the array. (like that:You must be registered to see links)
Let me repeat, it's a bad solution in the general case because it has has terrible performance implications AND it's extremely vulnerable to concurrency issues should it be implemented on a platform that supports concurrent executions.