7DTD-ScriptingMod icon indicating copy to clipboard operation
7DTD-ScriptingMod copied to clipboard

Run scripts periodically by configurable timers

Open djkrose opened this issue 7 years ago • 2 comments

It should be possible to run scripts repeatedly based on timers, similar to a cronjob.

djkrose avatar Sep 14 '17 13:09 djkrose

Is setimout or setinterval not available in the js runtime?

ddumont avatar Sep 14 '17 13:09 ddumont

No, because this is part of the window object, which does not exist without browser. I might add these two methods later, but it would still require someone to execute a command initially, after every server restart.

It is also problematic to have long-running scripts, because commands are executed on the main thread and freeze the server while executing. Adding the possibility to delay execution with settimeout is not trivial.

djkrose avatar Sep 14 '17 13:09 djkrose