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...
Related Guide Page
Syntaxdefine [<id>](:<action>)[:<value>]
Short DescriptionCreates a temporary variable inside a script queue.
Full DescriptionDefinitions are queue-level 'variables' that can be used throughout a script, once defined, by using the <[<id>]> tag.
Definitions are only valid on the current queue and are not transferred to any new queues constructed within the script,
such as by a 'run' command, without explicitly specifying to do so.

Definitions are lighter and faster than creating a temporary flag.
Definitions are also automatically removed when the queue is completed, so there is no worry for leaving unused data hanging around.

This command supports data actions, see Language:data actions.

Definitions can be sub-mapped with the '.' character, meaning a def named 'x.y.z' is actually a def 'x' as a MapTag with key 'y' as a MapTag with key 'z' as the final defined value.
In other words, "<[a.b.c]>" is equivalent to "<[a].get[b].get[c]>"
Related Tags<[<id>]> to get the value assigned to an ID
<QueueTag.definition[<definition>]> Returns the value of the specified definition. (...)
<QueueTag.definitions> Returns the names of all definitions that were added to the current queue.
Usage Example
# Use to make complex tags look less complex, and scripts more readable.
- narrate "You invoke your power of notice..."
- define range <player.flag[range_level].mul[3]>
- define blocks <player.flag[noticeable_blocks]>
- define count <player.location.find_blocks[<[blocks]>].within[<[range]>].size>
- narrate "<&[base]>[NOTICE] You have noticed <[count].custom_color[emphasis]> blocks in the area that may be of interest."
Usage Example
# Use to validate a player input to a command script, and then output the found player's name.
- define target <server.match_player[<context.args.get[1]>]||null>
- if <[target]> == null:
  - narrate "<red>Unknown player target."
  - stop
- narrate "You targeted <[target].name>!"
Usage Example
# Use to keep the value of a tag that you might use many times within a single script.
- define arg1 <context.args.get[1]>
- if <[arg1]> == hello:
    - narrate Hello!
- else if <[arg1]> == goodbye:
    - narrate Goodbye!
Usage Example
# Use to remove a definition.
- define myDef:!
Usage Example
# Use to make a MapTag definition and set the value of a key inside.
- define myroot.mykey MyValue
- define myroot.myotherkey MyOtherValue
- narrate "The main value is <[myroot.mykey]>, and the map's available key set is <[myroot].keys>"
Synonyms (Search Aid)definition