Denizen Script Commands


Commands are always written with a '-' before them, and are the core component of any script, the primary way to cause things to happen.
Learn about how commands work in The Beginner's Guide.


Showing 1 out of 184 commands...
NameRunLater
Syntaxrunlater [<script>] (path:<name>) [delay:<duration>] (id:<id>) (def:<element>|.../defmap:<map>/def.<name>:<value>)
Short DescriptionCauses a task to run sometime in the future, even if the server restarts.
Full DescriptionCauses a task to run sometime in the future, even if the server restarts.

Script, path, and definition inputs work the exact same as with Command: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 Mechanism:system.cancel_runlater.
If you use IDs, they must be unique - you cannot have the same ID scheduled twice. Use Tag: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 Command:runlater. (...)
Usage Example
# Use to run a task script named 'example' 3 days later.
- runlater example delay:3d
Usage Example
# Use to run a task script named 'my_task' 5 hours later with definition 'targets' set to a list of all the players that were near the player before the delay.
- runlater my_task delay:5h def.targets:<player.location.find_players_within[50]>
Usage Example
# Use to plan to go for a jog tomorrow then change your mind after 5 seconds.
- runlater go_for_jog id:healthy_plan delay:1d
- wait 5s
- adjust system cancel_runlater:healthy_plan
Groupqueue
Sourcehttps://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/scripts/commands/queue/RunLaterCommand.java#L36