Core.GetFloat

Parses the declared Variable name in the SILVIA Core and attempts to return a float value, i.e. a number with a decimal place potentially. All SILVIA Core Variables are “tokenized” with string names beginning “$”. This allows the Variables to be used in Absorbers and Exuders, e.g. if a Core Variable “$keyword” is set with the value “AI”, an Absorber or Exuder using the text “$keyword” will either expect the input “AI”, or speak “AI”.

Description

SILVIA Cores can store variables in by Variable Name and Value. Variables in SILVIA are all named by strings starting with “$”. Variables with names beginning “$_” are sorted into the System Variables side of the State Monitor, whereas Variables with names beginning “$” without an underscore are sorted into the Trainer Variables side of the State Monitor.

Example Usage (C#)


//Suppose value "87.5" was stored in the SILVIA Core under "$temperature"
float temperature = Core.GetVariable("$temperature", false);

Parameters

string

variableName

The name of the Variable to store in the SILVIA Core. Always declare Variable names beginning with “$”.

bool

randomResult

The boolean flag whether to randomly retrieve a value within the Variable. If the Variable has been set additively, one of the results will be returned at random.

Returns
The float value of the given SILVIA Core Variable, if any can be parsed. Returns a -1 if a float cannot be parsed from the Variable value.

The float value of the given SILVIA Core Variable, if any can be parsed. Returns a -1 if a float cannot be parsed from the Variable value.

See Also

  • Core.SetVariable
  • Core.GetVariable
  • Core.GetInt