EdMoonlight Scripting wiki ← Back to EdMoonlight

Scripting

Write your own modules, HUD elements and commands in JavaScript. A script is a single .js file. It loads the moment you drop it in, shows up in the ClickGUI like any built-in module, and reloads every time you save.

Quick start

  1. Launch the game once. EdMoonlight creates EdMoonlight-NextGen/scripts/ inside your game folder, with an examples/ folder and a starter hello.js.
  2. Type .script folder in chat to open that folder, or .script new myscript to create a file from the template.
  3. Edit the file and save. It reloads within a second; errors appear in chat.

A complete script that adds a module with a setting and a HUD element:


script.info({ author: 'you', version: '1.0', description: 'My first script' });

const m = script.module({ name: 'Hello', category: 'Scripts', key: 'H' });
const greeting = m.text('Greeting', 'Hello EdMoonlight');

m.onEnable = () => client.notify('Hello', 'Module enabled', 'okay');

const h = m.hud({ name: 'Hello', width: 120, height: 18 });
h.draw = function (w, hh) {
  this.width = draw.textWidth(greeting.get()) + 12;
  draw.panel(0, 0, w, hh, 5);
  draw.text(greeting.get(), 6, hh / 2, color.theme(), { valign: 'middle' });
};

Turn it on with H or from the Scripts category in the ClickGUI. The HUD element can be moved in the HUD editor.

Files and folders

Scripts live in <game folder>/EdMoonlight-NextGen/scripts/.

PathWhat it is
name.jsOne script. Its name is the file name.
name/main.jsA script in its own folder. Its name is the folder name; other files there can be loaded with require().
lib/Shared code for require(). Never loaded as a script.
data/Where storage keeps each script's saved data.
examples/Bundled examples. Move one up into scripts/ to run it.
API.md, AI_PROMPT.mdReference files, rewritten on every start.
scripts-state.jsonSaved module states, keys, settings and HUD positions.

The bundled examples are hello, targethud, keystrokes, vanilla_hud, esp, auto_gg, speed_graph, packet_logger, block_anim, scaffold_counter, raven_style, chest_view and hud_styles.

The engine is Mozilla Rhino with ES6 support: let/const, arrow functions, classes, template strings, destructuring, generators and spread all work. async/await does not; use tasks or callbacks.

Reloading and errors

Time limits

A watchdog stops scripts that hang the game. A script that runs out of time is suspended (its modules switch off) until you reload it. This can't be caught with try/catch.

WhenLimit
Top-level code while loading10 s
Event handlers, timers, HUD drawing, setting callbacks2 s
Commands and the .js console5 s

Chat commands

CommandWhat it does
.script listEvery script and its status: loaded, stopped, disabled, error or off.
.script reload [name]Reload all scripts, or one.
.script enable <name>Load a script and keep it enabled (alias load).
.script disable <name>Unload a script and keep it off, even after restarts.
.script unload <name>Unload now, without remembering it.
.script info <name>Version, author, file, modules, HUD elements and the last error.
.script new <name>Create name.js from the template and load it.
.script folderOpen the scripts folder (alias open).
.script promptCopy a prompt that teaches an AI assistant this API (alias ai).
.script autoreload [on|off]Turn hot reload on or off.
.js <code>Run JavaScript in a console that keeps its variables. .js reset clears it.

Script modules with settings also get a command like built-in modules: .ModuleName <setting> <value>.

The script object

MemberDescription
script.name, script.dirThe script's name and the folder its file is in.
script.info({ author, version, description })Metadata shown by .script info.
script.on(event, fn) / script.off(event, [fn])Listen to an event for as long as the script is loaded.
script.module(options)Register a module.
script.hud(options)Register a HUD element.
script.command(options)Register a chat command.
script.log(...) / script.error(...)Write to the game log, or report an error in chat and the log.
script.reload() / script.unload()Reload or unload this script.
script.events()Names of every event.

Modules


const m = script.module({
  name: 'AutoHello',          // must be unique across the client
  category: 'Misc',           // Combat, Movement, Player, Misc, Visual, Accessories, Display, Performance, Scripts
  key: 'G',                   // key name, or 'NONE'
  description: 'Says hello',
  enabled: false,             // on by default the first time it loads
  onEnable() { print('on'); },
  onTick() { /* runs every tick while enabled */ },
});

Any event works as a handler property: on plus the event name, such as onTick, onPreMotion, onPacketReceive or onRender2D. Handlers can be set or replaced later (m.onTick = fn), or added with m.on('tick', fn). Module handlers only run while the module is enabled.

MethodDescription
m.enabled(), m.setEnabled(on), m.toggle()Read or change the state.
m.on(event, fn), m.off(event, [fn])Add or remove listeners. on can be chained.
m.setTag(text), m.tag()Text shown next to the name in the ArrayList.
m.setKey(name), m.keyName()Change or read the key bind. Pass a name like 'R'; null unbinds.
m.setHidden(hidden)Hide from the ArrayList.
m.hud(options)A HUD element that is shown while the module is on.
m.slider(…), m.bool(…), …Add settings.

Settings

Settings appear in the ClickGUI and are saved automatically. Each one can be created with positional arguments or an options object, which can also take visible: () => bool.


const range = m.slider('Range', 4.2, 3, 6, 0.1);
const mode  = m.mode('Mode', ['Single', 'Switch'], 'Single');
const delay = m.slider({ name: 'Switch Delay', default: 200, min: 0, max: 1000, step: 10,
                         visible: () => mode.is('Switch') });
const color1 = m.color('Color', '#7DB7FF');
TypePositional formget() returns
slider(name, default, min, max, step)number
bool(name, default)boolean
mode(name, ['A', 'B'], default)string
text(name, default, numbersOnly)string
color(name, default)ARGB number
multi(name, ['A', 'B'], ['A']){ A: true, B: false }
range(name, low, high, min, max, step){ low, high }

Every setting returns a handle with get(), set(value), is(text) (for modes), has(name) (for multi), visible(fn) and onChange((value, old) => …).

Colors are accepted in any of these forms: 0xFFRRGGBB, '#RGB', '#RRGGBB', '#RRGGBBAA' (alpha last), [r, g, b, a] or { r, g, b, a }.

HUD elements


const h = script.hud({
  name: 'Clock', x: -4, y: 4, width: 60, height: 16,
  draw(w, hh, partialTicks) {
    draw.round(0, 0, w, hh, 4, color.background(160));
    draw.text(new Date().toTimeString().slice(0, 8), w / 2, hh / 2, -1, { align: 'center', valign: 'middle' });
  },
});

Commands


script.command({
  name: 'note',
  aliases: ['n'],
  usage: 'note <add <text>|list|clear>',
  run(args, line) {
    const notes = storage.get('notes', []);
    if (args[0] === 'add') { notes.push(args.slice(1).join(' ')); storage.set('notes', notes); return 'saved'; }
    if (args[0] === 'clear') { storage.remove('notes'); return 'cleared'; }
    notes.forEach((n, i) => print((i + 1) + '. ' + n));
  },
  complete(args) { return args.length <= 1 ? ['add', 'list', 'clear'] : []; },
});

run receives the words after the command name. A returned string is shown in chat. complete returns tab-completion suggestions.

Events

Listen with script.on(name, fn) (while the script is loaded) or on a module (only while it is enabled). Returning false from a handler cancels events marked as cancellable.

EventArgumentsCancelNotes
ticknoneEvery client tick, also in menus.
updatenonePlayer update, in a world only.
preMotion / postMotioneyese.x e.y e.z e.yaw e.pitch e.onGround are writable in preMotion and change the movement packet.
moveeyese.x e.y e.z: this tick's movement, writable.
moveInputeget/setForward, get/setStrafe, is/setJumping, is/setSneaking.
strafeeyesget/set Strafe, Forward, Friction, Yaw.
jumpeyesget/setMotionY, get/setYaw.
attacktarget, eyesYou attack an entity.
packetSendpacket, eyesOutgoing packet. e.setPacket(p) replaces it.
packetReceivepacket, eyesIncoming packet, on the network thread.
chatplain, formatted, eyesIncoming chat line. Cancelling hides it.
sendMessagetext, eyesA chat line you send. Cancelling stops it.
keykeyCode, eKey pressed in game. Compare with input.keyCode('R').
mousebutton, down0 left, 1 right, 2 middle.
render2DpartialTicks, width, heightEvery frame, in GUI pixels. Alias render.
render3DpartialTicksWorld rendering, for render.*.
shader2D'blur' or 'shadow'What you draw becomes a blur or shadow area.
nameTagentity, eyesCancelling hides the vanilla name tag.
worldChangenewLevel, oldLevelnewLevel is null when you leave. Alias world.
teleporteyesServer teleport: position, yaw, pitch.
screennewName, oldNameScreen changed, as names like GuiChat.
damageamount, healthYou lost health.
death / respawnnone
moduleTogglename, enabled, moduleAny module, built-in or script.
settingChangemodule, setting, value, oldAny setting of any module.
messagechannel, data, fromScriptAnother script called ipc.emit.
enable / disablenoneModules only.
load / unloadnoneScript level only.
Network thread. packetReceive and chat run off the main thread. Wrap anything that touches the world or screens in client.schedule(() => …).

player

The local player. Most functions throw when you are not in a world, so check player.exists() first. Positions are {x, y, z}, rotations {yaw, pitch} in degrees.

FunctionReturns / notes
exists(), name(), raw()In a world? Name. The Java LocalPlayer.
pos(), lastPos(), blockPos()Current, previous tick and floored position.
setPos(x, y, z), motion(), setMotion(x, y, z)Missing motion components keep their value.
rotation(), setRotation(yaw, pitch)The camera rotation.
silentRotate(yaw, pitch, correction)Rotate server-side only; 'silent', 'strict' or 'off'. Call every tick.
serverRotation(), rotationsTo(entity | x, y, z)Last rotation sent; rotation needed to face something.
onGround(), moving(), sprinting(), sneaking(), using(), blocking()Booleans.
inWater(), inLava(), onLadder(), collided()Booleans.
speed(), bps(), direction()Speed per tick, blocks per second, movement direction.
strafe([speed]), jump(), setSprinting(on)Movement helpers.
health(), maxHealth(), absorption(), armor(), food(), saturation()Numbers.
hurtTime(), fallDistance(), ticksExisted(), eyeHeight()Numbers.
swing(), attack(entity), useItem(), stopUsing()Actions.
distance(entity | x, y, z)Feet-to-feet distance.
dimension(), gamemode()-1 nether, 0 overworld, 1 end; 'survival' etc.
potion(id){level, duration} or null, using 1.8 potion IDs (1 = speed).

world

Entities and blocks are returned as the game's own Java objects, so you can call their methods directly, for example world.players()[0].getHealth().

FunctionReturns / notes
players(), entities(), living(), tileEntities()Arrays. living() excludes you.
entity(id), nearest(range = 6, filter)By ID; closest living entity. Filter: 'player' or a function.
block(x, y, z){ name, block }, for example name: 'stone'.
isAir(x, y, z), blockState(x, y, z), blockId(x, y, z)
mouseOver(), raycast(x1, y1, z1, x2, y2, z2, liquids)A hit: { type: 'block' | 'entity' | 'miss', x, y, z, side, entity, hitX, hitY, hitZ }.
time(), raining()
tabList()[{ name, display, ping, gamemode }]
sidebar(){ title, lines } of the scoreboard, or null.

combat

Distances here are measured from your eyes to the nearest point of the target's hitbox, like the server's reach check. A rotation can be {yaw, pitch}, [yaw, pitch] or two numbers. A point can be an entity, {x, y, z}, [x, y, z] or three numbers.

FunctionReturns / notes
targets(options), target(options)Sorted target list, or the first target. Options below.
rotationTo(point), rotationToCenter(e), rotationToEyes(e)Rotation to face it.
limit(from, to, maxYaw, maxPitch), smooth(to, speed, from), gcd(rotation)Limit, smooth and mouse-sensitivity rounding.
rotate(rotation, correction = 'silent', keepTicks = 1)Server-side rotation; your view stays. Call every tick.
serverRotation(), rotating(), difference(a, b), wrap(deg)
distance(e), inRange(e, range = 3), fov(e), canSee(e)
raycast(rotation, range = 3), lookingAt(e, range = 3)What a rotation hits; whether it hits this entity first.
attack(e, swing = true), swing(hand = 'main')Uses the right order for the server's version.
cooldown(), ready(threshold = 0.9), hasCooldown()1.9+ attack cooldown, from 0 to 1.
canCrit(), predict(e, ticks = 1), nearestPoint(e), bestHitVec(e)
auraTarget(), auraEnabled(), isBot(e), isTeam(e), isFriend(e)Built-in KillAura, AntiBot, teams and friends.
Target optionDefaultMeaning
range6Maximum distance.
players / mobs / animalstrue / false / falseWhich entities to include.
invisible, teams, friends, botsfalseInclude these too.
wallstrueInclude entities you can't see.
fov360Field of view in degrees.
sort'distance''distance', 'health', 'fov', 'hurtTime', 'armor'.
limitnoneMaximum number of results.

inventory

Inventory slots are 0–35, with 0–8 the hotbar. Armor slots are 0 helmet, 1 chestplate, 2 leggings, 3 boots. Items are returned as { name, id, count, damage, maxDamage, display, type, enchants, raw }, where type is 'sword', 'tool', 'armor', 'block', 'food' or 'item'. Empty slots are null.

FunctionReturns / notes
slot(), setSlot(i), held()Selected hotbar slot and the held item.
stack(i), armor(i)Item in a slot.
find(nameOrFn, hotbarOnly), count(name){ slot, item } of the first match; total count.
click(slot, button = 0, mode = 0)Click a slot in the open container. Modes: 0 pickup, 1 shift, 2 number key, 3 middle, 4 drop, 5 drag, 6 double-click.
container(), containerStack(i){ title, size, slots, windowId, chest } of the open chest or container.
open(), close()Open your inventory; close the current container.

input

FunctionReturns / notes
keyDown(key), mouseDown(button)Key by name, such as 'R', 'LSHIFT' or 'SPACE'.
keyCode(name), keyName(code)Convert between names and the codes passed to the key event.
binding(name), setBinding(name, down), bindingKey(name)Vanilla key bindings: forward back left right jump sneak sprint attack use drop inventory pick tab.
chatOpen(), inGui()Is chat or any screen open?

Packets

Inspect and cancel packets in the packetSend and packetReceive events. Packets can be matched by their familiar 1.8 names or prefixes, such as 'C03' or 'S12', as well as by their 26.2 class names.


script.on('packetSend', (p) => {
  if (packet.is(p, 'C0F')) return false;          // cancel transaction confirmations
});
script.on('packetReceive', (p) => {
  if (packet.is(p, 'S02')) script.log(packet.name(p), dump(packet.fields(p)));
});
FunctionReturns / notes
packet.name(p), packet.is(p, ...names), packet.outgoing(p)Identify a packet. C04/C05/C06 also match 'C03'.
packet.fields(p), packet.get(p, field), packet.set(p, field, value)Read and write fields by their 26.2 names. Use fields to discover them.
packets.swing(hand), useItem(hand), useItemOn(x, y, z, face), slot(i), attack(e)Build packets.
packets.pos(x, y, z, ground), rot(yaw, pitch, ground), posRot(...), ground(on)Build movement packets.
packets.action(name, x, y, z, face), command(name), closeContainer()Digging and player actions, player commands, close a container.
packets.send(p), packets.sendNoEvent(p)Send a packet, with or without firing packetSend.
packets.version(), packets.legacy()Server protocol name; whether it is 1.8 or older.
client.receivePacket(p)Handle a packet as if the server had sent it.

On older servers, ViaFabricPlus translates the packets you send.

client

FunctionReturns / notes
message(text), print(text)A local chat line, with or without the client prefix.
send(text), command(cmd)Send chat or a /command to the server; run a client command such as 'toggle Sprint'.
notify(title, text, type, seconds)A notification. Types: info, okay, notify, warning.
fps(), latency(), server(), singleplayer(), inGame()
screen(), closeScreen()Current screen as a name like 'GuiChest' or 'GuiInventory'.
timer(), setTimer(speed)Game speed, from 0.05 to 10.
sound(name, pitch)Play a UI sound, for example 'random.orb'.
clipboard(), setClipboard(text), schedule(fn)schedule runs on the main thread.
isFriend(x), addFriend(x), removeFriend(x), target()Friends list; the KillAura target.

modules and entity

modules controls any module, built-in or script. Names ignore case and spaces, so 'Kill Aura' works.

FunctionReturns / notes
enabled(m), enable(m), disable(m), toggle(m), setEnabled(m, on), exists(m)
get(m, setting), set(m, setting, value), settings(m)Read or change any module's settings.
list([category]), categories(), info(m)
setKey(m, name), setHidden(m, hidden), tag(m)
onToggle(name | '*', fn)Called when a module turns on or off. Returns an unsubscribe function.
onSetting(m, setting, fn)Called when that setting changes.

entity gives details about any entity (or you, when the argument is left out):

FunctionReturns / notes
entity.info(e)Name, type, position, rotation, pose and states. Living entities add health, armor, held items, use and blocking; players add creative, flying, level and food.
entity.type(e), entity.is(e, 'zombie')Entity type.
mainHand(e), offHand(e), equipment(e, 'head')Items.
effects(e)[{ name, level, duration, good }]
blocking(e), gliding(e), using(e), attribute(e, 'attack_speed')
attackStrength(), itemCooldown([item]), onCooldown([item])Your attack and item cooldowns.

Where to draw

PlaceCoordinates
A HUD element's draw(w, h)The element's own space; (0, 0) is its top-left corner.
render2D eventThe whole screen, in GUI pixels.
render3D eventWorld coordinates, for render.*.
A script screen's drawThe whole screen, in GUI pixels.

Anything you forget to clean up (an open push or scissor) is reset after each callback.

draw

2D drawing. Sizes are width and height, not a second corner.

FunctionNotes
rect(x, y, w, h, color), round(x, y, w, h, radius, color)Rectangles.
outline(x, y, w, h, radius, thickness, line, fill), border(x, y, w, h, thickness, color)Outlines.
gradient(x, y, w, h, c1, c2, vertical, radius), gradient4(x, y, w, h, radius, tl, tr, bl, br)Gradients.
circle(cx, cy, r, color), arc(cx, cy, r, start, end, thickness, color), ring(cx, cy, r, progress, thickness, color)Round shapes. ring fills clockwise from the top.
line(x1, y1, x2, y2, width, color), triangle(...), polygon([x1, y1, …], color, filled)Lines and polygons.
text(str, x, y, color, font, size)Draws text and returns its width. The last arguments can be an object: { font, size, shadow, align, valign }.
textWidth(str, font, size), textHeight(font, size), font(name, size)Measure text, or get a reusable font.
panel(x, y, w, h, radius)The same blurred, shadowed plate the built-in HUDs use.
blur(x, y, w, h, radius), shadow(x, y, w, h, radius)Blur or shadow an area without drawing anything.
item(stack, x, y, size), head(player | name, x, y, size), entity(e, x, y, size)Items, player heads and 3D entity models.
image(src, x, y, w, h, tint), imageSize(src)Images from a file next to the script, a URL, or a resource like 'minecraft:textures/item/apple.png'.
push(), pop(), translate(x, y), scale(k), rotate(deg, cx, cy)Transforms.
scissor(x, y, w, h, [fn]), endScissor()Clip drawing to an area.
mouse(), hover(x, y, w, h), width(), height(), editing()Mouse position, screen size, and whether the HUD editor is open.

Fonts: interMedium (the default), interBold, interSemiBold, interRegular, psRegular, psBold, MuseMedium, sfui, minecraft and more. Size 16 matches the height of vanilla text.

render

3D drawing in world coordinates, inside render3D. Shapes are drawn through walls.

FunctionNotes
box(x1, y1, z1, x2, y2, z2, color, outline, fill), block(x, y, z, color)Boxes.
entity(e, color, outline, fill, expand)An entity's hitbox, smoothly interpolated.
line(x1, y1, z1, x2, y2, z2, width, color), tracer(e | x, y, z, color, width)Lines and tracers.
project(x, y, z) / project(e)Screen position {x, y, depth}, or null when behind you. Useful for 2D name tags.
lerpPos(e), camera(), partialTicks()Interpolated positions.

Colors and animation

color functions return ARGB numbers: rgb(r, g, b, a), hex('#RRGGBB'), hsb(h, s, b), theme(i), theme2(), background(alpha), rainbow(offset, speed), mix(a, b, t), fade(a, b, speed), alpha(c, a), opacity(c, k), darker(c), brighter(c), health(entityOrFraction), unpack(c) and toHex(c), plus the constants WHITE BLACK RED GREEN BLUE YELLOW GRAY TRANSPARENT. theme() follows the client's theme color.

animation runs on real time, so call its getters every frame:

FunctionNotes
tween(ms, easing)forward(), backward(), toggle(), value(), progress(), finished().
spring(start, stiffness, damping)target(v), value(), velocity(), settled().
pop(openMs, closeMs)A pop-in animation: open(), close(), alpha(), scale(), visible().
pulse(periodMs), ease(name, t), ripple(cx, cy, size, progress, color)Easings: linear, inQuad, outQuad, inOutQuad, inCubic, outCubic, inOutCubic, outQuint, outExpo, outBack, outElastic, outBounce, outSine, inOutSine.

HUD styles and the vanilla HUD

hud.style(target, name, fn) adds your own style to a built-in HUD module. Pick it from that module's style list and your function draws instead of the built-in one. It receives a ctx with the HUD's data and screen size.

Targetctx data
arraylistmodules[{ name, tag, category, enabled, anim }]
targethudtarget, targets[…] with health, armor and distance
notificationslist[{ title, description, type, progress, anim }]
islandkind, title, description, progress and more
keybind, playerlist, potion, armorModules with keys, nearby players, effects, armor pieces

hud.vanilla(part, visible) hides or shows parts of the vanilla HUD: crosshair hotbar stats exp bossbar itemName title actionbar scoreboard chat tablist vignette. They come back when the script unloads. hud.list(), hud.move(id, x, y) and hud.set(id, setting, value) control any HUD element.

Built-in modules can also take new modes from scripts: animations.block(name, fn) for blocking animations, scaffold.counter(name, fn) for the block counter, and chest.view(name, fn) / chest.click(name, fn) for ChestStealer effects.

Script screens


const s = gui.screen({ title: 'Quick', pause: false });
s.toggle({ text: 'Sprint', x: 20, y: 20, width: 120, value: modules.enabled('Sprint'),
           onChange: v => modules.setEnabled('Sprint', v) });
s.button('Close', 20, 50, 120, 20, () => s.close());
script.on('key', code => { if (code === input.keyCode('K')) s.open(); });

Callbacks: init, draw, drawOver, click, release, drag, scroll, key, tick and close. Widgets: button, toggle, slider, input and label. Screen options: pause, background, closeOnEsc and allowMove.

Printing

Timers and tasks


setTimeout(() => print('one second later'), 1000);
const id = setInterval(() => print('every 5 s'), 5000);   // clearInterval(id)

// tasks: write step-by-step logic with generators
task(function* () {
  yield waitUntil(() => player.exists());   // wait for a world
  yield sleep(40);                          // 40 ticks = 2 seconds
  client.send('/lobby');
});

Timers run on the main thread at about one-frame resolution. timer.after, timer.every, timer.cancel and timer.stopwatch() are also available. In a task, yield a number to wait that many ticks, or a function to wait until it returns true.

Storage, JSON and HTTP

FunctionNotes
storage.get(key, default), storage.set(key, value), remove, all, clear, saveData that survives reloads and restarts, one file per script.
json.encode(value, pretty), json.decode(text)
http.get(url, cb, headers), http.post(url, body, cb, headers), http.request({ method, url, body, headers, callback })Asynchronous. cb(body, status, headers) runs on the main thread; on failure body is null.

Sharing between scripts

util and Java

util has lerp, clamp, approach, anim(key, target, speed) (smooth a value per frame), ease, round, random, randomInt, wrapDegrees, stripColor, formatTime, split, base64/unbase64, md5, sha256, uuid, and the file helpers readFile, writeFile, exists and listFiles. Relative file paths start at the script's folder.

Scripts can use Java directly: mc is the Minecraft instance, full class names work (new java.util.ArrayList()), and Java.type, Java.get, Java.set, Java.call and Java.proxy reach classes, private fields and interfaces.

Only run scripts you trust. A script has the same access as the client: it can read and write files anywhere, send network requests, and use Java directly.

Raven B4 scripts

Scripts written for Raven B4 run too, once they are written in JavaScript. A script counts as Raven style when it defines a top-level function such as onLoad, onEnable, onPreUpdate, onPreMotion, onPacketSent, onRenderTick or getRotations, or calls modules.registerButton / registerSlider.

1.8 conventions

The API keeps the conventions of 1.8 clients, so older scripts and habits still work on 26.2:

Examples

Player ESP with labels


const m = script.module({ name: 'BoxESP', category: 'Visual' });
const boxColor = m.color('Color', '#7DB7FFAA');

m.onRender3D = () => {
  for (const p of world.players()) if (p !== player.raw()) render.entity(p, boxColor.get(), true, false);
};
m.onRender2D = () => {
  for (const p of world.players()) {
    if (p === player.raw()) continue;
    const s = render.project(p);
    if (!s) continue;
    const label = p.getName().getString() + '  ' + Math.round(player.distance(p)) + 'm';
    draw.text(label, s.x, s.y, -1, { align: 'center', valign: 'bottom', shadow: true });
  }
};

Auto GG


const m = script.module({ name: 'AutoGG', category: 'Misc' });
const msg = m.text('Message', 'gg');

m.on('chat', (plain) => {
  if (/won the game|Winner/i.test(plain)) setTimeout(() => client.send(msg.get()), 800);
});

Aim at the closest player


const m = script.module({ name: 'SimpleAim', category: 'Combat', key: 'R' });
const range = m.slider('Range', 3.6, 3, 6, 0.1);
const speed = m.slider('Turn Speed', 40, 5, 180, 5);

m.onTick = () => {
  if (!player.exists()) return;
  const t = combat.target({ range: range.get(), walls: false });
  if (!t) return;
  const r = combat.limit(combat.serverRotation(), combat.rotationTo(t), speed.get(), speed.get() / 2);
  combat.rotate(r, 'silent');
  if (combat.ready() && combat.lookingAt(t, range.get())) combat.attack(t);
};

Speed readout that animates in


const pop = animation.pop();
const h = script.hud({ name: 'Speed', x: 0.5, y: -40, width: 90, height: 20 });

h.draw = function (w, hh) {
  pop.set(player.exists() && player.moving());
  if (!pop.visible() && !draw.editing()) return;
  draw.push();
  draw.translate(w / 2, hh / 2);
  draw.scale(pop.scale());
  draw.round(-w / 2, -hh / 2, w, hh, 6, color.opacity(color.background(), pop.alpha()));
  draw.text(player.bps().toFixed(1) + ' b/s', 0, 0, color.opacity(-1, pop.alpha()), { align: 'center', valign: 'middle' });
  draw.pop();
};

Known limitations

Nothing matches your search.