Name | RunLater |
Syntax | runlater [<script>] (path:<name>) [delay:<duration>] (id:<id>) (def:<element>|.../defmap:<map>/def.<name>:<value>) |
Short Description | Causes a task to run sometime in the future, even if the server restarts. |
Full Description | Causes a task to run sometime in the future, even if the server restarts.
Script, path, and definition inputs work the exact same as with run. This command will store intended script runs to a file, so that even if the server restarts, they will still run. Script runs are guaranteed to happen after the time is up - if the server is turned off at the scheduled time, they will run at next startup. The guarantee can be broken if the server crashes or other errors occur. The delay input is a DurationTag instance, that is relative to system time (not server delta time). Definitions and queue object links will be preserved, so long as they remain valid at time of execution. Objects that are lost before the delay is up (such as a linked NPC that is removed) may cause errors. You can optionally specify the "id" argument to provide a unique tracking ID for the intended future run, which can then also be used to cancel it via system.cancel_runlater. If you use IDs, they must be unique - you cannot have the same ID scheduled twice. Use util.runlater_ids if you need to dynamically check if an ID is in use. Implementation note: the system that tracks when scripts should be ran is a fair bit more optimized than 'wait' commands or the 'run' command with a delay, specifically for the case of very large delays (hours or more) - in the short term, 'wait' or 'run' with a delay will be better. |
Related Tags | <util.runlater_ids> Returns a list of all scheduled task IDs for runlater. (...)
|
Usage Example |
|
Usage Example |
|
Usage Example |
|
Group | queue |
Source | https://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/scripts/commands/queue/RunLaterCommand.java#L36 |