Getting Started
This guide walks through the fastest path from installation to a working datapack. It uses the current RedScript CLI workflow: scaffold a project, edit src/main.mcrs, compile to dist/, then load the datapack in Minecraft.
Try Online First
If you want to test the language before installing anything, use the online IDE:
It is useful for quick experiments, but local development is better once you want project files, repeatable builds, and editor support.
Install the Tooling
VS Code Extension
For syntax highlighting, completions, hover docs, diagnostics, snippets, and go-to-definition, install the VS Code extension:
- Open VS Code
- Open Extensions
- Search for
RedScript - Install RedScript for VSCode
CLI
Install the compiler globally with npm:
npm install -g redscript-mcCheck that the command is available:
redscript versionYou can also inspect all supported commands with:
redscript --helpCreate a Project
The recommended starting point is the built-in project scaffold:
mkdir hello-redscript
cd hello-redscript
redscript initredscript init creates a small project with this structure:
hello-redscript/
├── src/main.mcrs
├── redscript.toml
├── redscript.config.json
├── README.md
└── .gitignoreImportant files:
src/main.mcrsis your entry file.redscript.tomlstores the namespace, target Minecraft version, and output directory.dist/is the default compile output directory from the generated config.
Write Your First Program
Replace the scaffolded src/main.mcrs with a minimal program:
@load
fn setup(): void {
say("Hello from RedScript!")
say("Run /trigger welcome_kit")
}
@on_trigger("welcome_kit")
fn give_welcome_kit(): void {
tell(@s, "Starter items incoming.")
give(@s, "minecraft:bread", 16)
give(@s, "minecraft:torch", 8)
}What this does:
@loadruns when the datapack is loaded or reloaded.@on_trigger("welcome_kit")creates trigger-driven logic for players.tell()sends a private message to the current player.give()hands items to the current player.
If you kept the directory name hello-redscript, the scaffold will sanitize that name into the namespace hello_redscript.
Compile the Datapack
From the project root, compile the entry file:
redscript compile src/main.mcrsBecause the CLI reads redscript.toml, this already picks up the scaffolded namespace and output directory. If you prefer explicit flags, the equivalent command is:
redscript compile src/main.mcrs -o dist --namespace hello_redscriptOn success, RedScript writes a datapack into dist/.
Understand the Compile Output
The compiler emits a normal Minecraft datapack layout. A typical output looks like this:
dist/
├── pack.mcmeta
└── data/
├── minecraft/
│ └── tags/
│ └── function/
│ ├── load.json
│ └── tick.json
└── hello_redscript/
└── function/
├── load.mcfunction
├── setup.mcfunction
└── give_welcome_kit.mcfunctionThe important pieces are:
pack.mcmetaidentifies the datapack to Minecraft.data/<namespace>/function/*.mcfunctioncontains compiled RedScript functions.load.mcfunctionis generated automatically and handles runtime setup such as scoreboard initialization.
Install It in Minecraft
Copy the contents of dist/ into your world save's datapacks/ folder so the datapack root contains pack.mcmeta.
Example:
.minecraft/saves/<your-world>/datapacks/hello_redscript/
├── pack.mcmeta
└── data/Then start the world and run:
/reloadIf the datapack loaded correctly, the @load function will run and print the chat messages from setup().
Run the First Program
After /reload, test the datapack in game:
- Run
/trigger welcome_kit - Confirm you receive bread and torches
- Call the generated function directly if needed:
/function hello_redscript:give_welcome_kit
If something fails, run:
redscript check src/main.mcrsThat validates the file without generating output.
How the Compile Flow Works
The usual edit loop is:
- Edit
src/main.mcrs - Run
redscript compile src/main.mcrs - Copy or sync the compiled
dist/datapack into the world - Run
/reloadin Minecraft - Test your functions or triggers
For larger projects, RedScript can also:
redscript watch <dir>to rebuild on file changesredscript publish <file>to package the datapack as a zipredscript test <file>to compile and run@testfunctions
Next Steps
- Your First Datapack for a larger end-to-end example
- Variables & Types for the basic type system
- Functions for reusable logic
- Decorators for
@load,@tick, triggers, and more