AimForge DOCS
Pricing Login
docs / api / variables

Built-in variables

The script runtime provides a set of implicit globals — values you can read (and in some cases write) without declaration. They're populated every frame by the capture/inference pipeline.

Aim output

Name Type Description
x, y float Current aim offset in pixels. Mutable — modify these to adjust output.
z float Restriction percentage (0–100), passed from upstream pipeline scripts.

Detection metadata

The detection object exposes the current detection from the active model. See the Detection page for all members. Common ones:

Name Type Description
confidence float Detection confidence, 0.0–1.0.
distance float Pixel distance from crosshair to detection center.
area float Bounding-box area in pixels².
span float Bounding-box diagonal in pixels. Useful as a normalization factor.
detection.x/.y/.w/.h float Detection position and size.
detection.velocityX/.velocityY float Per-frame velocity.
detection.classId int Model class index of the detection.
detection.keypoints[] array Pose keypoints (YOLO-Pose models only).

Timing

Name Type Description
dt float Delta time since last frame (ms).
dtFrameTime float Capture frame interval (ms).
dtDetectionTime float Time since last detection (ms). Values >100 typically indicate the target is stale or lost.
inferenceMs float Last neural-network inference latency (ms).
captureFps float Current capture framerate (Hz).
captureMs float Capture interval (1000 / captureFps).
deviceHz float Output device send rate (Hz).
time float Cumulative elapsed time since pipeline start (s).

Pipeline slots

Name Type Description
s0, s1, s2, s3 float Per-slot parameters set in the pipeline config. Use these for tunable constants without GUI controls.

Model state

Name Type Description
activeFieldOfView float Effective FOV of the active model (base + any overrides).

Device & I/O

Name Type Description
device string Active input device type: "makcu", "controller", etc.
gpc string GPC mode: "mouse" or "controller".
output string Output mode (informational).
controller object Controller button + stick state. See Controller & input.
makcu object Makcu button state. See Controller & input.
mouse object Raw mouse state.
keyboard object Keyboard state.

Persistent state

Name Type Description
state object Per-script persistent state. Members survive frame-to-frame.
shared object Pipeline-wide shared state. Survives across scripts in the same pipeline.
settings object GUI control values. Keys match var= from //!gui:* directives.

See State & persistence for the difference between state and shared and when to use each.

Keypoint constants

For YOLO-Pose models, KP exposes the COCO-17 keypoint indices:

Constant Index Constant Index
KP.NOSE 0 KP.RIGHT_ELBOW 8
KP.LEFT_EYE 1 KP.LEFT_WRIST 9
KP.RIGHT_EYE 2 KP.RIGHT_WRIST 10
KP.LEFT_EAR 3 KP.LEFT_HIP 11
KP.RIGHT_EAR 4 KP.RIGHT_HIP 12
KP.LEFT_SHOULDER 5 KP.LEFT_KNEE 13
KP.RIGHT_SHOULDER 6 KP.RIGHT_KNEE 14
KP.LEFT_ELBOW 7 KP.LEFT_ANKLE 15
KP.RIGHT_ANKLE 16
nose = detection.keypoints[KP.NOSE];
if (nose.confidence > 0.5) {
  x = nose.x - center_x;
  y = nose.y - center_y;
}