Denizen/0.7/Interact Scripts/Commands: Difference between revisions

From Citizens Wiki
(Sorted the commands alphabetically in each category, with aufdemrand's permission.)
No edit summary
 
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
For more up-to-date information and full details on specific features (individual commands or tags, for example), check the [https://meta.denizenscript.com/ Meta Documentation].
If you want a full tutorial to help get you set up, check out the [https://guide.denizenscript.com/ Beginner's Guide] text website.
If you need quick help, visit our [https://discord.gg/Q6pZGSR Discord group].
<br><br><br>
<span style="font-family:natalya-alternate-one; font-size:300%; margin-right:-7px; margin-left:-10px;">This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!</span>
<br><br><br>
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
<div style="margin-right:2.0em; padding:10px; font-family:museo-sans; font-size:110%;">
Interact Script Commands are used to make the Denizen perform actions in an Interact Script. They are written in a [[YAML]] sequence under the Script node of an [[Denizen/Interact_Scripts/Triggers|Interact Trigger]]. A single entry in the sequence contains a Command and Modifiers. Some commands have no available modifiers.
Interact Script Commands are used to make the Denizen perform actions in an Interact Script. They are written in a [[YAML]] sequence under the Script node of an [[Denizen/Interact_Scripts/Triggers|Interact Trigger]]. A single entry in the sequence contains a Command and Modifiers. Some commands have no available modifiers.
Line 103: Line 124:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
FLAG
FLAG
|['Flag Name' or 'Flag Name:Flag Value' or 'Flag Name:++' or 'Flag Name:--'] (GLOBAL) (DURATION:#)
|['Flag Name' or 'Flag Name:Flag Value' or 'Flag Name:++' or 'Flag Name:--'] (PLAYER or DENIZEN or GLOBAL) (DURATION:#)
| <p>Requires one of the above arguments. <tt>FLAG</tt> store variables, or 'flags', to a Player. This can be used to keep track of information that can be check against with the FLAGGED requirement. Usage of the command is easy, and can be used in 3 different ways. A Boolean (true/false) value can be set with only a flag name. If set, the value is <tt>TRUE</tt>. When <tt>RESET</tt>, it is <tt>FALSE</tt>. <tt>FLAG</tt> can also set Integer (or number) variables, and easily increment or decrease them with the use of the <tt>++</tt> and <tt>--</tt> arguments accordingly. The command can also store a String value, see the example below. Using a <tt>DURATION</tt> will revert the value of the flag to the previous value, if during the duration the flag has not changed. Using the GLOBAL modifier will set a flag independent of a player.</p>
| <p>Requires one of the above arguments. <tt>FLAG</tt> stores variables, or 'flags', by default to a Player. This can be used to keep track of information that can be check against with the FLAGGED requirement. Usage of the command is easy, and can be used in 3 different ways. A Boolean (true/false) value can be set with only a flag name. If set, the value is <tt>TRUE</tt>. When <tt>RESET</tt>, it is <tt>FALSE</tt>. <tt>FLAG</tt> can also set Integer (or number) variables, and easily increment or decrease them with the use of the <tt>++</tt> and <tt>--</tt> arguments accordingly. The command can also store a String value, see the example below. Using a <tt>DURATION</tt> will revert the value of the flag to the previous value, if during the duration the flag has not changed. Using the PLAYER modifier will set the flag on the Player (which is the default behavior). Using the DENIZEN modifier will set a flag on the Denizen instead of the Player. Using the GLOBAL modifier will set a flag independent of a Player or Denizen.</p>
'''Example Usages'''
'''Example Usages'''
<pre>- FLAG 'Sample Boolean Flag'
<pre>- FLAG 'Sample Boolean Flag'
Line 117: Line 138:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
IF
IF
|(EXACTLY) (GLOBAL) (-)[FLAG:Value] [FLAG]  '[SCRIPT:Task Script to Run]' (QUEUETYPE:TRIGGER) (QUEUETYPE:TASK) (APPEND)
|(EXACTLY) (PLAYER or DENIZEN or GLOBAL) (-)[FLAG:Name or FLAG:Name:Value] (IS_NUMBER) ['SCRIPT:Script Run When Condition Met'] (QUEUE:TRIGGER or QUEUE:TASK) (APPEND) (ELSE 'SCRIPT:Script Run When Condition Not Met')
|Checks the value of a FLAG and runs a TASK script if it passes. By default the TASK script will run before the interact script continues.
|Checks the value of a FLAG and runs a TASK script if the condition is met. By default the TASK script will run before the interact script continues.
Modifiers:
Modifiers:
*EXACTLY - For integer flags only passes if the value matches exactly. By default passes if value is greater than or equal.
*EXACTLY - For integer flags, the IF condition is met only if the value matches exactly. By default, the condition is met if the flag's value is greater than or equal to the value it is checked against, i.e. IF 'FLAG:AGE:13' will pass for any AGE that is at least 13, but IF EXACTLY 'FLAG:AGE:13' will only pass if the AGE is 13.
*GLOBAL - check a GLOBAL flag instead of a flag on this player
*PLAYER - Check a flag set on this Player (which is the default behavior)
*DENIZEN - Check a DENIZEN flag set on the Denizen itself instead of a flag on this Player
*GLOBAL - Check a GLOBAL flag instead of a flag on this Player
*IS_NUMBER - The IF condition is met only if the value of the flag is an integer or double.
*APPEND - Runs the TASK after this script completes, instead of before the next command.
*APPEND - Runs the TASK after this script completes, instead of before the next command.
*QUEUETYPE - Specify which queue to run the commands, defaults to the executing queue type.
*QUEUE - Specify which queue to run the commands in, defaults to the executing queue type.
*ELSE - Choose a TASK script to run when the IF condition is not met.
'''Example Usages'''
'''Example Usages'''
<pre>
<pre>
- IF FLAG:BossDead SCRIPT:Reward APPEND
- IF FLAG:BossDead SCRIPT:Reward APPEND
- IF EXACTLY FLAG:Stage:4 SCRIPT:Stage4Instructions
- IF EXACTLY FLAG:Stage:4 SCRIPT:Stage4Instructions
- IF 'FLAG:AGE:13' 'SCRIPT:Meets Minimum Age' ELSE 'SCRIPT:Does Not Meet Minimum Age'
</pre>
</pre>
}}
}}
Line 189: Line 215:
- ZAP
- ZAP
- ZAP 5
- ZAP 5
- ZAP RANOMD:6
- ZAP RANDOM:6
- ZAP RANDOM:3-6 DURATION:60
- ZAP RANDOM:3-6 DURATION:60
- ZAP 6 'SCRIPT:Another Script'
- ZAP 6 'SCRIPT:Another Script'
Line 243: Line 269:
*All Speech commands '''require quotes''' (single (' ') or double (" ")) around the text. If your text has an apostrophe (') in it, you '''MUST''' use double quotes (" ")!!
*All Speech commands '''require quotes''' (single (' ') or double (" ")) around the text. If your text has an apostrophe (') in it, you '''MUST''' use double quotes (" ")!!


You can use the following placeholders to fill in specific information:
There are various placeholders you can use to fill in specific information. The basic ones are:
*<NPC> - The Denizens's name.
*<NPC> - The Denizens's name.
*<PLAYER> - The interacting Player's name
*<PLAYER> - The interacting Player's name
Line 251: Line 277:


If you use the NOPLAYER modifier on a text command the <PLAYER>, <DISPLAYNAME> and <HEALTH> tags are not available.
If you use the NOPLAYER modifier on a text command the <PLAYER>, <DISPLAYNAME> and <HEALTH> tags are not available.
A list of all available placeholders can be found in [[Replaceables]].


{{Denizen Command Color 2|lavender|
{{Denizen Command Color 2|lavender|
Line 333: Line 361:
</div>
</div>


====Movement====
====Denizen Interaction====
Movement commands are meant to help bring your Denizen to life by allowing fine control of movement during scripts. These are not meant for making the Denizen do continuous movement, that should instead be done via [[Denizen/Activity_Scripts/Activities|Activities]].
Denizen interaction commands are meant to help bring your Denizen to life by allowing fine control of movement and actions during scripts. These are not meant for making the Denizen do continuous movement and actions, that should instead be done via [[Denizen/Activity_Scripts/Activities|Activities]].
 
{{Denizen Command Color 2|mintcream|
HOLD
| [ID or ID:Data or MATERIAL or MATERIAL:Data]
| Makes the Denizen hold a specific block or item.
'''Example Usages'''
<pre>
- HOLD IRON_PICKAXE
- HOLD 98:3
</pre>
}}


{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
Line 416: Line 455:
====World Interaction====
====World Interaction====


{{Denizen Command Color 2|wheat|
{{Denizen Command Color 2|lightgoldenrodyellow|
DROP
DROP
| [ID or ID:Data or MATERIAL:Data or MATERIAL] (QTY:#) (BOOKMARK:LocationBookmark)
| [ID or ID:Data or MATERIAL or MATERIAL:Data or XP] (QTY:#) (BOOKMARK:LocationBookmark)
| Drop an item at the Denizen's location, or at a location bookmark if one is specified.
| Drop an item at the Denizen's location, or at a location bookmark if one is specified.
'''Example Usages'''
'''Example Usages'''
Line 424: Line 463:
- DROP DIAMOND QTY:3
- DROP DIAMOND QTY:3
- DROP 18:3 QTY:1 BOOKMARK:LargeTree
- DROP 18:3 QTY:1 BOOKMARK:LargeTree
- DROP XP QTY:10
</pre>
</pre>
}}
}}


{{Denizen Command Color 2|wheat|
{{Denizen Command Color 2|lightgoldenrodyellow|
LISTEN KILL
LISTEN KILL
|[TYPE:GROUP or TYPE:PLAYER or TYPE:ENTITY or TYPE:NPC] [NAME:Name or NPCID:#] (QTY:#) [SCRIPT:Task Script]
|[TYPE:GROUP or TYPE:PLAYER or TYPE:ENTITY or TYPE:NPC] [NAME:Name or NPCID:#] (QTY:#) [SCRIPT:Task Script] (ID:Name)
| This command starts the Denizen listening for the player to kill the specified number of specified targets, then runs a task script. Use the NAME:Name modifier when specifying a group name, player name, or [[Types|entity type]] (like 'ZOMBIE'). Use NPCID:# modifier when using TYPE:NPC.  
| This command starts the Denizen listening for the player to kill the specified number of specified targets, then runs a task script. Use the NAME:Name modifier when specifying a group name, player name, or [[Types|entity type]] (like 'ZOMBIE'). Use NPCID:# modifier when using TYPE:NPC.
Optional Modifiers:
Optional Modifiers:
*QTY: - The number things the player must kill before the script is run.
*QTY: - The number things the player must kill before the script is run.
*ID: - The name of the kill listener; without it, the listener will take on the name of the script run upon completion.
'''Example Usages'''
'''Example Usages'''
<pre>
<pre>
- LISTEN KILL TYPE:ENTITY NAME:ZOMBIE QTY:5 SCRIPT:ZombitReward
- LISTEN KILL TYPE:ENTITY NAME:ZOMBIE QTY:5 SCRIPT:ZombieReward
- LISTEN KILL TYPE:NPC NPCID:12 'SCRIPT:Kill Boss Reward'
- LISTEN KILL ID:BossListener TYPE:NPC NPCID:12 'SCRIPT:Kill Boss Reward'
</pre>
</pre>
}}
}}


{{Denizen Command Color 2|wheat|
{{Denizen Command Color 2|lightgoldenrodyellow|
SPAWN
SPAWN
|[ENTITY_TYPE] (QTY:#) (BOOKMARK:LocationBookmark) ('BOOKMARK:Denizen Name:LocationBookmark') (SPREAD:#) ('EFFECT:[POTION_EFFECT] [LEVEL]') ('OPTION:[OPTIONS]')
|[ENTITY_TYPE] (QTY:#) (BOOKMARK:LocationBookmark) ('BOOKMARK:Denizen Name:LocationBookmark') (SPREAD:#) ('EFFECT:[POTION_EFFECT] [LEVEL]') ('OPTION:[OPTIONS]')
Line 468: Line 509:
}}
}}


{{Denizen Command Color 2|wheat|
{{Denizen Command Color 2|lightgoldenrodyellow|
STRIKE
STRIKE
|(DENIZEN) (BOOKMARK:LocationBookmark) ('BOOKMARK:Denizen Name:LocationBookmark') (NODAMAGE) (NPCID:#)
|(DENIZEN) (BOOKMARK:LocationBookmark) ('BOOKMARK:Denizen Name:LocationBookmark') (NODAMAGE) (NPCID:#)
Line 489: Line 530:
}}
}}


{{Denizen Command Color 2|wheat|
{{Denizen Command Color 2|lightgoldenrodyellow|
SWITCH
SWITCH
|[BOOKMARK:BlockBookmark] or [BOOKMARK:DenizenName:BlockBookmark] (DURATION:#)
|[BOOKMARK:BlockBookmark] or [BOOKMARK:DenizenName:BlockBookmark] (DURATION:#)
Line 503: Line 544:
}}
}}


{{Denizen Command Color 2|wheat|
{{Denizen Command Color 2|lightgoldenrodyellow|
WEATHER
WEATHER
| [SUNNY or STORMY or PRECIPITATING]  
| [SUNNY or STORMY or PRECIPITATING]  
Line 551: Line 592:
{{Denizen Command Color 2|palegreen|
{{Denizen Command Color 2|palegreen|
GIVE
GIVE
|[MONEY or XP or HEROESEXP or MATERIAL:#] (QTY:#)
|[MONEY or XP or HEROESEXP or ID or ID:Data or MATERIAL or MATERIAL:Data] (QTY:#)
|
|
Gives something to the Player. If QTY: is not specified default is 1. You can also give Minecraft XP by using 'XP'.
Gives something to the Player. If QTY: is not specified, its default value is 1. You can also give Minecraft XP by using 'XP'.
Using HEROESEXP type will give the Player (or Hero) Questing Experience. Note: This requires HEROES to be installed on your server!
Using HEROESEXP type will give the Player (or Hero) Questing Experience. Note: This requires HEROES to be installed on your server!
'''Example Usages'''
'''Example Usages'''
Line 598: Line 639:
{{Denizen Command Color 2|palegreen|
{{Denizen Command Color 2|palegreen|
TAKE  
TAKE  
| [MONEY or ITEMINHAND or ID or ID:Data or MATERIAL:Data or MATERIAL] (QTY:#)
| [MONEY or ITEMINHAND or ID or ID:Data or MATERIAL or MATERIAL:Data] (QTY:#)
|
|
Takes something from the Player. If QTY: is not specified default is 1.
Takes something from the Player. If QTY: is not specified, its default value is 1.


'''Example Usages'''
'''Example Usages'''
Line 624: Line 665:
</pre>
</pre>
}}
}}
[[Category:Denizen 0.7]]

Latest revision as of 19:02, 3 September 2021

For more up-to-date information and full details on specific features (individual commands or tags, for example), check the Meta Documentation.

If you want a full tutorial to help get you set up, check out the Beginner's Guide text website.

If you need quick help, visit our Discord group.




This wiki is outdated, please view the tutorial videos/guide, meta documentation, or Discord group (all linked above) for up-to-date information!








Interact Script Commands are used to make the Denizen perform actions in an Interact Script. They are written in a YAML sequence under the Script node of an Interact Trigger. A single entry in the sequence contains a Command and Modifiers. Some commands have no available modifiers.

Syntax

Syntax is very important for proper execution.

  • Placing a caret ^ in front of the command name causes that command to ignore the normal 0.5 second delay between commands.
  • The command must be upper-case (i.e CHAT not chat)
  • Modifiers are not case sensitive.
  • Modifiers in [Brackets] are required for the command to execute. [A or B] means either A or B is required.
  • Modifiers in (Parentheses) are optional, and generally change the default behavior of the command.
  • Modifiers that take a value are of the form MODIFIER:VALUE.
    • If the VALUE of the modifier contains a space, such as in the case of a NPC or script name, the whole modifier must be put in quotes.
Example: - TELEPORT BOOKMARK:Bob:Bobshouse is okay, but - TELEPORT 'BOOKMARK:Bob Jones:Bobshouse' requires the quotes to function properly.

Example:

Some Trigger:
  Script:
  - COMMAND1 MODIFIER1 MODIFIER2:VALUE
  - COMMAND2 'MODIFIER1:Value With Spaces'
  - ^COMMAND3 'This will run instantly after COMMAND2'

List of Commands

Script Flow

These commands have no external effect on the world, but can control the flow of scripts within Denizen. Though not required, and with the exception of WAIT, it is generally recommended to run these as Instant Commands to ensure smooth Script feedback to players.

Server

The commands below require [Vault] and a valid permissions system.

Speech

These commands show some text to the player interacting, and usually to bystanders around. Text commands also have some auto-formatting, such as making sure no words will be cut off on long messages, and applying color codes. See: Denizen Color Codes. Formatting for how NPCs and Players talk can be customized in the Denizen/config.yml.

  • All Speech commands require quotes (single (' ') or double (" ")) around the text. If your text has an apostrophe (') in it, you MUST use double quotes (" ")!!

There are various placeholders you can use to fill in specific information. The basic ones are:

  • <NPC> - The Denizens's name.
  • <PLAYER> - The interacting Player's name
  • <DISPLAYNAME> - The interacting Player's display name
  • <HEALTH> - The interacting Player's heath
  • <WORLD> - The name of the Denizen's world

If you use the NOPLAYER modifier on a text command the <PLAYER>, <DISPLAYNAME> and <HEALTH> tags are not available.

A list of all available placeholders can be found in Replaceables.

Denizen Interaction

Denizen interaction commands are meant to help bring your Denizen to life by allowing fine control of movement and actions during scripts. These are not meant for making the Denizen do continuous movement and actions, that should instead be done via Activities.

World Interaction

Player Interaction

These commands default to affecting the interacting player. Most have modifiers to affect the executing Denizen instead.