NPC Variables: Difference between revisions
Jump to navigation
Jump to search
(6 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
NPC Variables allow for scripting where keywords are replaced in strings. | |||
This allows for generic scripting like: | This allows for generic scripting like: | ||
Line 10: | Line 9: | ||
<wait duration="$NBUFFER[Wait_Duration]" anim="stand" /> | <wait duration="$NBUFFER[Wait_Duration]" anim="stand" /> | ||
First buffers will be replaced than keywords will be replaced. | |||
== Bufferes that wil be replaced == | |||
Bufferes will be replaced first. This allows keywords in the buffers. | |||
{| | {| | ||
!Keyword | !Keyword | ||
Line 16: | Line 19: | ||
|- | |- | ||
|$NBUFFER[x] | |$NBUFFER[x] | ||
|Replace with the value from the NPC buffers | |Replace with the value from the NPC buffers that is set by the [[Tribe Scripting]] [[Tribe_Scripting#SetBuffer|SetBuffer algorithm]] or the [[Behavior_Operations#Set_Buffer_Operation|Set Buffer Operation]]. | ||
|- | |- | ||
|$TBUFFER[x] | |$TBUFFER[x] | ||
|Replace with the value from the Tribe buffers | |Replace with the value from the Tribe buffers that is set by the [[Tribe Scripting]] [[Tribe_Scripting#SetBuffer|SetBuffer algorithm]] or the [[Behavior_Operations#Set_Buffer_Operation|Set Buffer Operation]]. | ||
|- | |- | ||
|} | |} | ||
Keywords that will be replaced. | == Keywords that will be replaced == | ||
The following keywords are replaced in strings used in the NPC Client Scripting. | |||
{| | {| | ||
Line 31: | Line 36: | ||
|$name | |$name | ||
|Replaced with the name of the NPC. | |Replaced with the name of the NPC. | ||
|- | |||
|$perception_type | |||
|The type of the last perception. | |||
|- | |- | ||
|$owner | |$owner | ||
|If npc is a pet, replaced with the name of the owner | |If npc is a pet, replaced with the name of the owner | ||
|- | |- | ||
|$race | |$race | ||
|Replaced with the race of the NPC. | |Replaced with the race of the NPC. | ||
|- | |||
|$race_size | |||
|Replaced with the size of the NPC. | |||
|- | |- | ||
|$target | |$target | ||
|Replaced with the name of the current target. | |Replaced with the name of the current target. | ||
|- | |||
|} | |||
== Additional Keywords that will be replaced for tribes == | |||
The following keywords are replaced in strings used in the NPC Client Scripting if the NPC is part of a tribe. | |||
{| | |||
!Keyword | |||
!Description | |||
|- | |||
|$member_type | |||
|Replace with the npc tribe member type. | |||
|- | |||
|$resource_area | |||
|Replace with the npc tribe resource area type. | |||
|- | |- | ||
|$tribe | |$tribe | ||
Line 49: | Line 73: | ||
|} | |} | ||
[[Category:NPCClient Design]] | == Boolean types == | ||
Some script require boolean as output. They will be deamed true if the string resolve to either "true" or "yes". | |||
Example: | |||
<set_buffer buffer="Region" value="true" /> | |||
<melee outside_region="$NBUFFER[Region]" /> | |||
[[Category:NPCClient Design]] [[Category:NPCClient Scripting]] |
Latest revision as of 22:19, 25 December 2013
For both Behavior Operations and Tribe Scripting some of the fields are parsed for keywords and values replaced before use.
NPC Variables allow for scripting where keywords are replaced in strings.
This allows for generic scripting like:
<talk text="My name is $name" /> <wait duration="$NBUFFER[Wait_Duration]" anim="stand" />
First buffers will be replaced than keywords will be replaced.
Bufferes that wil be replaced
Bufferes will be replaced first. This allows keywords in the buffers.
Keyword | Description |
---|---|
$NBUFFER[x] | Replace with the value from the NPC buffers that is set by the Tribe Scripting SetBuffer algorithm or the Set Buffer Operation. |
$TBUFFER[x] | Replace with the value from the Tribe buffers that is set by the Tribe Scripting SetBuffer algorithm or the Set Buffer Operation. |
Keywords that will be replaced
The following keywords are replaced in strings used in the NPC Client Scripting.
Keyword | Description |
---|---|
$name | Replaced with the name of the NPC. |
$perception_type | The type of the last perception. |
$owner | If npc is a pet, replaced with the name of the owner |
$race | Replaced with the race of the NPC. |
$race_size | Replaced with the size of the NPC. |
$target | Replaced with the name of the current target. |
Additional Keywords that will be replaced for tribes
The following keywords are replaced in strings used in the NPC Client Scripting if the NPC is part of a tribe.
Keyword | Description |
---|---|
$member_type | Replace with the npc tribe member type. |
$resource_area | Replace with the npc tribe resource area type. |
$tribe | If npc is part of a tribe, replaced with the tribes name. |
Boolean types
Some script require boolean as output. They will be deamed true if the string resolve to either "true" or "yes".
Example:
<set_buffer buffer="Region" value="true" /> <melee outside_region="$NBUFFER[Region]" />