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 173 commands...
NameDefine
Related Guide Pagehttps://guide.denizenscript.com/guides/basics/definitions.html
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.
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]>
- narrate '[NOTICE] You have noticed <player.location.find_blocks[<[blocks]>].within[<[range]>].size> 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 replaceable 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:!
Synonyms (Search Aid)definition
Groupqueue
Sourcehttps://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/scripts/commands/queue/DefineCommand.java#L30