Repository navigation
Scripting utils
kromster80 edited this page Sep 27, 2026
·
1 revision
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.
- AbsI
- AbsS
- ArrayAppend
- ArrayAppendI
- ArrayAppendS
- ❌ ArrayElementCount
- ArrayElementCount
- ❌ ArrayElementCountI
- ArrayElementCountI
- ❌ ArrayElementCountS
- ArrayElementCountS
- ArrayFindMaxI
- ArrayFindMaxS
- ArrayFindMinI
- ArrayFindMinS
- ❌ ArrayHasElement
- ArrayHasElement
- ❌ ArrayHasElementI
- ArrayHasElementI
- ❌ ArrayHasElementS
- ArrayHasElementS
- ArraySumI
- ArraySumS
- ColorFromHSB
- ColorFromHSV
- ColorFromRGB
- DistanceI
- DistanceS
- EnsureRangeI
- EnsureRangeS
- FMod
- Format
- HexToInt
- IfThen
- IfThenI
- IfThenS
- InAreaI
- InAreaS
- InRangeI
- InRangeS
- Lerp
- LerpXY
- MapRange
- MaxI
- ❌ MaxInArrayI
- ❌ MaxInArrayS
- MaxS
- MinI
- ❌ MinInArrayI
- ❌ MinInArrayS
- MinS
- Power
- Random
- RandomI
- Sqr
- ❌ SumI
- ❌ SumS
- TimeToString
| Ver sion |
Utility function description |
Parameters and types |
Returns |
|---|---|---|---|
| 5422 |
AbsI Returns absolute value of a given integer |
aValue: Integer; | Integer |
| 5422 |
AbsS Returns absolute value of a given single number |
aValue: Single; | Single |
| 15066 |
ArrayAppend Appends value to a given TKMStringArray |
var aArray: TKMStringArray; aValue: string; |
- |
| 15066 |
ArrayAppendI Appends value to a given TKMIntegerArray |
var aArray: TKMIntegerArray; aValue: Integer; |
- |
| 15066 |
ArrayAppendS Appends value to a given TKMSingleArray |
var aArray: TKMSingleArray; aValue: Single; |
- |
| 5422 |
ArrayElementCount ❌ RemovedMethod was removed, use ArrayElementCount instead |
aArray: TKMStringArray; aElement: string; |
Integer |
| 15136 |
ArrayElementCount Checks how many times a given string is repeated in a requested array |
aArray: TKMStringArray; aElement: string; |
Integer |
| 5422 |
ArrayElementCountI ❌ RemovedMethod was removed, use ArrayElementCountI instead |
aArray: TKMIntegerArray; aElement: Integer; |
Integer |
| 15136 |
ArrayElementCountI Checks how many times a given integer is repeated in a requested array |
aArray: TKMIntegerArray; aElement: Integer; |
Integer |
| 5422 |
ArrayElementCountS ❌ RemovedMethod was removed, use ArrayElementCountS instead |
aArray: TKMSingleArray; aElement: Single; |
Integer |
| 15136 |
ArrayElementCountS Checks how many times a given single is repeated in a requested array |
aArray: TKMSingleArray; aElement: Single; |
Integer |
| 15136 |
ArrayFindMaxI Returns the largest number found in a given array |
aArray: TKMIntegerArray; | Integer |
| 15136 |
ArrayFindMaxS Returns the largest number found in a given array |
aArray: TKMSingleArray; | Single |
| 15136 |
ArrayFindMinI Returns the smallest number found in a given array |
aArray: TKMIntegerArray; | Integer |
| 15136 |
ArrayFindMinS Returns the smallest number found in a given array |
aArray: TKMSingleArray; | Single |
| 5422 |
ArrayHasElement ❌ RemovedMethod was removed, use ArrayHasElement instead |
aArray: TKMStringArray; aElement: string; |
Boolean |
| 15136 |
ArrayHasElement Checks whether requested array contains a given string |
aArray: TKMStringArray; aElement: string; |
Boolean |
| 5422 |
ArrayHasElementI ❌ RemovedMethod was removed, use ArrayHasElementI instead |
aArray: TKMIntegerArray; aElement: Integer; |
Boolean |
| 15136 |
ArrayHasElementI Checks whether requested array contains a given integer |
aArray: TKMIntegerArray; aElement: Integer; |
Boolean |
| 5422 |
ArrayHasElementS ❌ RemovedMethod was removed, use ArrayHasElementS instead |
aArray: TKMSingleArray; aElement: Single; |
Boolean |
| 15136 |
ArrayHasElementS Checks whether requested array contains a given single number |
aArray: TKMSingleArray; aElement: Single; |
Boolean |
| 15136 |
ArraySumI Returns the sum of the numbers of a given array |
aArray: TKMIntegerArray; | Integer |
| 15136 |
ArraySumS Returns the sum of the numbers in a given array |
aArray: TKMSingleArray; | Single |
| 14387 |
ColorFromHSB Create RGB color from Hue, Saturation and Brightness 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 a vector. Sqrt(x * x + y * y) |
aX, aY: Integer; | Single |
| 14363 |
DistanceS Returns the length of a vector. Sqrt(x * x + y * y) |
aX, aY: Single; | Single |
| 5422 |
EnsureRangeI Returns the closest integer to aValue that is within the interval [aMin..aMax] |
aValue: Integer; aMin, aMax: Integer; |
Integer |
| 5422 |
EnsureRangeS Returns the closest single number to aValue that is within the interval [aMin..aMax] |
aValue: Single; aMin, aMax: Single; |
Single |
| 15658 |
FMod Returns floating point remainder of aNumerator / aDenominator (like mod in integers) with the same sign as aNumerator. |
aNumerator: Single; aDenominator: 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 the result |
aBool: Boolean; aTrue: string; aFalse: string; |
string |
| 5422 |
IfThenI Checks condition aBool and returns aTrue/aFalse integer depending on the result |
aBool: Boolean; aTrue: Integer; aFalse: Integer; |
Integer |
| 5422 |
IfThenS Checks condition aBool and returns aTrue/aFalse single number depending on the result |
aBool: Boolean; aTrue: Single; aFalse: Single; |
Single |
| 5422 |
InAreaI 2D variant of InRange, can be used for unit position 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 a given aValue is within the interval [aMin..aMax] |
aValue: Integer; aMin, aMax: Integer; |
Boolean |
| 5422 |
InRangeS Checks whether a given aValue is within the 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 the greater of two given numbers |
A, B: Integer; | Integer |
| 5422 |
MaxInArrayI ❌ RemovedMethod was removed, use ArrayFindMaxI instead |
aArray: TKMIntegerArray; | Integer |
| 5422 |
MaxInArrayS ❌ RemovedMethod was removed, use ArrayFindMaxS instead |
aArray: TKMSingleArray; | Single |
| 5422 |
MaxS Returns the greater of two given numbers |
A, B: Single; | Single |
| 5422 |
MinI Returns the smaller of two given numbers |
A, B: Integer; | Integer |
| 5422 |
MinInArrayI ❌ RemovedMethod was removed, use ArrayFindMinI instead |
aArray: TKMIntegerArray; | Integer |
| 5422 |
MinInArrayS ❌ RemovedMethod was removed, use ArrayFindMinS instead |
aArray: TKMSingleArray; | Single |
| 5422 |
MinS Returns the smaller of two given numbers |
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 a random float number within 0..1 range |
Single | |
| 6683 |
RandomI Returns a random integer number within 0..aMax-1 range |
aMax: Integer; | Integer |
| 5422 |
Sqr Returns A^2 = A*A |
A: Extended; | Extended |
| 5422 |
SumI ❌ RemovedMethod was removed, use ArraySumI instead |
aArray: TKMIntegerArray; | Integer |
| 5422 |
SumS ❌ RemovedMethod was removed, use ArraySumS instead |
aArray: TKMSingleArray; | Single |
| 5422 |
TimeToString Converts game ticks count into a string: HH:MM:SS Can be used for scripted timers |
aTicks: Integer; | string |