-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
yuzhe edited this page Mar 12, 2026
·
1 revision
npm install -g redscriptOr from source:
git clone https://github.com/bkmashiro/redscript
cd redscript && npm install && npm run build && npm linkCreate 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 ./datapackOutput:
✓ Compiled counter.rs → ./datapack/
Namespace: counter | Functions: 4 | Commands: 12
-
Copy the
datapack/folder to your world'sdatapacks/directory:saves/<world>/datapacks/counter/ -
In-game (or console):
/reload -
The
counter:__loadfunction runs automatically on load, andcounter:counter_tickfires every tick via the tick tag.
For quick testing without a server:
redscript replredscript> let x: int = 5;
redscript> x = x * 2;
redscript> say("x is " + x);
[MC] say x is 10
- Language Reference — full syntax guide
- Builtins — all 34+ MC builtin functions
- Optimizer — what the optimizer does
- Integration Testing — testing against a real Paper server