This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

How to lock a script during execution?
#2
You can use storage to save last script execution time.
This example allows a script to be executed once in 5 seconds, you can tune the timer value as required:
Code:
now = os.time()
prevsend = storage.get('prevsendtime', 0)
delta = now - prevsend

if delta < 0 or delta > 5 then
  storage.set('prevsendtime', now)
  alert('executing script')
end

Another advanced approach is to lock any event script from executing in parallel by using semaphores:
http://openrb.com/docs/semaphore.htm
Reply


Messages In This Thread
RE: How to lock a script during execution? - by admin - 01.07.2016, 08:14

Forum Jump: