Skip to content

Home

Overview

An easy to use scripting API for Minecraft. Made by Zarzel and currently only in his client: astolfo.lgbt. If you don't already understand how Minecraft works, I suggest you look through MCP a little bit first so you can understand the structure of ZarScript.

Script structure

All scripts must have 2 global variables named 'scriptName' and 'scriptDescription. Your modules are defined as functions and you must register and unregister an instance of them in 'onEnable' and 'onDisable'. All modules must have the function 'getName'.

var scriptName = "My Script";
var scriptDescription = "Some description here";

function Module() { 
    this.getName = function () {
        return "My script";
    };
}

var module = new Module();

this.onEnable = function() {
    moduleManager.registerModule(module);
}

this.onDisable = function() {
    moduleManager.unregisterModule(module);
}

Defining event callbacks

Some events allow you to return an object to make changes to the event context. A full list of events can be found here

function Module() { 
    this.getName = function () {
        return "My script";
    };

    this.onRender2D = function(width, height, partialTicks) {
    }

    this.onPreMotion = function(posX, posY, posZ, yaw, pitch, onGround) {
        return [posX, posY, posZ, yaw, pitch, onGround]
    }
}

Code snippets

Visual studio code snippets for ZarScript can be downloaded here

Example scripts

For some example scripts made by the beta testers, check out this page. Obviously, these don't show everything you can do with ZarScript but they will give you a general idea of what you can and can't make.