Logging
The game exposes module output through its in-game console. A logger adds a stable feature prefix and provides small controls for repeated messages. It does not write a file or send telemetry.
Create one logger near the feature that owns the messages:
import { logger } from "@killscript/sdk/client";
const log = logger("Targeting");
log.info("enabled");log.debug(`Target: ${target?.Nickname ?? "none"}`);log.warn("Local agent is unavailable");The console receives:
[Targeting] enabled[Targeting] [DEBUG] Target: Bot1[Targeting] [WARN] Local agent is unavailablelogger() is available in both client and Reflex code. It is a lightweight
generated helper; no logger package is loaded at runtime.
Print one copyable report
Section titled “Print one copyable report”Calling print() for every field creates separate console entries mixed with
engine traffic. Use batch() when the lines belong to one diagnostic result:
log.batch([ "Scan complete", `Candidates: ${candidates.length}`, `Selected: ${target?.Nickname ?? "none"}`, `Tick: ${Time.Tick}`,]);The logger joins the lines and performs one native print, so the report can be selected and copied as a unit.
Suppress repeated messages
Section titled “Suppress repeated messages”Use once() for a condition that may be observed on every update but should be
reported once:
if (Agents.GetLocalAgent() === undefined) { log.once("missing-player", "Local agent is unavailable");}Use throttled() when the latest value remains useful, but not on every frame:
log.throttled( "local-position", 1, `Position: ${local.Movement.Position}`,);Keys are local to a logger. Two loggers may both use "missing-player"
without affecting one another. A once() key remains remembered until the
module runtime reloads; a throttled key may print again after its interval.