Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.RuntimeVariables Class Reference
Inheritance diagram for AC.RuntimeVariables:

Public Member Functions

void OnInitPersistentEngine ()
 
void TransferFromManager ()
 
SpeechLog[] GetSpeechLog ()
 Gets the game's speech log. More...
 
void ClearSpeechLog ()
 
void AddToSpeechLog (SpeechLog _line)
 Adds a speech line to the game's speech log. More...
 
void SetCustomToken (int _ID, string _replacementText)
 Creates a new custom token, or replaces it if one with the same ID number already exists. More...
 
void ClearCustomTokens ()
 Removes all custom tokens from the game. More...
 
string ConvertCustomTokens (string _text)
 Replaces the supplied string with the replacementText of any defined CustomToken classes. More...
 
void AssignCustomTokensFromString (string tokenData)
 Re-assigns the CustomToken variables from a saved string. More...
 
void AssignOptionsLinkedVariables ()
 Transfers the values of all option-linked global variables from the options data into the variables.
 
MainData SaveMainData (MainData mainData)
 Updates a MainData class with its own variables that need saving. More...
 
void AssignFromPreset (VarPreset varPreset, bool ignoreOptionLinked=false)
 Assigns all Global Variables to preset values. More...
 
void AssignFromPreset (int varPresetID, bool ignoreOptionLinked=false)
 Assigns all Glocal Variables to preset values. More...
 
VarPreset GetPreset (int varPresetID)
 Gets a Global Variable preset with a specific ID number. More...
 

Public Attributes

List< GVarglobalVars = new List<GVar>()
 

Protected Member Functions

string GetCustomTokensAsString ()
 
void LinkAllValues ()
 

Protected Attributes

List< CustomTokencustomTokens = new List<CustomToken>()
 
List< SpeechLogspeechLines = new List<SpeechLog>()
 
string[] textEventTokenKeys = new string[0]
 

Properties

string[] TextEventTokenKeys [get, set]
 

Detailed Description

Stores the game's global variables at runtime, as well as the speech log. This component should be attached to the PersistentEngine prefab.

Member Function Documentation

◆ AddToSpeechLog()

void AC.RuntimeVariables.AddToSpeechLog ( SpeechLog  _line)

Adds a speech line to the game's speech log.

Parameters
_lineThe SpeechLog variable to add

◆ AssignCustomTokensFromString()

void AC.RuntimeVariables.AssignCustomTokensFromString ( string  tokenData)

Re-assigns the CustomToken variables from a saved string.

Parameters
savedStringThe string that contains the CustomToken variables data

◆ AssignFromPreset() [1/2]

void AC.RuntimeVariables.AssignFromPreset ( int  varPresetID,
bool  ignoreOptionLinked = false 
)

Assigns all Glocal Variables to preset values.

Parameters
varPresetIDThe ID number of the VarPreset that contains the preset values
ignoreOptionLinkedIf True, then variables linked to Options Data will not be affected

◆ AssignFromPreset() [2/2]

void AC.RuntimeVariables.AssignFromPreset ( VarPreset  varPreset,
bool  ignoreOptionLinked = false 
)

Assigns all Global Variables to preset values.

Parameters
varPresetThe VarPreset that contains the preset values
ignoreOptionLinkedIf True, then variables linked to Options Data will not be affected

◆ ClearCustomTokens()

void AC.RuntimeVariables.ClearCustomTokens ( )

Removes all custom tokens from the game.

◆ ClearSpeechLog()

void AC.RuntimeVariables.ClearSpeechLog ( )

Clears the game's speech log.

◆ ConvertCustomTokens()

string AC.RuntimeVariables.ConvertCustomTokens ( string  _text)

Replaces the supplied string with the replacementText of any defined CustomToken classes.

Parameters
_textThe supplied string that may contain tokens of the form '[token:ID]'
Returns
The supplied string with any tokens replaced with the appropriate CustomToken's replacementText

◆ GetPreset()

VarPreset AC.RuntimeVariables.GetPreset ( int  varPresetID)

Gets a Global Variable preset with a specific ID number.

Parameters
varPresetIDThe ID number of the VarPreset
Returns
The Global Variable preset

◆ GetSpeechLog()

SpeechLog [] AC.RuntimeVariables.GetSpeechLog ( )

Gets the game's speech log.

Returns
An array of SpeechLog variables

◆ OnInitPersistentEngine()

void AC.RuntimeVariables.OnInitPersistentEngine ( )

Links all variables to their linked counterpart.

◆ SaveMainData()

MainData AC.RuntimeVariables.SaveMainData ( MainData  mainData)

Updates a MainData class with its own variables that need saving.

Parameters
mainDataThe original MainData class
Returns
The updated MainData class

◆ SetCustomToken()

void AC.RuntimeVariables.SetCustomToken ( int  _ID,
string  _replacementText 
)

Creates a new custom token, or replaces it if one with the same ID number already exists.

Parameters
_IDThe token's unique identifier
_replacementTextThe token's replacement text.

◆ TransferFromManager()

void AC.RuntimeVariables.TransferFromManager ( )

Downloads variables from the Global Manager to the scene.

Member Data Documentation

◆ globalVars

List<GVar> AC.RuntimeVariables.globalVars = new List<GVar>()

The List of the game's global variables.

Property Documentation

◆ TextEventTokenKeys

string [] AC.RuntimeVariables.TextEventTokenKeys
getset

An array of string keys that can be inserted into text fields in the form [key:value]. When processed, they will be removed from the text, but will trigger the OnRequestTextTokenReplacement event.