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...
NameFlag
Related Guide Pagehttps://guide.denizenscript.com/guides/basics/flags.html
Syntaxflag [<object>|...] [<name>([<#>])](:<action>)[:<value>] (expire:<time>)
Short DescriptionSets or modifies a flag on any flaggable object.
Full DescriptionThe flag command sets or modifies custom data values stored on any flaggable object (the server, a player/NPC/entity, a block location, ...).
See also Language:flag system.

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

Flags by default are added permanently (or for the lifetime of the object they're attached to).
You can optionally specify a system time the flag will expire at, using either a DurationTag or a TimeTag.
If a DurationTag is used, it will be equivalent to: <util.time_now.add[<your_duration_here>]>
Related Tags<FlaggableObject.flag[<flag_name>]> Returns the specified flag from the flaggable object. (...)
<FlaggableObject.has_flag[<flag_name>]> Returns true if the flaggable object has the specified flag, otherwise returns false. (...)
<FlaggableObject.flag_expiration[<flag_name>]> Returns a TimeTag indicating when the specified flag will expire. (...)
<FlaggableObject.list_flags> Returns a list of the flaggable object's flags. (...)
<server.online_players_flagged[<flag_name>]> Returns a list of all online players with a specified flag set.
<server.players_flagged[<flag_name>]> Returns a list of all players (online or offline) with a specified flag set. (...)
<server.spawned_npcs_flagged[<flag_name>]> Returns a list of all spawned NPCs with a specified flag set.
<server.npcs_flagged[<flag_name>]> Returns a list of all NPCs with a specified flag set.
Usage Example
#Use to create or set a flag on a player.
- flag <player> playstyle:aggressive
Usage Example
#Use to set a temporary flag for five minutes on a player.
- flag <player> just_did_something expire:5m
Usage Example
#Use to flag an npc with a given tag value.
- flag <npc> location:<npc.location>
Usage Example
#Use to apply mathematical changes to a flag's value on a unique object.
- flag <context.damager> damage_dealt:+:<context.damage>
Usage Example
#Use to add an item to a server flag as a new value without removing existing values.
- flag server cool_people:->:<[player]>
Usage Example
#Use to add multiple items as individual new values to a server flag that is already a list.
- flag server cool_people:|:<[player]>|<[someplayer]>
Usage Example
#Use to remove an entry from a server flag.
- flag server cool_people:<-:<[someplayer]>
Usage Example
#Use to clear a flag and fill it with a new list of values.
- flag server cool_people:!|:<[player]>|<[someplayer]>|<[aplayer]>
Usage Example
#Use to completely remove a flag.
- flag server cool_people:!
Usage Example
#Use to modify a specific index in a list flag.
- flag server myflag[3]:HelloWorld
Groupcore
Sourcehttps://github.com/DenizenScript/Denizen-Core/blob/master/src/main/java/com/denizenscript/denizencore/scripts/commands/core/FlagCommand.java#L85