Skip to content

Class: MockPhraseScript ​

Mock of the X-Ray engine dialog CPhraseScript.

Implements ​

  • CPhraseScript

Constructors ​

Constructor ​

ts
new MockPhraseScript(): MockPhraseScript;

Returns ​

MockPhraseScript

Methods ​

AddAction() ​

ts
AddAction(action: string): void;

Run a script action after the phrase is spoken.

Parameters ​

ParameterType
actionstring

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 ​

ts
CPhraseScript.AddAction

AddDisableInfo() ​

ts
AddDisableInfo(infoPortion: string): void;

Disable an info portion when phrase actions run.

Parameters ​

ParameterType
infoPortionstring

Returns ​

void

Remarks ​

Applied after the phrase is accepted and its actions run.

Implementation of ​

ts
CPhraseScript.AddDisableInfo

AddDontHasInfo() ​

ts
AddDontHasInfo(infoPortion: string): void;

Require an info portion to be absent before the phrase is available.

Parameters ​

ParameterType
infoPortionstring

Returns ​

void

Implementation of ​

ts
CPhraseScript.AddDontHasInfo

AddGiveInfo() ​

ts
AddGiveInfo(infoPortion: string): void;

Give an info portion when phrase actions run.

Parameters ​

ParameterType
infoPortionstring

Returns ​

void

Remarks ​

Applied after the phrase is accepted and its actions run.

Implementation of ​

ts
CPhraseScript.AddGiveInfo

AddHasInfo() ​

ts
AddHasInfo(infoPortion: string): void;

Require an info portion before the phrase is available.

Parameters ​

ParameterType
infoPortionstring

Returns ​

void

Implementation of ​

ts
CPhraseScript.AddHasInfo

AddPrecondition() ​

ts
AddPrecondition(precondition: string): void;

Add a script predicate checked before the phrase is available.

Parameters ​

ParameterType
preconditionstring

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 ​

ts
CPhraseScript.AddPrecondition

SetScriptText() ​

ts
SetScriptText(text: string): void;

Use a script function to provide phrase text.

Parameters ​

ParameterType
textstring

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 ​

ts
CPhraseScript.SetScriptText

create() ​

ts
static create(config?: IMockPhraseScriptConfig): MockPhraseScript;

Parameters ​

ParameterType
configIMockPhraseScriptConfig

Returns ​

MockPhraseScript


mock() ​

ts
static mock(config?: IMockPhraseScriptConfig): CPhraseScript;

Parameters ​

ParameterType
configIMockPhraseScriptConfig

Returns ​

CPhraseScript

Properties ​

actions ​

ts
actions: string[] = [];

disabledInfoPortions ​

ts
disabledInfoPortions: string[] = [];

excludedInfoPortions ​

ts
excludedInfoPortions: string[] = [];

givenInfoPortions ​

ts
givenInfoPortions: string[] = [];

preconditions ​

ts
preconditions: string[] = [];

requiredInfoPortions ​

ts
requiredInfoPortions: string[] = [];

text ​

ts
text: string | null = null;