Skip to content

Internal runner and harness calls

These calls are not part of the public API. The built-in computer-player runner and the WololoLabs test harness use them. They can change, change meaning or disappear in any update, without notice, and the downloadable declarations leave them out so they don't fill your editor's completion list. Don't build a script on them; this page exists so that a name you meet in a log or an older script can be looked up.

Human override

The runner uses these to leave a human co-player's units alone. Setting a player affects every script's commands, not only the runner's.

Call Does
SetHumanOverridePlayer(player) Hold every unit this player orders through the game's interface; nil turns holding off.
HumanHeldUnitIds() IDs of held units.
HumanPinnedUnitIds() IDs of units the AI-control button pinned.
ReleaseHumanHeldUnit(objectId) Give a held or pinned unit back to scripted commands.
ConsumeHumanCommandUnitIds() IDs of units the human ordered since the last call. Empty when observation is off, so empty doesn't prove no orders.

Every scripted command leaves held units out, and a command naming only held units is not sent. That player's units in a control group (Object:GetControlGroups()) are left out the same way while they stay grouped. The AI-control button over the game pins the selected units (held until the button gives them back) or gives them back, which also takes them out of their control groups. Setting the player, or disabling the feature, forgets every hold.

Map and combat records

Call Returns
DrainNativeHitEvents() { victim, attacker } ID pairs for hits since the last call, oldest first, and how many were dropped. One queue for every script: a call takes the events from all the others.
GetMapTilesPtr() The raw tile-array address and tile count. Never dereference or save it.

Debug and Dumper builds

Release builds don't define these: the global is nil and calling it raises an error. Check before calling:

if GetNativeGoal ~= nil then
    local value, reason = GetNativeGoal(2, 101)
end
Call Returns
GetNativeRuleList(player) The rule list ID of the player's computer AI.
GetNativeRuleCounts(list) { passes, evaluated, fired }, rule arrays indexed from 1.
GetNativeRuleShapes(list) Each rule's { enabled, conditions, actions } by name.
GetNativeGoal(player, goal) A goal's value.
GetNativeStrategicNumber(player, id) A strategic number.
GetNativeEscrow(player, resource) The escrowed amount of a resource.
GetNativeTacticalState(player) cycles, area, lastCallMs of the tactical loop.
GetNativeTownList(player, name) Object ids in the "buildings", "units" or "villagers" enemy-in-town list.
GetNativeUnitAiState(objectId) { order, action, target, attackers }, or nil, "no-object" / "no-unit-ai".
DrainNativeBuilderEvents() Builder taskings since the last call, and how many were dropped.
TakeCommandBacklogPeak() Deepest command queue and longest wait (ms) since the last call.

Only Dumper builds define these:

Call Returns
IsCompactLogging() Whether this harness match leaves out detailed log lines.
GetHarnessScriptOverride() The script the harness asked for, or nil.
GetProcessClockScale() How many times faster than real time the harness runs.
SetPlayerPerspective([player]) Make reads on this thread answer as another player; no argument ends it.
TakeShadowCommandPackets() Commands issued under a perspective since the last call, which never reached the game.
TakeCommandCounts() { runner = { [commandId] = n }, players = { [player] = { ... } } } since the last call.
TakeOrderSamples() Sampled orders other players sent: { command, player, target, unit, units }.
RequestNativeFactSample(player) Ask to record the player's next rule pass.
TakeNativeFactSample(player) The recorded pass, or nil, "pending".