Class: CPhraseScript
Script rules attached to a dialog phrase.
Source
C++ class CPhraseScript
Custom Constructor
CPhraseScript
Remarks
Phrase scripts are evaluated by the dialog engine against the current actor/NPC speakers. Info portion checks use the actor info registry.
Constructors
Constructor
new CPhraseScript(): CPhraseScript;Returns
CPhraseScript
Methods
AddAction()
AddAction(function_name: string): void;Run a script action after the phrase is spoken.
Parameters
| Parameter | Type | Description |
|---|---|---|
function_name | string | Script function name. |
Returns
void
Remarks
In active two-speaker dialogs the function receives (speaker, listener, dialog_id, phrase_id). In simpler dialog checks it receives (speaker, dialog_id).
Throws
If the function name cannot be resolved.
AddDisableInfo()
AddDisableInfo(info_portion: string): void;Disable an info portion when phrase actions run.
Parameters
| Parameter | Type | Description |
|---|---|---|
info_portion | string | Info portion id. |
Returns
void
Remarks
Applied after the phrase is accepted and its actions run.
AddDontHasInfo()
AddDontHasInfo(info_portion: string): void;Require an info portion to be absent before the phrase is available.
Parameters
| Parameter | Type | Description |
|---|---|---|
info_portion | string | Info portion id. |
Returns
void
AddGiveInfo()
AddGiveInfo(info_portion: string): void;Give an info portion when phrase actions run.
Parameters
| Parameter | Type | Description |
|---|---|---|
info_portion | string | Info portion id. |
Returns
void
Remarks
Applied after the phrase is accepted and its actions run.
AddHasInfo()
AddHasInfo(info_portion: string): void;Require an info portion before the phrase is available.
Parameters
| Parameter | Type | Description |
|---|---|---|
info_portion | string | Info portion id. |
Returns
void
AddPrecondition()
AddPrecondition(function_name: string): void;Add a script predicate checked before the phrase is available.
Parameters
| Parameter | Type | Description |
|---|---|---|
function_name | string | Script function name. |
Returns
void
Remarks
In active two-speaker dialogs the function receives (speaker, listener, dialog_id, phrase_id, next_phrase_id). It should return true when the phrase may be shown.
Throws
If the function name cannot be resolved.
SetScriptText()
SetScriptText(function_name: string): void;Use a script function to provide phrase text.
Parameters
| Parameter | Type | Description |
|---|---|---|
function_name | string | Script function name. |
Returns
void
Remarks
The function is called when the dialog asks for phrase text. Use it for text that depends on the current speaker or dialog state.
Throws
If the function name cannot be resolved.