Every script engine has a set of global functions injected into its scope fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AresChat/sb0t/llms.txt
Use this file to discover all available pages before exploring further.
JSGlobal.cs. These functions are available at any time — inside event handlers, timers, or top-level script code — without any import or namespace prefix.
User lookup
user(nameOrId)
Find a currently connected local user by name or session ID.
- string — matches first by exact name, then by name prefix. Must be at least 2 characters long.
- number — matches by the user’s integer session ID (
user.id). Linked users always have an ID of-1and cannot be looked up this way.
JSUser | null — the matching user object, or null if not found.
user() searches only local (non-linked) users. Users connected through a linked leaf server are not in the local pool and cannot be found with this function. Use Link.leaves() or a leaf’s .user() method to reach them.Printing messages
print(message)
Send a system-style message to all currently connected local users in all vrooms.
The value to print. Booleans are coerced to
"true" / "false". null and undefined are silently ignored.print(vroom, message)
Send a message only to users currently inside a specific virtual room.
The vroom number (0–65535). Vroom
0 is the default main room.The message text.
print(user, message)
Send a message privately to a single user (displayed as a system line, not a PM).
The target user object.
The message text.
Sending spoofed messages
sendPM(user, sender, text)
Send a private message to a user that appears to come from a custom sender name. This does not require sender to be a real user in the room.
The recipient user object.
The display name that will appear as the PM sender.
The PM body text.
sendText(user, sender, text)
Send a public-style chat line to a single user only, appearing as if sender said it. Other users in the room do not see this message.
The recipient user object.
The display name to show as the speaker.
The message text.
sendEmote(user, sender, text)
Send an emote-style action line to a single user only, appearing as if sender performed it.
The recipient user object.
The display name to show as the emote actor.
The emote text (typically starts with the sender’s name, e.g.
"waves hello").File inclusion
include(filename)
Load and execute another .js file from the same script folder. The file is executed in the same engine scope, so any functions or variables it defines become available globally within the script.
Filename relative to the script’s folder. Must end in
.js and must not contain .., /, \, or spaces.includeAll()
Execute every .js file in the current script’s folder, except the entry-point file itself. Files are included in the order returned by the filesystem.
String utilities
stripColors(text)
Remove Ares color and formatting codes from a string. Strips \x03nn, \x05nn (color codes with two-digit values), and the bare control characters \x06, \x07, \x09, and \x02.
The raw string that may contain color codes.
string | null — the cleaned string. Returns null if text is null or undefined.
escapeUtf(text)
Escape all non-alphanumeric characters in a string to \xHH (for values up to 0xFF) or \uHHHH (for values above 0xFF) sequences. Alphanumeric ASCII characters (A–Z, a–z, 0–9) are left unchanged.
The value to escape. Converted to string first.
string | null — the escaped string, or null if text is undefined.
byteLength(text)
Return the UTF-8 encoded byte length of a string. Useful for checking whether a string will exceed protocol byte limits.
The value to measure. Converted to string first.
number — byte count, or -1 if text is undefined.
Diagnostics and metadata
tickCount()
Return the current server tick count in milliseconds (the number of milliseconds since the server process started). Useful for measuring elapsed time.
Returns: number
scriptName()
Return the name of the currently executing script (the folder/entry-point name, e.g. "greeter" or "room").
Returns: string
clrName(value)
Return the full CLR (Common Language Runtime) type name of a value. This is a debugging utility for inspecting what .NET type an object has when bridged into JavaScript.
Any value.
string | null — e.g. "scripting.Objects.JSUser", or null if value is undefined.