Denizen/0.8/Interact Scripts/Commands: Difference between revisions
< Denizen
m (AgentKid moved page Denizen/0.8/Interact Scripts/Commands to Denizen/0.7/0.8/Interact Scripts/Commands without leaving a redirect) |
m (AgentKid moved page Denizen/0.7/0.8/Interact Scripts/Commands to Denizen/0.8/Interact Scripts/Commands without leaving a redirect) |
(No difference)
|
Revision as of 18:29, 5 February 2013
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:
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.
COOLDOWN |
[# or DURATION:#] (GLOBAL) ('SCRIPT:Name of Script') | |
---|---|---|
Sets a cooldown period for this script. Defaults to the currently running script and the interacting player. Until the script has cooled down, it will not be selected to run again. Requires a number of seconds to be specified with or without the DURATION: modifier name.
Modifiers:
Example Usages - COOLDOWN 60 - COOLDOWN GLOBAL 100 - COOLDOWN 'SCRIPT:A Different Script' 600 - COOLDOWN DURATION:15 |
DISENGAGE |
(NPCID:#) | |
---|---|---|
Allowed an ENGAGED Denizen to be interacted with again, the counterpart to the ENGAGE command. Can also specify the NPCID of a different Denizen Example Usages - ENGAGE - (Other Commands) - DISENGAGE - DISENGAGE NPCID:7 |
ENGAGE |
(DURATION:#) (NPCID:#) | |
---|---|---|
Blocks player interaction from triggering the NPC. This may be useful if a long script required the player to listen or watch a series of events and you didn't want the Player to be able to interact while these commands were being taken out. Use with either a DURATION or DISENGAGE. DURATION will automatically DISENGAGE after the specified amount of seconds. If no Example Usages - ENGAGE - (Other Commands) - DISENGAGE - ENGAGE DURATION:12 - ENGAGE NPCID:2 |
FAIL |
('SCRIPT:Name of Script') | |
---|---|---|
Marks a script as 'Failed' to check against with the FAILED requirement. This is identical to the FINISH command, except keeps track of 'fails' instead. Again, this is kind of like a built-in flag for scripts, and acts much like a Counter, ie. You can FAIL a script multiple times and it will keep track of the total number, unless RESET. Note: A script can be both 'finished' and 'failed', the two commands work independently. Example Usages - FAIL - FAIL 'SCRIPT:Magic Feathers' |
FINISH |
('SCRIPT:Name of Script') | |
---|---|---|
Marks a script as 'Finished' to check against with the FINISHED requirement. This is kind of like a built-in flag for scripts, and acts much like a Counter, ie. You can FINISH a script multiple times and it will keep track of the total number, unless RESET. Example Usages - FINISH - FINISH 'SCRIPT:Another Script' |
FLAG |
['Flag Name' or 'Flag Name:Flag Value' or 'Flag Name:++' or 'Flag Name:--'] (PLAYER or DENIZEN or GLOBAL) (DURATION:#) | |
---|---|---|
Requires one of the above arguments. FLAG 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 TRUE. When RESET, it is FALSE. FLAG can also set Integer (or number) variables, and easily increment or decrease them with the use of the ++ and -- arguments accordingly. The command can also store a String value, see the example below. Using a DURATION 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. Example Usages - FLAG 'Sample Boolean Flag' - FLAG Alignment:++ - FLAG Alignment:-- - FLAG 'Active Item:60 Feathers' - FLAG WorldBossDead GLOBAL - FLAG HasHealingFlag DURATION:180 |
IF |
(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 the condition is met. By default the TASK script will run before the interact script continues.
Modifiers:
Example Usages - IF FLAG:BossDead SCRIPT:Reward APPEND - IF EXACTLY FLAG:Stage:4 SCRIPT:Stage4Instructions - IF 'FLAG:AGE:13' 'SCRIPT:Meets Minimum Age' ELSE 'SCRIPT:Does Not Meet Minimum Age' |
RANDOM |
[#] | |
---|---|---|
Selects a single command to run from the next # lines in the script and discards the rest.
Example Usages - CHAT "I'm going to say the name of an animal" - RANDOM 3 - CHAT "Cow" - CHAT "Zebra" - CHAT "Elephant" - CHAT "Wasn't that fun?" |
Server
EXECUTE |
[ASPLAYER or ASSERVER or ASNPC] ["command and arguments"] | |
---|---|---|
Runs a Minecraft/Bukkit command. Specifying ASPLAYER, ASSERVER, or ASNPC defines how the command should be executed. ASNPC will run the command as the Denizen interacting, temporarily granting OP privileges, if the Denizen NPC is a Human-type NPC. Running ASSERVER will run as a console command, and running ASPLAYER will simply run the command as the Player. When specifying the command and arguments, it is not necessary to use the '/' that is generally used when running commands in-game. You may also use <PLAYER>, <WORLD>, or <NPCID> as variables inside the command arguments. Example Usages EXECUTE ASSERVER 'gamemode <PLAYER> 2' EXECUTE ASNPC 'toggledownfall' EXECUTE ASPLAYER 'spawn' |
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.
ANNOUNCE |
['The text to announce.'] | |
---|---|---|
Sends the text as a sever announcement to all players, regardless of their place in the world. Could be especially useful for any kind of administration script.
Example Usages - ANNOUNCE "<PLAYER> has found a secret!" |
CHAT |
["The text to chat."] (NPCID:#) (NOPLAYER) | |
---|---|---|
Makes the Denizen talk to the player. This is the standard chat mechanism in Denizen. You can also change the NPC doing the talking by specifying a Denizen's C2 NPCID. If you would rather the Denizen NPC not speak to the Player directly, use the NOPLAYER argument.
Example Usages - CHAT NOPLAYER "Here ye, hear ye!" - CHAT "Hello there, children!" - CHAT NPCID:6 'I only supply tools to builders!' |
NARRATE |
['The text to narrate.'] | |
---|---|---|
Makes a message appear to player without sender information.
Example Usages - NARRATE "There is a small mailbox here." |
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.
PAUSE |
(DURATION:#) | |
---|---|---|
Causes the Denizen to stop any pathing or activities. Useful for keeping it in place during an interaction.
Modifiers:
Example Usages - PAUSE - PAUSE DURATION:30 |
World Interaction
DROP |
[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.
Example Usages - DROP DIAMOND QTY:3 - DROP 18:3 QTY:1 BOOKMARK:LargeTree - DROP XP QTY:10 |
LISTEN KILL |
[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 entity type (like 'ZOMBIE'). Use NPCID:# modifier when using TYPE:NPC.
Optional Modifiers:
Example Usages - LISTEN KILL TYPE:ENTITY NAME:ZOMBIE QTY:5 SCRIPT:ZombieReward - LISTEN KILL ID:BossListener TYPE:NPC NPCID:12 'SCRIPT:Kill Boss Reward' |
LISTEN BLOCK |
[TYPE:BREAK or TYPE:BUILD or TYPE:COLLECT] (QTY:#) [BLOCKS:Item Names] (REGION:WorldGuardRegion) [SCRIPT:Task Script] [ID:Name] | |
---|---|---|
This command starts the Denizen listening for the player to interact with a given number of blocks, then runs a task scripts.
Optional Modifiers:
Example Usages - LISTEN BLOCK TYPE:BREAK BLOCKS:sand|stone|stonebrick QTY:5 SCRIPT:BlockFinished - LISTEN BLOCK ID:BuildListner TYPE:BUILD 'SCRIPT:Kill Boss Reward' REGION:KillRegion |
SWITCH |
[LOCATION:x,y,z,world] (STATE:ON | |
---|---|---|
OFF |
Player Interaction
These commands default to affecting the interacting player. Most have modifiers to affect the executing Denizen instead.
CAST |
[SpellName] (DURATION:#) (POWER:#) (NPC:#) (PLAYER:PlayerName) | |
---|---|---|
Gives the specified target a potion effect. Valid potion names are the same as the Alchemist's.
Modifiers:
Example Usages - CAST SPELL:confusion DURATION:300 POWER:3 - CAST SPELL:speed |
FEED |
(AMOUNT:#) | |
---|---|---|
Feeds the interacting player. Provides food and saturation.
Modifiers: AMOUNT: The amount to feed. Default is 20. Example Usages - FEED - FEED 5 |
HEAL |
(DENIZEN) (AMOUNT:#) | |
---|---|---|
Heals the interacting player.
Modifiers:
Example Usages - HEAL - HEAL DENIZEN AMOUNT:1 |