Documentation
Script

Script

⚠️

This page is under construction.

⚠️

Beta feature, subject to change.

Script allows you to execute scripts and interact with the game.

For example, you can use Script to change the game state in the middle of the game.

new Script(({storable}) => {
    storable
        .getNamespace("game")
        .set("coin", 0);
});

Public Methods

constructor

  • handler: (ctx: ScriptCtx) => void - When the script is executed, this handler will be called. The handler will receive a ScriptCtx object.
const script = new Script((ctx) => {
    console.log(ctx.gameState);
});