Both sides previous revision Previous revision Next revision | Previous revision | ||
hpl2:tutorials:script:localandglobalvariables [2011/07/13 20:01] kyle |
hpl2:tutorials:script:localandglobalvariables [2011/07/14 12:45] (current) kyle |
||
---|---|---|---|
Line 23: | Line 23: | ||
- | <code cpp> | + | <code cpp>void OnStart() |
- | void OnStart() | + | |
{ | { | ||
SetLocalVarInt("Var01", 0); | SetLocalVarInt("Var01", 0); | ||
Line 63: | Line 62: | ||
int GetLocalVarInt(string& asName); | int GetLocalVarInt(string& asName); | ||
</code> | </code> | ||
+ | |||
+ | |||
<code c++>void SetLocalVarFloat(string& asName, float afVal); | <code c++>void SetLocalVarFloat(string& asName, float afVal); | ||
void AddLocalVarFloat(string& asName, float afVal); | void AddLocalVarFloat(string& asName, float afVal); | ||
float GetLocalVarFloat(string& asName); | float GetLocalVarFloat(string& asName); | ||
</code> | </code> | ||
+ | |||
+ | |||
<code c++>void SetLocalVarString(string& asName, const string& asVal); | <code c++>void SetLocalVarString(string& asName, const string& asVal); | ||
void AddLocalVarString(string& asName, string& asVal); | void AddLocalVarString(string& asName, string& asVal); | ||
Line 83: | Line 86: | ||
int GetGlobalVarInt(string& asName); | int GetGlobalVarInt(string& asName); | ||
</code> | </code> | ||
+ | |||
+ | |||
<code c++>void SetGlobalVarFloat(string& asName, float afVal); | <code c++>void SetGlobalVarFloat(string& asName, float afVal); | ||
void AddGlobalVarFloat(string& asName, float afVal); | void AddGlobalVarFloat(string& asName, float afVal); | ||
float GetGlobalVarFloat(string& asName); | float GetGlobalVarFloat(string& asName); | ||
</code> | </code> | ||
+ | |||
+ | |||
<code c++>void SetGlobalVarString(string& asName, const string& asVal); | <code c++>void SetGlobalVarString(string& asName, const string& asVal); | ||
void AddGlobalVarString(string& asName, string& asVal); | void AddGlobalVarString(string& asName, string& asVal); | ||
Line 93: | Line 100: | ||
- | The Set___Var___ is used to set the variable's value. The Add___Var___ is used to add the given number or letter(s) to the value of the existing variable. The Get___Var___ is used when checking the value of the variable. | + | The Set-Var- is used to set the variable's value. The Add-Var- is used to add the given number or letter(s) to the value of the existing variable. The GetVaris used when checking the value of the variable. |
+ | |||
+ | |||
+ | **This wiki entry has been made by Kyle S. If you have any comments or need help with this, send me a private message on the Frictional Games Forum. (My name on there is Kyle)** | ||