ScriptedValueRegistry

The scriped value registry is an object that may be used by scripts to store persistent values across game environments. It may be used by campaign and battle scripts to pass simple messages between one another, which is otherwise difficult to achieve.

The scripted value registry provides three methods of storing values. Values saved using game session functions are cleared when loading into a new campaign, or when loading back into the frontend. Values saved using persistent functions are not cleared until the game shuts down. Finally, values saved into the operating system registry are never cleared.

The internal mapping for each set of values is different, so a value saved using ScriptedValueRegistry:SaveBool cannot be loaded using ScriptedValueRegistry:LoadPersistentBool, for example.

Loaded in Battle loaded in battle
Loaded in Campaign loaded in campaign
Loaded in Frontend loaded in frontend
Back to top

Creation

ScriptedValueRegistry:new()

Creates and returns a handle to the scripted value registry.

Returns:

  1. scriptedvalueregistry svr
Back to top

Usage

Once a scripted value registry has been created, functions may be called on it in the following form.

Example - Specification:

<object_name>:<function_name>(<args>)

Example - Creation and Usage:

svr = ScriptedValueRegistry:new()
svr:SaveBool("test_value", true)        -- calling a function on the object once created
Back to top

Game Session Registry

Values saved using these functions will be cleared whenever loading into a new campaign, or whenever the frontend is loaded.

ScriptedValueRegistry:SaveBool(string value name, boolean value)

Saves a boolean value with a string name into the scripted value registry.

Parameters:

1

string

value name

2

boolean

value

Returns:

  1. nil

ScriptedValueRegistry:LoadBool(string value name)

Returns a boolean value that was previously stored with ScriptedValueRegistry:SaveBool, by name. If no value with the supplied name is found then false is returned.

Parameters:

1

string

value name

Returns:

  1. boolean value

ScriptedValueRegistry:SaveString(string value name, string value)

Saves a string value with a string name into the scripted value registry.

Parameters:

1

string

value name

2

string

value

Returns:

  1. nil

ScriptedValueRegistry:LoadString(string value name)

Returns a string value previously stored with ScriptedValueRegistry:SaveString, by name. If no value with the supplied name is found then an empty string is returned.

Parameters:

1

string

value name

Returns:

  1. string value
Back to top

Persistent Registry

Values saved using these functions will only be cleared when the game is shut down and reloaded.

ScriptedValueRegistry:SavePersistentBool(string value name, boolean value)

Saves a boolean value with a string name into the persistent registry.

Parameters:

1

string

value name

2

boolean

value

Returns:

  1. nil

ScriptedValueRegistry:LoadPersistentBool(string value name)

Returns a persistent boolean value previously stored with ScriptedValueRegistry:SavePersistentBool, by name. If no persistent value with the supplied name is found then false is returned.

Parameters:

1

string

value name

Returns:

  1. boolean value

ScriptedValueRegistry:SavePersistentString(string value name, string value)

Saves a string value with a string name into the persistent registry.

Parameters:

1

string

value name

2

string

value

Returns:

  1. nil

ScriptedValueRegistry:LoadPersistentString(string value name)

Returns a persistent string value previously stored with ScriptedValueRegistry:SavePersistentString, by name. If no persistent value with the supplied name is found then an empty string is returned.

Parameters:

1

string

value name

Returns:

  1. string value
Back to top

Operating System Registry

The functions in this section can be used to store and retrieve values from the operating system registry. Values saved here remain persistent between reloads of the game. No path within the registry may be specified.

ScriptedValueRegistry:SaveRegistryBool(string value name, boolean value)

Saves a boolean value with a string name into the operating system registry.

Parameters:

1

string

value name

2

boolean

value

Returns:

  1. nil

ScriptedValueRegistry:LoadRegistryBool(string value name)

Returns a boolean value previously stored with ScriptedValueRegistry:SaveRegistryBool, by name. If no persistent value with the supplied name is found then false is returned.

Parameters:

1

string

value name

Returns:

  1. boolean value
Last updated 07/02/21 06:39:14