Skip to content

Scripting dynamic utils

kromster80 edited this page Jul 30, 2024 · 22 revisions

Utils

Version column description:
"-" Means this util was added from the start.
"5678" Means this util was introduced in revision 5678.
"-5678" Means this util was removed in revision 5678.



Ver
sion
Utility function
description
Parameters
and types
Returns
5422 AbsI
Returns absolute value of specified integer
aValue: Integer; Integer
5422 AbsS
Returns absolute value of specified single number
aValue: Single; Single
15066 ArrayAppend
Appends value to an array of string and returns new array.
String array should be declared as TKMStringArray instead of "array of string".
var aArray: TKMStringArray;
aValue: string;
15066 ArrayAppendI
Appends value to an array of integer and returns new array.
Integer array should be declared as TKMIntegerArray instead of "array of integer".
var aArray: TKMIntegerArray;
aValue: Integer;
15066 ArrayAppendS
Appends value to an array of single and returns new array.
Single array should be declared as TKMSingleArray instead of "array of single".
var aArray: TKMSingleArray;
aValue: Single;
5422 ArrayElementCount
Removed
Method was removed, use ArrayElementCount instead
aArray: array of String;
aElement: string;
Integer
15136 ArrayElementCount
Checks how many times specified string comes in requested array
aArray: array of String;
aElement: string;
Integer
5422 ArrayElementCountI
Removed
Method was removed, use ArrayElementCountI instead
aArray: array of Integer;
aElement: Integer;
Integer
15136 ArrayElementCountI
Checks how many times specified integer comes in requested array
aArray: array of Integer;
aElement: Integer;
Integer
5422 ArrayElementCountS
Removed
Method was removed, use ArrayElementCountS instead
aArray: array of Single;
aElement: Single;
Integer
15136 ArrayElementCountS
Checks how many times specified single comes in requested array
aArray: array of Single;
aElement: Single;
Integer
15136 ArrayFindMaxI
Returns max number of array elements
aArray: array of Integer; Integer
15136 ArrayFindMaxS
Returns max number of array elements
aArray: array of Single; Single
15136 ArrayFindMinI
Returns min number of array elements
aArray: array of Integer; Integer
15136 ArrayFindMinS
Returns min number of array elements
aArray: array of Single; Single
5422 ArrayHasElement
Removed
Method was removed, use ArrayHasElement instead
aArray: array of String;
aElement: string;
Boolean
15136 ArrayHasElement
Checks whether requested array has specified string
aArray: array of String;
aElement: string;
Boolean
5422 ArrayHasElementI
Removed
Method was removed, use ArrayHasElementI instead
aArray: array of Integer;
aElement: Integer;
Boolean
15136 ArrayHasElementI
Checks whether requested array has specified integer
aArray: array of Integer;
aElement: Integer;
Boolean
5422 ArrayHasElementS
Removed
Method was removed, use ArrayHasElementS instead
aArray: array of Single;
aElement: Single;
Boolean
15136 ArrayHasElementS
Checks whether requested array has specified single number
aArray: array of Single;
aElement: Single;
Boolean
15136 ArraySumI
Returns sum of the elements of requested array
aArray: array of Integer; Integer
15136 ArraySumS
Returns sum of the elements of requested array
aArray: array of Single; Single
14387 ColorFromHSB
Create RGB color from Hue, Saturation and Volume
Hue goes from 0.0 to 1.0 (RoyG.Biv)
Saturation goes from 0.0 to 1.0 (Grey to Colorful)
Brightness goes from 0.0 to 1.0 (Black to Bright to White)
Returns RGB color value
H: Single;
S: Single;
B: Single;
Integer
14387 ColorFromHSV
Create RGB color from Hue, Saturation and Volume
Hue goes from 0.0 to 1.0 (RoyG.Biv)
Saturation goes from 0.0 to 1.0 (Grey to Colorful)
Volume goes from 0.0 to 1.0 (Black to Bright)
Returns RGB color value
H: Single;
S: Single;
V: Single;
Integer
14387 ColorFromRGB
Create RGB color from Red, Green and Blue components
All values need to be in the range 0.0 to 1.0
Returns RGB color value
R: Single;
G: Single;
B: Single;
Integer
14363 DistanceI
Returns the length of the vector. Sqrt(x * x + y * y)
aX, aY: Integer; Single
14363 DistanceS
Returns the length of the vector. Sqrt(x * x + y * y)
aX, aY: Single; Single
5422 EnsureRangeI
Returns the closest to aValue integer that is in interval [aMin..aMax]
aValue: Integer;
aMin, aMax: Integer;
Integer
5422 EnsureRangeS
Returns the closest to aValue single number that is in interval [aMin..aMax]
aValue: Single;
aMin, aMax: Single;
Single
5422 Format
Wrapper for pascal Format function
Formats aFormat string with specified aArgs array of arguments
aFormat: string;
aArgs: array of const;
string
5422 HexToInt
Converts hex string into a number
aHexString: string; // should be in form "1234AB", without $ or 0x prefix Integer
5422 IfThen
Checks condition aBool and returns aTrue/aFalse string depending on check result
aBool: Boolean;
aTrue: string;
aFalse: string;
string
5422 IfThenI
Checks condition aBool and returns aTrue/aFalse integer depending on check result
aBool: Boolean;
aTrue: Integer;
aFalse: Integer;
Integer
5422 IfThenS
Checks condition aBool and returns aTrue/aFalse single number depending on check result
aBool: Boolean;
aTrue: Single;
aFalse: Single;
Single
5422 InAreaI
2D variant of InRange, can be used for unit locs checks
aX, aY: Integer;
aXMin: Integer;
aYMin: Integer;
aXMax: Integer;
aYMax: Integer;
Boolean
5422 InAreaS
2D variant of InRange
aX, aY: Single;
aXMin: Single;
aYMin: Single;
aXMax: Single;
aYMax: Single;
Boolean
5422 InRangeI
Checks whether specified aValue is in interval [aMin..aMax]
aValue: Integer;
aMin, aMax: Integer;
Boolean
5422 InRangeS
Checks whether specified aValue is in interval [aMin..aMax]
aValue: Single;
aMin, aMax: Single;
Boolean
14995 Lerp
Interpolates linearly between A and B.
The function will work with any value of aFraction, but usually it must be between 0.0 and 1.0
A, B: Single;
aFrac: Single;
Single
14995 LerpXY
Interpolates linearly between two sets of X and Y values.
The function will work with any value of aFrac, but usually it must be between 0.0 and 1.0
aX1: Single;
aX2: Single;
aY1: Single;
aY2: Single;
aFracX: Single;
aFracY: Single;
Single
14995 MapRange
Maps a value proportionally from one range to another
aValue: Single;
aFromMin: Single;
aFromMax: Single;
aToMin: Single;
aToMax: Single;
Single
5422 MaxI
Returns max number of two specified
A, B: Integer; Integer
5422 MaxInArrayI
Removed
Method was removed, use ArrayFindMaxI instead
aArray: array of Integer; Integer
5422 MaxInArrayS
Removed
Method was removed, use ArrayFindMaxS instead
aArray: array of Single; Single
5422 MaxS
Returns max number of two specified
A, B: Single; Single
5422 MinI
Returns min number of two specified
A, B: Integer; Integer
5422 MinInArrayI
Removed
Method was removed, use ArrayFindMinI instead
aArray: array of Integer; Integer
5422 MinInArrayS
Removed
Method was removed, use ArrayFindMinS instead
aArray: array of Single; Single
5422 MinS
Returns min number of two specified
A, B: Single; Single
5422 Power
Exponentation, returns base "aBase" raised to power "aExp". F.e. Power(3, 2) = 3^2 = 9
aBase: Extended;
aExp: Extended;
Extended
6683 Random
Returns random float within 0..1
Single
6683 RandomI
Returns random integer within 0..aMax-1
aMax: Integer; Integer
5422 Sqr
Returns A^2 = A*A
A: Extended; Extended
5422 SumI
Removed
Method was removed, use ArraySumI instead
aArray: array of Integer; Integer
5422 SumS
Removed
Method was removed, use ArraySumS instead
aArray: array of Single; Single
5422 TimeToString
Converts game ticks count into string: HH:MM:SS
Can be used for scripted timers
aTicks: Integer; string