float RandFloat(float afMin, float afMax);
Generates a random float.
alMin - minimum value
alMax - maximum value
bool StringContains(string& asString, string& asSubString);
Checks whether a string contains the specified string.
Example: searching for “hello” in “hello world” would return true.
asString - the string to check
asSubString - the string to search for
string& StringSub(string& asString, int alStart, int alCount);
Returns the substring in a string.
Example: in the string “frictional games rocks”, using 4 as alStart and 6 as alCount would return “tional”.
asString - the string
alStart - start position in the string
alCount - amount of characters
int StringToInt(string&in asString);
:!: Requires 1.3
If possible, returns a string converted to an integer value, else returns 0.
asString - String to convert.
float StringToFloat(string&in asString);
:!: Requires 1.3
If possible, returns a string converted to a float value, else returns 0.
asString - String to convert.
bool StringToBool(string&in asString);
:!: Requires 1.3
If possible, returns a string converted to a boolean value, else returns false.
asString - String to convert.
Mathematical Operations
float MathSin(float afX);
:!: Requires 1.3
Returns the sine of the specified value.
afX - Value to operate.
float MathCos(float afX);
:!: Requires 1.3
Returns the cosine of the specified value.
afX - Value to operate.
float MathTan(float afX);
:!: Requires 1.3
Returns the tangent of the specified value.
afX - Value to operate.
float MathAsin(float afX);
:!: Requires 1.3
Returns the arc sine of the specified value.
afX - Value to operate.
float MathAcos(float afX);
:!: Requires 1.3
Returns the arc cosine of the specified value.
afX - Value to operate.
float MathAtan(float afX);
:!: Requires 1.3
Returns the arc tangent of the specified value.
afX - Value to operate.
float MathAtan2(float afX, float afY);
:!: Requires 1.3
Calculates and returns the arc tangent of the specified values.
afX - First value to operate.
afY - Second value to operate.
float MathSqrt(float afX);
:!: Requires 1.3
Returns the square root of the specified value.
afX - Value to operate.
float MathPow(float afBase, float afExp);
:!: Requires 1.3
Returns the value of afBase raised to the power of afExp.
afBase - The base value.
afExp - Value to calculate the base with.
float MathMin(float afA, float afB);
:!: Requires 1.3
Returns the lowest value.
afA - First value.
afB - Second value.
float MathMax(float afA, float afB);
:!: Requires 1.3
Returns the highest value.
afA - First value.
afB - Second value.
float MathClamp(float afX, float afMin, float afMax);
:!: Requires 1.3
Returns afX clamped between afMin and afMax. If afX < afMin, returns afMin, and if afX > afMax, returns afMax.
afX - The value to clamp.
afMin - The minimum value to clamp afX with.
afMax - The maximum value to clamp afX with.
float MathAbs(float afX);
:!: Requires 1.3
Returns the absolute value.
afX - Value to operate.
Debugging
void Print (string& asString);
Prints a string to the log.
void AddDebugMessage(string& asString, bool abCheckForDuplicates);
Prints a string to the debug console.
asString - the string to print
abCheckForDuplicates - if true, the string won't be printed more than once on screen until it disappears
void ProgLog(string& asLevel, string& asMessage);
?
asLevel - can be “Low”, “Medium” or “High”
asMessage - ?
bool ScriptDebugOn();
Checks whether the debug mode is enabled.
See Setting up Development Environment to setup debug mode on your own computer.
Variables
Local
Local variables can be used throughout the same script file.
void SetLocalVarInt(string& asName, int alVal);
void AddLocalVarInt(string& asName, int alVal);
int GetLocalVarInt(string& asName);
void SetLocalVarFloat(string& asName, float afVal);
void AddLocalVarFloat(string& asName, float afVal);
float GetLocalVarFloat(string& asName);
void SetLocalVarString(string& asName, const string& asVal);
void AddLocalVarString(string& asName, string& asVal);
string& GetLocalVarString(string& asName);
void ReplaceEntity(string &in asName, string &in asBodyName, string &in asNewEntityName, string &in asNewEntityFile, bool abFullGameSave);
:!: Requires 1.3
Removes an entity and places a new one in its place.
asName - Name of the entity to replace.
asBodyName - Name of the body of the entity to place the new entity at. If empty the first body is used (might be buggy, recommended to name a body anyway).
asNewEntityName - Name of the new entity.
asNewEntityFile - Name of the new entity file. Extension .ent.
abFullGameSave - Whether ALL properties of this entity should be saved throughout levels.
void PlaceEntityAtEntity(string &in asName, string &in asTargetEntity, string &in asTargetBodyName, bool abUseRotation);
:!: Requires 1.3
Places an entity at the position of another entity. Does not work for enemies, use TeleportEnemyToEntity instead.
asName - Name of the entity to place.
asTargetEntity - Name of the other entity to place the first entity at.
asTargetBodyName - Name of the body of the entity to place the first entity at. If empty the first body is used (might be buggy, recommended to name a body anyway).
abUseRotation - Whether the entity should be rotated like the target entity.
void SetEntityPos(string &in asName, float afX, float afY, float afZ);
:!: Requires 1.3
Moves an entity to a position in the level.
asName - Name of the entity to move.
afX - X co-ordinate position.
afY - Y co-ordinate position.
afZ - Z co-ordinate position.
float GetEntityPosX(string &in asName);
float GetEntityPosY(string &in asName);
float GetEntityPosZ(string &in asName;