Skip to content

Macros & Scripting

import { Steps, Aside } from '@astrojs/starlight/components';


  1. Define the macro with [macro name=…][endmacro]:

    [macro name=fade_to_black]
    [fadeout time=500 color=0x000000]
    [wf]
    [endmacro]
  2. Invoke it anywhere by its name:

    [fade_to_black]
  3. Pass parameters at the call site; access them with %key or the mp Rhai map inside the body:

    [macro name=say_hello]
    Hello, %name|stranger!
    [endmacro]
    [say_hello name=Alice]

Delete a macro definition at runtime.


Execute a multi-line Rhai script block. All text between the tags is run as Rhai code.

[iscript]
let total = 0;
for i in 0..10 {
total += i;
}
f.total = total;
[endscript]

Open a URL in the system browser.

[web url="https://example.com"]

TagClears
[clearvar]All f game flags
[clearsysvar]All sf system flags
[clearstack]Call, if, and macro stacks