1 Function Reference
Victor Westerlund edited this page 2026-08-22 10:25:40 +02:00

Function Reference

This page lists the public mcfstd functions. Functions under z_std: are internal and are described in Internal Model.


Variables

Function Arguments Returns Description
var:set k string, v int void Set a variable
var:unset k string void Remove one exact variable
var:isset k string bool Return true if a variable exists
var:cp k source string, v destination string void Copy a variable
var:mv k source string, v destination string void Rename a variable
var:inc k string void Add 1 to a variable
var:dec k string void Subtract 1 from a variable

Arithmetic

Function Arguments Returns Description
var:math/add k string, v int or string void Add v to k
var:math/sub k string, v int or string void Subtract v from k
var:math/mul k string, v int or string void Multiply k by v
var:math/div k string, v int or string void Divide k by v
var:math/mod k string, v int or string void Apply modulo v to k

Comparisons

Function Arguments Returns Description
var:comp/eq k string, v int or string bool Test k == v
var:comp/gt k string, v int or string bool Test k > v
var:comp/gteq k string, v int or string bool Test k >= v
var:comp/lt k string, v int or string bool Test k < v
var:comp/lteq k string, v int or string bool Test k <= v

Function calls

Function Arguments Returns Description
call:arg f string, a string void Call f with variable a exposed as $(a)
call:args f string, args list void Call f with variables exposed as named macro arguments

Standard output

Function Arguments Returns Description
stdout:true none bool Return true if the last boolean result was true
stdout:false none bool Return true if the last boolean result was false
stdout:void none void No-op callback

Area triggers

Function Arguments Returns Description
trigger:area/add k, r, ef, lf void Add an area enter/leave trigger
trigger:area/rm k void Remove area triggers with key k
trigger:area/clear none void Remove all area triggers
trigger:area/ls none void List loaded area triggers

Block triggers

Function Arguments Returns Description
trigger:block/add k, t, pf, bf void Add a block place/break trigger
trigger:block/rm k void Remove block triggers with key k
trigger:block/clear none void Remove all block triggers
trigger:block/ls none void List loaded block triggers

Debugging

Function Arguments Returns Description
debug:var none void Display _var in the sidebar
debug:reg none void Display _reg in the sidebar
debug:trace/enable k selector void Enable trace output for selected entities
debug:trace/disable k selector void Disable trace output for selected entities