Difference between revisions of "Dialogues/ScriptInstructions"

From SF3
Jump to: navigation, search
(Created page with "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: E...")
 
Line 13: Line 13:
 
For function call instructions, ''Expression'' must be the name of a function in the level script which takes no arguments. <br/>
 
For function call instructions, ''Expression'' must be the name of a function in the level script which takes no arguments. <br/>
 
The function will be called, that's it.
 
The function will be called, that's it.
 +
 +
Examples:
 +
  Call: OnSomeCoolEvent
 +
  OnSomeCoolEvent
  
 
===Set Instruction===
 
===Set Instruction===

Revision as of 15:31, 6 October 2016

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

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.

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