Skip to content

Logic & Calculations

← CHK Functions · code catalog

Friendly names for CHK category 3. Each maps to a top-level CHK code.


CheckRandomPercent

CheckRandomPercent()  ·  chk 10

No in-game description provided; behaviour inferred from the function name.

Example: chk(10)


CheckDifferenceInDays

CheckDifferenceInDays(year: int, month: int, day: int)  ·  chk 22

No in-game description provided; behaviour inferred from the function name.

Parameters

  • year (int) — Year
  • month (int) — Month
  • day (int) — Day

Example: chk(22,1,1,1)


CheckIfNeighbour

CheckIfNeighbour(x: int, y: int, x2: int, y2: int)  ·  chk 38

No in-game description provided; behaviour inferred from the function name.

Parameters

  • x (int) — X
  • y (int) — Y
  • x2 (int) — X2
  • y2 (int) — Y2

Example: chk(38,12,8,1,1)


CheckDistance

CheckDistance(x: int, y: int, x2: int, y2: int)  ·  chk 39

No in-game description provided; behaviour inferred from the function name.

Parameters

  • x (int) — X
  • y (int) — Y
  • x2 (int) — X2
  • y2 (int) — Y2

Example: chk(39,12,8,1,1)


ReturnCRLF

ReturnCRLF()  ·  chk 69

No in-game description provided; behaviour inferred from the function name.

Example: chk(69)


DistanceClosestEnemyHex

DistanceClosestEnemyHex(minimum_AI_VP_value_0_any: int, from_X: int, from_Y: int, max_distance_1_no_maximum: int)  ·  chk 79

Returns the distance. Max distance can be set to keep processing time down if necc.

Parameters

  • minimum_AI_VP_value_0_any (int) — Minimum (AI)VP value? 0=any
  • from_X (int) — from X
  • from_Y (int) — from Y
  • max_distance_1_no_maximum (int) — Max distance (-1=no maximum)

Example: chk(79,1,1,1,1)


CheckEnemyTroopsCloseBy

CheckEnemyTroopsCloseBy(max_Distance: int, from_X: int, from_Y: int, distance_divider_modifier_0_none: int)  ·  chk 80

Max distance sets circle in which too look. Distance divider modifier set by what the power points of a unit are divided. if 0 they are not divided. if 1 they are divided by distance. if 2 by double distance.. etc..

Parameters

  • max_Distance (int) — Max Distance
  • from_X (int) — from X
  • from_Y (int) — from Y
  • distance_divider_modifier_0_none (int) — Distance divider modifier (0=none)

Example: chk(80,1,1,1,1)


CheckGameVar

CheckGameVar(nr: int)  ·  chk 93

No in-game description provided; behaviour inferred from the function name.

Parameters

  • nr (int) — Nr

Example: chk(93,1)


CheckTempVar

CheckTempVar(nr: int)  ·  chk 94

No in-game description provided; behaviour inferred from the function name.

Parameters

  • nr (int) — Nr

Example: chk(94,1)


CheckDefinedAreaID

CheckDefinedAreaID(slot_0_9: int, value: int)  ·  chk 101

Returns first Defined area with that slot&value coupled to it.

Parameters

  • slot_0_9 (int) — Slot#(0-9)
  • value (int) — Value#

Example: chk(101,1,1)


CheckCalcGetPercent

CheckCalcGetPercent(var_X: int, of_Var_Y: int)  ·  chk 108

Returns the percentage that var X makes up of var Y.

Parameters

  • var_X (int) — Var X
  • of_Var_Y (int) — of Var Y

Example: chk(108,1,1)


CheckLocCounter

CheckLocCounter()  ·  chk 109

Returns the number of locations. remember counting starts at 0.

Example: chk(109)


CheckLocX

CheckLocX(location: int)  ·  chk 110

Returns the number of locations. remember counting starts at 0.

Parameters

  • location (int) — Location#

Example: chk(110,1)


CheckLocY

CheckLocY(location: int)  ·  chk 111

Returns the number of locations. remember counting starts at 0.

Parameters

  • location (int) — Location#

Example: chk(111,1)


CheckStringLength

CheckStringLength(string: string)  ·  chk 120

Return of 0 means an empty string has been tested.

Parameters

  • string (string) — String

Example: chk(120,'Text')


CheckCompareString

CheckCompareString(string1: string, string2: string, mode: int)  ·  chk 140

Case insensitive. Mode=1 means it looks if the strings are exactly alike. Mode=2 same but all spaces are removed. Mode=3 means it looks if part of string1 is equal to string 2. Function returns 1 if equal or 0 if not.

Parameters

  • string1 (string) — String1
  • string2 (string) — String2
  • mode (int) — Mode

Example: chk(140,'Text','Text',1)


CheckMin

CheckMin(value1: int, value2: int, mode: int)  ·  chk 141

Returns the lowest of the 2 values entered

Parameters

  • value1 (int) — Value1
  • value2 (int) — Value2
  • mode (int) — Mode

Example: chk(141,1,1,1)


CheckMax

CheckMax(value1: int, value2: int, mode: int)  ·  chk 142

Returns the highest of the 2 values entered

Parameters

  • value1 (int) — Value1
  • value2 (int) — Value2
  • mode (int) — Mode

Example: chk(142,1,1,1)


CheckForLocationProperty

CheckForLocationProperty(x: int, y: int, n1_airbase_2_port_and_sea_next_door: int)  ·  chk 158

Returns 1 if property is available, Returns 0 if not.

Parameters

  • x (int) — X
  • y (int) — Y
  • n1_airbase_2_port_and_sea_next_door (int) — 1=airbase, 2=port(and sea next door)

Example: chk(158,12,8,1)


CheckGetCurrentDateString

CheckGetCurrentDateString()  ·  chk 163

Returns a string thats date formatted. Keep in mind that strings when compared using <,>,=, etc.. are compared as if they were dates.

Example: chk(163)


CheckGetDateString

CheckGetDateString(day: int, month: int, year: int, hour: int)  ·  chk 164

Returns a string thats date formatted. Keep in mind that strings when compared using <,>,=, etc.. are compared as if they were dates.

Parameters

  • day (int) — Day
  • month (int) — Month
  • year (int) — Year
  • hour (int) — Hour

Example: chk(164,1,1,1,1)


CheckTempString

CheckTempString(tempString: int)  ·  chk 189

No in-game description provided; behaviour inferred from the function name.

Parameters

  • tempString (int) — TempString #

Example: chk(189,1)


CheckPopupSkipped

CheckPopupSkipped()  ·  chk 190

Returns 1 if popup skipped otherwise returns 0.

Example: chk(190)


CheckForUnitVisibleToPlayer

CheckForUnitVisibleToPlayer(unit_Number: int, player_Number: int)  ·  chk 191

Returns 1,2,3 if unit is visible. Returns 0 if it is not. 1=?mark counter, 2=fuzzy info, 3=exact strength known

Parameters

  • unit_Number (int) — Unit Number
  • player_Number (int) — Player Number

Example: chk(191,1,1)


CheckModulo

CheckModulo(number: int, divider: int)  ·  chk 200

Return (number) modulo (divider)... For example 4 modulo 3 = 1

Parameters

  • number (int) — Number
  • divider (int) — Divider

Example: chk(200,1,1)


CheckAbs

CheckAbs(number: int)  ·  chk 204

Return the absolute of the number passed

Parameters

  • number (int) — Number

Example: chk(204,1)


CheckSubString

CheckSubString(string: string, position: int, length: int)  ·  chk 205

For example. If string='abcdef' then position 2, length 2 will return 'bc'

Parameters

  • string (string) — String
  • position (int) — Position
  • length (int) — Length

Example: chk(205,'Text',1,1)


CheckAppendString

CheckAppendString(string: string, position: int, string_to_Insert: string, mode: int)  ·  chk 207

Mode 0 = Insert, Mode 1 = Overwrite. Example: string 'abcdef', pos=2, stringToInsert='123', mode=0 results in 'a123bcdef'

Parameters

  • string (string) — String
  • position (int) — Position
  • string_to_Insert (string) — String to Insert
  • mode (int) — Mode

Example: chk(207,'Text',1,'Text',1)


CheckCapitalise

CheckCapitalise(string: string, mode: int)  ·  chk 208

Mode 0 = Cap. 1st char of phrase, Mode 1 = Cap 1st char each word, Mode 2 = Cap all, Mode 3 = lowercase all

Parameters

  • string (string) — String
  • mode (int) — Mode

Example: chk(208,'Text',1)


CheckSqrt

CheckSqrt(number: int)  ·  chk 218

Returns the square root of the number.

Parameters

  • number (int) — Number

Example: chk(218,1)


CheckRandomNumber

CheckRandomNumber(number1: int, number2: int)  ·  chk 219

Returns a random number including and between number1 and number2

Parameters

  • number1 (int) — Number1
  • number2 (int) — Number2

Example: chk(219,1,1)


CheckPercentage

CheckPercentage(number_1_part: int, number_2_total: int)  ·  chk 222

Returns how much percentage points number 1 if of number 2.

Parameters

  • number_1_part (int) — Number 1 (part)
  • number_2_total (int) — Number 2 (total)

Example: chk(222,1,1)


CheckStringPart

CheckStringPart(string: string, part: int)  ·  chk 224

Returns the stringpart specified. Remember @ is used as a seperator.

Parameters

  • string (string) — String
  • part (int) — Part #

Example: chk(224,'Text',1)


CheckStringPartCounter

CheckStringPartCounter(string: string)  ·  chk 225

Returns the number of string parts in the string. Remember @ is used as a seperator.

Parameters

  • string (string) — String

Example: chk(225,'Text')


CheckSqrt2

CheckSqrt2(number: int, number_square_roots: int, multiply_result_by: int)  ·  chk 226

Returns the square root of the number. Allow for betting calculation of floating point numbers.

Parameters

  • number (int) — Number
  • number_square_roots (int) — Number square roots
  • multiply_result_by (int) — Multiply result by

Example: chk(226,1,1,1)


CheckDecimal

CheckDecimal(number: int, divided_by_number: int, maximum_decimals: int)  ·  chk 227

Returns a text string with the decimal number.

Parameters

  • number (int) — Number
  • divided_by_number (int) — Divided by number
  • maximum_decimals (int) — Maximum decimals

Example: chk(227,1,1,1)


CheckLogicPart

CheckLogicPart(string: string, part_1_3: int)  ·  chk 228

Returns the logicpart specified as string. Remember <,>,=,/,*,+,- is used as a seperator as well as logic part 2.

Parameters

  • string (string) — String
  • part_1_3 (int) — Part # (1-3)

Example: chk(228,'Text',1)


CheckDynamicElementHeight

CheckDynamicElementHeight(full_Element_Text: string)  ·  chk 230

Returns the number of pixels of height

Parameters

  • full_Element_Text (string) — Full Element Text

Example: chk(230,'Text')


CheckReplaceFlags

CheckReplaceFlags(string: string, stringlist_ID_for_Flags: int)  ·  chk 231

Returns a string equal to the string passed but with any [flags] removed. Flag name will be looked for in stringlist col0 and replaced by value in col1.

Parameters

  • string (string) — String
  • stringlist_ID_for_Flags (int) — Stringlist ID for Flags

Example: chk(231,'Text',1)


CheckLookupValue

CheckLookupValue(lookupString: string)  ·  chk 232

Returns string or number on a hardcoded basis. If hardcoded LookupString is not found original String is returned. See documentation.

Parameters

  • lookupString (string) — LookupString

Example: chk(232,'Text')


CheckMultiplyByVerySmallNumber

CheckMultiplyByVerySmallNumber(value_as_string: string, multiplier: int, number_of_comma_shifts: int)  ·  chk 234

Value as string allows you to work with long numbers. Number of comma shifts is applied to multiplier and then the value is multiplied by the multiplier. For exame value=1000, multiplier=5 and comma shift 2 results in 0.05*1000=50. Maximum 10 comma shifts.

Parameters

  • value_as_string (string) — Value as string
  • multiplier (int) — Multiplier
  • number_of_comma_shifts (int) — Number of comma shifts

Example: chk(234,'Text',2,1)


CheckSqrt3

CheckSqrt3(number_a: int, divide_by_number_b: int, number_of_square_roots: int, multiply_by_number_c: int)  ·  chk 235

Returns (the square root of (the number a / number b)) multiplied by number c. Allow for betting calculation of floating point numbers.

Parameters

  • number_a (int) — Number a
  • divide_by_number_b (int) — Divide by number b
  • number_of_square_roots (int) — Number of square roots
  • multiply_by_number_c (int) — Multiply by number c

Example: chk(235,1,1,1,1)


CheckPowerLong

CheckPowerLong(number: int)  ·  chk 236

Returns the power of the number as as string, allowing you to work with long numbers.

Parameters

  • number (int) — Number

Example: chk(236,1)


CheckGetDateStringForRoundX

CheckGetDateStringForRoundX(round: int)  ·  chk 263

Returns a string thats date formatted.

Parameters

  • round (int) — Round

Example: chk(263,1)


This doc was generated from extracting data from Shadow Empire version 1.32a on 2026-06-05 06:56 UTC.