GetLocalFloat

From NWN Lexicon
Revision as of 00:29, 26 August 2012 by Dood (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search



GetLocalFloat(object, string)

Get the value of a decimal number stored on an object.

float GetLocalFloat(
    object oObject,
    string sVarName
);

Parameters

oObject

The object that stores the decimal number.

sVarName

The variable name of the data.


Description

Returns data contained inside the variable sVarName stored on the object oObject. oObject can be any object in the game world.

The string describing the variable can also be any string in theory but it is suggested that you avoid using the NW_* tags as they tend to be used within the game already. This function must be used in conjunction with its counterpart function SetLocalFloat, as this is the main way to adjust the values held in the variable sVarName. On error the function will return 0.0f.



Remarks

This is most useful for getting ranges (which are distances in in-game meters) or times (in seconds and milliseconds). If the value doesn't need a decimal point, it would be better to use Get/SetLocalInt instead.


Version

1.22

Example

// Returns the float stored in "Data"
void main()
{
    float a = GetLocalFloat(OBJECT_SELF,"Data");
    SendMessageToPC(GetFirstPC(),FloatToString(a));
}

See Also

functions: 

SetLocalFloat



 author: GoLeM, editor: Jasperre, additional contributor(s): Kristain Markon, Jasperre