18.11.2020, 14:37
You're correct about how variables work. But each script is a separate OS process. You cannot share variables between processes directly. For this you can use storage.
The construct is mostly meant for resident scripts but it will work in a event script even though it's not necessary.
If you want to implement a counter that can be reset then the increment must be an atomic operation. Use this to increment a storage value by 1:
The construct is mostly meant for resident scripts but it will work in a event script even though it's not necessary.
If you want to implement a counter that can be reset then the increment must be an atomic operation. Use this to increment a storage value by 1:
Code:
storage.exec('incr', 'my_key_name')