-
Notifications
You must be signed in to change notification settings - Fork 0
Builtins
yuzhe edited this page Mar 12, 2026
·
1 revision
RedScript ships with 34+ built-in functions that map directly to Minecraft commands.
| Function | MC Command | Notes |
|---|---|---|
say(msg) |
/say <msg> |
Broadcasts to all players |
tell(sel, msg) |
/tell <sel> <msg> |
Private message |
announce(msg) |
/tellraw @a |
JSON text broadcast |
title(sel, title, sub?) |
/title |
Full-screen title |
actionbar(sel, msg) |
/title actionbar |
Action bar text |
tellraw(sel, json) |
/tellraw |
Raw JSON text |
| Function | MC Command | Notes |
|---|---|---|
tp(sel, pos) |
/tp <sel> <pos> |
Teleport to BlockPos |
tp_to(sel, target) |
/tp <sel> <target> |
Teleport to entity |
kill(sel) |
/kill <sel> |
|
give(sel, item, count?) |
/give |
|
heal(sel, amount) |
/effect give … regeneration |
|
effect_give(sel, effect, dur, amp) |
/effect give |
|
effect_clear(sel, effect?) |
/effect clear |
|
xp_add(sel, amount, type?) |
/xp add |
type: points/levels |
xp_set(sel, amount, type?) |
/xp set |
| Function | MC Command | Notes |
|---|---|---|
setblock(pos, block) |
/setblock |
BlockPos + block id |
fill(pos1, pos2, block) |
/fill |
|
fill_replace(pos1, pos2, block, filter) |
/fill … replace |
|
clone(pos1, pos2, dest) |
/clone |
|
summon(entity, pos?) |
/summon |
|
weather(type) |
/weather |
clear/rain/thunder |
time_set(value) |
/time set |
|
gamerule(rule, value) |
/gamerule |
|
difficulty(level) |
/difficulty |
| Function | Description |
|---|---|
scoreboard_get(player, obj) |
Read score → int |
scoreboard_set(player, obj, value) |
Write score |
scoreboard_add(player, obj, amount) |
Add to score |
scoreboard_reset(player, obj) |
Reset score |
obj_add(name, criteria, display?) |
Create objective |
obj_remove(name) |
Remove objective |
obj_display(slot, name) |
Display in sidebar/list/etc |
bossbar_add("my:bar", "Health");
bossbar_set_players("my:bar", @a);
bossbar_set_value("my:bar", 50);
bossbar_set_max("my:bar", 100);
bossbar_remove("my:bar");team_add("red", "Red Team");
team_join("red", @s);
team_leave(@s);
team_option("red", "color", "red");
team_remove("red");push(arr, value) // append
pop(arr) // remove last
len(arr) -> int // length
arr[i] // index access
foreach (x in arr) // iterateImport with import "stdlib/<name>.rs":
| Module | Contents |
|---|---|
math.rs |
abs, min, max, clamp, sign
|
player.rs |
is_alive, in_range, get_health, set_health
|
timer.rs |
start_timer, tick_timer, has_elapsed, reset_timer
|
cooldown.rs |
set_cooldown, check_cooldown, clear_cooldown
|
mobs.rs |
60+ entity constants: ZOMBIE, SKELETON, CREEPER, etc. |
strings.rs |
str_len |