Class: MockPhraseScript
Mock of the X-Ray engine dialog CPhraseScript.
Implements
CPhraseScript
Constructors
Constructor
new MockPhraseScript(): MockPhraseScript;Returns
MockPhraseScript
Methods
AddAction()
AddAction(action: string): void;Run a script action after the phrase is spoken.
Parameters
| Parameter | Type |
|---|---|
action | string |
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.
Implementation of
CPhraseScript.AddActionAddDisableInfo()
AddDisableInfo(infoPortion: string): void;Disable an info portion when phrase actions run.
Parameters
| Parameter | Type |
|---|---|
infoPortion | string |
Returns
void
Remarks
Applied after the phrase is accepted and its actions run.
Implementation of
CPhraseScript.AddDisableInfoAddDontHasInfo()
AddDontHasInfo(infoPortion: string): void;Require an info portion to be absent before the phrase is available.
Parameters
| Parameter | Type |
|---|---|
infoPortion | string |
Returns
void
Implementation of
CPhraseScript.AddDontHasInfoAddGiveInfo()
AddGiveInfo(infoPortion: string): void;Give an info portion when phrase actions run.
Parameters
| Parameter | Type |
|---|---|
infoPortion | string |
Returns
void
Remarks
Applied after the phrase is accepted and its actions run.
Implementation of
CPhraseScript.AddGiveInfoAddHasInfo()
AddHasInfo(infoPortion: string): void;Require an info portion before the phrase is available.
Parameters
| Parameter | Type |
|---|---|
infoPortion | string |
Returns
void
Implementation of
CPhraseScript.AddHasInfoAddPrecondition()
AddPrecondition(precondition: string): void;Add a script predicate checked before the phrase is available.
Parameters
| Parameter | Type |
|---|---|
precondition | string |
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.
Implementation of
CPhraseScript.AddPreconditionSetScriptText()
SetScriptText(text: string): void;Use a script function to provide phrase text.
Parameters
| Parameter | Type |
|---|---|
text | string |
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.
Implementation of
CPhraseScript.SetScriptTextcreate()
static create(): MockPhraseScript;Returns
MockPhraseScript
mock()
static mock(): CPhraseScript;Returns
CPhraseScript
Properties
actions
actions: string[] = [];disabledInfoPortions
disabledInfoPortions: string[] = [];excludedInfoPortions
excludedInfoPortions: string[] = [];givenInfoPortions
givenInfoPortions: string[] = [];preconditions
preconditions: string[] = [];requiredInfoPortions
requiredInfoPortions: string[] = [];text
text: string | null = null;