Skip to content

Getting Started

yuzhe edited this page Mar 12, 2026 · 1 revision

Getting Started

Installation

npm install -g redscript

Or from source:

git clone https://github.com/bkmashiro/redscript
cd redscript && npm install && npm run build && npm link

Your First Script

Create counter.rs:

@tick
fn counter_tick() {
    let ticks: int = scoreboard_get("counter", "ticks");
    ticks = ticks + 1;
    scoreboard_set("counter", "ticks", ticks);

    if (ticks % 100 == 0) {
        say("Counter reached another 100 ticks");
    }
}

Compile it:

redscript compile counter.rs -o ./datapack

Output:

✓ Compiled counter.rs → ./datapack/
  Namespace: counter  |  Functions: 4  |  Commands: 12

Deploy to Minecraft

  1. Copy the datapack/ folder to your world's datapacks/ directory:

    saves/<world>/datapacks/counter/
    
  2. In-game (or console): /reload

  3. The counter:__load function runs automatically on load, and counter:counter_tick fires every tick via the tick tag.

REPL

For quick testing without a server:

redscript repl
redscript> let x: int = 5;
redscript> x = x * 2;
redscript> say("x is " + x);
[MC] say x is 10

Next Steps

Clone this wiki locally