01.07.2016, 08:14
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:
Another advanced approach is to lock any event script from executing in parallel by using semaphores:
http://openrb.com/docs/semaphore.htm
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