AimForge DOCS
Pricing Login
docs / language / syntax

Syntax

AimForge scripts are written in .afp files using a custom C-like syntax. The language is statically scoped, dynamically typed, and JIT-compiled at load time.

Variables

Variables are declared by assignment. There is no var or let keyword — the first write creates the variable.

x = 0;
strength = 0.5;
label = "head";

Scoped containers expose runtime state. Read or write members directly.

state.lastX = x;
shared.totalShots = shared.totalShots + 1;
settings.strength;          // read GUI slider value

Literals

42              // integer
3.14            // float
1e-3            // scientific notation
"hello"         // string (double quotes only)
0               // false
1               // true (any non-zero value)

Single-quoted strings are not supported.

Operators

Category Operators
Arithmetic + - * /
Comparison == != < > <= >=
Logical && || !

Comments

Single-line only, prefixed with //:

// This is a comment
x = 1;          // inline comment

Multi-line /* ... */ comments are not supported.

GUI directives use a special comment syntax — see GUI directives.

Statements

Every statement ends with a semicolon (;). Block statements are wrapped in { ... }.

if (confidence > 0.5) {
  x = detection.x;
}

Return values

Top-level scripts return a tuple of one to three values. The first two are X/Y output; the third is the restriction percentage (z).

return (x, y);          // standard 2-tuple
return (x, y, z);       // include restriction

User-defined functions can return any value:

function clampStrength(s) {
  return clamp(s, 0, 1);
}