Dialogues/ScriptInstructions

From SF3
< Dialogues
Revision as of 15:43, 6 October 2016 by Dave (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Dialogue fragments can execute script instructions upon being reached.

Structure of an Instruction

An instruct is a single line of text in the following format:

 Type: Expression

where Type is one of the following:

  • Call: Call a given script function from the level script
  • Set: Set the value of a variable

If the Type: part of the condition is omitted, it is assumed to be Call:.

Function Call Instructions

For function call instructions, Expression must be the name of a function in the level script which takes no arguments.
The function will be called, that's it.

Examples:

 Call: OnSomeCoolEvent
 OnSomeCoolEvent

Set Instruction

For set instructions, Expression must be of the format:

 VariableName = SubExpression

where VariableName is the name of a global variable (e.g. SomeState.bSomeValue) and SubExpression is a mathematical or logical expression.

Some examples of valid set instructions are:

 Set: SomeState.bSomeValue = true                         // Set value to true
 Set: SomeState.bSomeValue = ! SomeState.bSomeOtherValue  // Set value to the opposite of SomeState.bSomeOtherValue
 Set: SomeState.iSomeNumber = SomeState.iSomeNumber + 1   // Increment some number by 1

Multiple Instructions

Multiple instructions may be provided for a single fragment, each instruction separated by a comma.

Dialogue fragments can execute script instructions upon being reached.

Structure of an Instruction

An instruct is a single line of text in the following format:

 Type: Expression

where Type is one of the following:

  • Call: Call a given script function from the level script
  • Set: Set the value of a variable

If the Type: part of the condition is omitted, it is assumed to be Call:.

Function Call Instructions

For function call instructions, Expression must be the name of a function in the level script which takes no arguments.
The function will be called, that's it.

Examples:

 Call: OnSomeCoolEvent
 OnSomeCoolEvent

Set Instruction

For set instructions, Expression must be of the format:

 VariableName = SubExpression

where VariableName is the name of a global variable (e.g. SomeState.bSomeValue) and SubExpression is a mathematical or logical expression.

Some examples of valid set instructions are:

 Set: SomeState.bSomeValue = true                         // Set value to true
 Set: SomeState.bSomeValue = ! SomeState.bSomeOtherValue  // Set value to the opposite of SomeState.bSomeOtherValue
 Set: SomeState.iSomeNumber = SomeState.iSomeNumber + 1   // Increment some number by 1

Multiple Instructions

Multiple instructions may be provided for a single fragment, each instruction separated by a comma.