Function Calls
The call: namespace bridges mcfstd variables into Minecraft function macros. It reads variables from _var, builds a macro argument compound in storage, then calls your function.
This is useful when a function needs a score value as a macro argument:
# data/example/function/show_score.mcfunction
$say score=$(a)
Functions
| Function | Arguments | Purpose |
|---|---|---|
call:arg |
f, a |
Call a function with one variable exposed as $(a) |
call:args |
f, args |
Call a function with zero or more named variable arguments |
call:arg
call:arg is the simple one-argument helper.
function var:set { k: "score", v: 12 }
function call:arg { f: "example:show_score", a: "score" }
The target function receives:
| Macro argument | Value |
|---|---|
$(a) |
Value of variable named by a |
Target function:
# data/example/function/show_score.mcfunction
$tellraw @s { text: "Score: $(a)" }
call:args
call:args accepts a list of mappings. Each mapping contains:
| Key | Description |
|---|---|
n |
Macro argument name exposed to the target function |
k |
mcfstd variable name to read |
Use simple macro names for n, such as x, score, or player_count. The current implementation writes each value to a dynamic storage path, so n should be a valid unquoted NBT path key.
Example:
function var:set { k: "x", v: 10 }
function var:set { k: "y", v: 64 }
function var:set { k: "z", v: -5 }
function call:args { f: "example:teleport_to_vars", args: [{ n: "x", k: "x" }, { n: "y", k: "y" }, { n: "z", k: "z" }] }
Target function:
# data/example/function/teleport_to_vars.mcfunction
$tp @s $(x) $(y) $(z)
Empty argument lists
call:args can call a function with no generated macro arguments:
function call:args { f: "example:no_args", args: [] }
The args key still has to be present because the wrapper is itself a macro function.
Macro requirements
Minecraft macro functions require every placeholder used by the target function to exist in the compound passed to it. Extra keys are ignored.
For example, this target requires x, y, and z:
$particle minecraft:end_rod $(x) $(y) $(z) 0 0 0 0 1
So the call must provide all three names:
function call:args { f: "example:particle_at", args: [{ n: "x", k: "px" }, { n: "y", k: "py" }, { n: "z", k: "pz" }] }
Storage used internally
The call helpers use command storage:
| Storage path | Purpose |
|---|---|
z_std:macro call_arg |
Temporary compound for call:arg |
z_std:macro call_args.args |
Working list for call:args |
z_std:macro call_args.out |
Generated macro argument compound |
These paths are overwritten on each call.