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

From Citizens Wiki
Line 31: Line 31:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
ENGAGE
ENGAGE
|DURATION:[#]) (NPCID:[#])
|(DURATION:#) (NPCID:#)
| <p>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 <tt>DURATION</tt> or <tt>DISENGAGE</tt>. <tt>DURATION</tt> will automatically <tt>DISENGAGE</tt> after the specified amount of seconds. If no <code>NPCID</code> is included, the Denizen triggered is used. Remember: While <tt>ENGAGED</tt>, no scripts will trigger, so be diligent in using!</p>
| <p>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 <tt>DURATION</tt> or <tt>DISENGAGE</tt>. <tt>DURATION</tt> will automatically <tt>DISENGAGE</tt> after the specified amount of seconds. If no <code>NPCID</code> is included, the Denizen triggered is used. Remember: While <tt>ENGAGED</tt>, no scripts will trigger, so be diligent in using!</p>
'''Example Usages'''
'''Example Usages'''
Line 45: Line 45:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
ZAP
ZAP
|([Step #])&nbsp;('SCRIPT:[Name of Script]')&nbsp;(DURATION:[#])&nbsp;('RANDOM:[#]-(#)')
|(Step #) ('SCRIPT:Name of Script') (DURATION:#) (RANDOM:#-#)
| <p>A very powerful command, indeed. This is how Scripts progress through their steps. It is not done automatically, instead, you get to decide how to progress. ZAP used alone will simply progress the Player to the next step in the Script. Note: Denizen does not check whether the step exists, so you can use that to your advantage in an Overlay Script Assignment. If an Integer is used, that step will be used.</p>
| <p>A very powerful command, indeed. This is how Scripts progress through their steps. It is not done automatically, instead, you get to decide how to progress. ZAP used alone will simply progress the Player to the next step in the Script. Note: Denizen does not check whether the step exists, so you can use that to your advantage in an Overlay Script Assignment. If an Integer is used, that step will be used.</p>
<p>Specify a <tt>SCRIPT</tt> to change the active step for a Player in a specific Script. If not specified, the triggering Script is used. A <tt>DURATION</tt> can be set to provide an automatic "DEZAP" of sorts, reverting the step back after a specific amount of seconds, unless, in that duration another ZAP command has taken place. This can be used as a 'timeout' of sorts. <tt>RANDOM</tt> can be used to let chance select the step to progress the Player to. If one Integer is included, steps 1 through the chosen number will be randomly selected. You can also use a range of numbers if two Integers are used.</p>
<p>Specify a <tt>SCRIPT</tt> to change the active step for a Player in a specific Script. If not specified, the triggering Script is used. A <tt>DURATION</tt> can be set to provide an automatic "DEZAP" of sorts, reverting the step back after a specific amount of seconds, unless, in that duration another ZAP command has taken place. This can be used as a 'timeout' of sorts. <tt>RANDOM</tt> can be used to let chance select the step to progress the Player to. If one Integer is included, steps 1 through the chosen number will be randomly selected. You can also use a range of numbers if two Integers are used.</p>
Line 55: Line 55:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
WAIT
WAIT
|[# of Seconds]&nbsp;&nbsp;(QUEUE:TASK<nowiki>|</nowiki>TRIGGER)
|[# of Seconds] (QUEUE:TASK) (QUEUE:TRIGGER)
| <p>Pauses a Queue for a specified amount of seconds. If no <tt>QUEUE</tt> is specified, the sending queue is used. For example, if the command is sent from an Interact (Triggered) Script, the queue that will be held is the 'Trigger Queue'. Could be useful in advanced usage situations when using both Task Scripts and Interact Scripts together.</p>
| <p>Pauses a Queue for a specified amount of seconds. If no <tt>QUEUE</tt> is specified, the sending queue is used. For example, if the command is sent from an Interact (Triggered) Script, the queue that will be held is the 'Trigger Queue'. Could be useful in advanced usage situations when using both Task Scripts and Interact Scripts together.</p>
'''Example Usages'''
'''Example Usages'''
Line 63: Line 63:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
FLAG
FLAG
|<nowiki>'[Flag Name]'&nbsp;OR&nbsp;'[[Flag Name]:[Flag Value]]'&nbsp;OR&nbsp;[[Flag Name]:++|--]'&nbsp;(DURATION:[#])</nowiki>
|['Flag Name' or 'Flag Name:Flag Value' or 'Flag Name:++' or 'Flag Name:--'] (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.</p>
| <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.</p>
'''Example Usages'''
'''Example Usages'''
Line 75: Line 75:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
FINISH
FINISH
|('SCRIPT:[Name of Script]')
|('SCRIPT:Name of Script')
| <p>Marks a script as 'Finished' to check against with the <tt>FINISHED</tt> requirement. This is kind of like a built-in flag for scripts, and acts much like a Counter, ie. You can <tt>FINISH</tt> a script multiple times and it will keep track of the total number, unless <tt>RESET</tt>.</p>
| <p>Marks a script as 'Finished' to check against with the <tt>FINISHED</tt> requirement. This is kind of like a built-in flag for scripts, and acts much like a Counter, ie. You can <tt>FINISH</tt> a script multiple times and it will keep track of the total number, unless <tt>RESET</tt>.</p>
'''Example Usages'''
'''Example Usages'''
Line 83: Line 83:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
FAIL
FAIL
|('SCRIPT:[Name of Script]')
|('SCRIPT:Name of Script')
| <p>Marks a script as 'Failed' to check against with the <tt>FAILED</tt> requirement. This is identical to the <tt>FINISH</tt> 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 <tt>FAIL</tt> a script multiple times and it will keep track of the total number, unless <tt>RESET</tt>. Note: A script can be both 'finished' and 'failed', the two commands work independently.</p>
| <p>Marks a script as 'Failed' to check against with the <tt>FAILED</tt> requirement. This is identical to the <tt>FINISH</tt> 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 <tt>FAIL</tt> a script multiple times and it will keep track of the total number, unless <tt>RESET</tt>. Note: A script can be both 'finished' and 'failed', the two commands work independently.</p>
'''Example Usages'''
'''Example Usages'''
Line 91: Line 91:
{{Denizen Command Color 2|mintcream|
{{Denizen Command Color 2|mintcream|
RESET
RESET
|('SCRIPT:[Name of Script]')
|('SCRIPT:Name of Script')
| <p>Sets either FINISHED or FAILED of the specified script to False. Remember: Script names are case sensitive!</p>
| <p>Sets either FINISHED or FAILED of the specified script to False. Remember: Script names are case sensitive!</p>
'''Example Usages'''
'''Example Usages'''

Revision as of 05:59, 21 August 2012

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 affect 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 either single ' ' or double " " around the text!

You can use the following placeholders to fill in specific information:

  • <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.

Movement

Denizen NPC commands are meant to help bring your Denizen to life by allowing fine-control of small movements. These are not necessarily meant for making the Denizen NPC do large/long activities, those will instead be done by the Activities, which is just now starting to be implemented into Denizen. The next 'large' update will focus on Activities.

World Interaction

Player Interaction