Resource icon

RAT 5 - Server Agent (Windows) 5.10.2

RatScript Arrays and Loops​

  • Native arrays — RatScript V2 now supports array literals such as [] and ["Alice", "Bob"], including nested arrays.
  • Array indexing — Read array values with syntax such as local.names[0] and update local array elements with statements such as SET local.names[0] = "Bob".
  • FOR EACH loops — Iterate over arrays and compatible indexed collections with FOR EACH local.item IN collection ... END.
  • New $players variable — Added a bounded RatScript V2 array containing the currently online player snapshot. Player properties can be accessed through entries such as local.player.name while iterating.
  • New collection functions — Added count(collection), append(array, value), join(collection, separator), and contains_value(collection, value).
  • append() returns a new array without changing the original array.
  • Arrays are limited to 256 elements and 16 nesting levels, while loops retain the existing 1,000-iteration safety limit.

New RatScript Query Functions​

  • Player queries — Added player_exists(player_ref), player_online(player_ref), player_banned(player_ref), and player_has_group(player_ref, group_ref) for checking stored players, online status, active bans, and effective RAT group membership.
  • Player distance and area checks — Added player_distance(player_a, player_b), player_distance_from(player_ref, x, y, z), and player_in_area(player_ref, x1, y1, z1, x2, y2, z2). Area boundaries are inclusive and the two corner coordinates can be supplied in either order.
  • Discord queries — Added discord_user_has_role(user_id, role_id), discord_user_in_guild(user_id), discord_channel_exists(channel_key_or_id), and discord_role_exists(role_id) for checking live Discord guild state.
  • Text helpers — Added equals_ignore_case(a, b), contains_any(value, search1, search2, ...), matches(value, pattern), and pluralize(count, singular, plural?).
  • Math and time helpers — Added chance(percent), is_between(value, min, max), duration_seconds(value), and elapsed_seconds(datetime).

RatScript Reference Improvements​

  • Function reference entries now include parameter names, accepted value types, return types, nullable-result information, examples, and clearer usage notes.
  • Array-aware validation now reports invalid indexes, unsupported collection types, out-of-range assignments, oversized arrays, excessive nesting, and attempts to render structured values directly.

Reliability Fixes​

  • Improved startup recovery when the game server’s normal ready marker is missed. RAT 5 now confirms readiness through a safe runtime probe so integrations and scheduled automation can become available without requiring a restart.
RAT 5 Update — v5.9.8
Changes since v5.8.1 · August 2026




SERVER

RATScript Automation

  • Server Lifecycle Events — Automations can now respond when the game server starts, becomes ready, restarts, or stops.
  • Backup Events — Scripts can react when backups start, complete, or fail.
  • New Player Event — A dedicated event can trigger when a player joins the server for the first time.
  • New Runtime Data — RATScript can access game time, server uptime, blood moon information, current server configuration, and structured backup details.
  • Discord Automation Expansion — Scripts can respond to edited or deleted messages and reaction changes, and can reply, edit, delete, react to, pin, unpin, or start threads from Discord messages. Structured embeds and richer message metadata are also supported.
  • Player Leaderboards — Scripts can build leaderboards or retrieve a specific ranked player using level, score, deaths, kills, play time, credits, and other tracked statistics.

Configuration and Operations

  • Server configuration changes are now broadcast immediately so connected clients stay synchronized.
  • Configuration reference documentation now explains every available server setting.

Reliability and Bug Fixes

  • Smarter Connection Recovery — A new health watchdog detects stalled telnet connections and reconnects automatically, including during service startup.
  • Console commands now wait for active background work instead of being silently dropped.
  • Fixed stale telnet work reservations that could leave later commands waiting indefinitely.
  • Fixed telnet events receiving inaccurate timestamps.
  • Improved compatibility with older WebToken game names.
  • Windows Service Support — RAT 5 Server can now run as a proper Windows service with automatic startup, graceful shutdown, and service logging.
  • Windows service installation now gives clear administrator-rights guidance, verifies that the service starts successfully, cleans up failed registrations, and works reliably from Windows PowerShell.
Player Groups & Teleports
Player Groups: Full server-side player group system: create, edit, and delete groups with configurable teleport destination limits and cooldown overrides. Assigning a player to a group is persistent across sessions.

- Teleport destinations are now saved and persisted per player. Groups define the maximum number of destinations and cooldown settings, with blank values inheriting from the default group.

Player Credits
- Players now have a credits field tracked by the server.
- New script functions for reading and awarding credits to players are available in RAT Script.
- Credits are reflected on the Players page as a sortable column after Score.

Bug Fixes
- Fixed an issue where timezone validation rejected all IANA timezones on Linux servers that did not have the system timezone package installed. All IANA timezones now validate correctly regardless of the host OS.
Fixes for some RAT script issues, and a couple for the new scheduler.
Task Scheduler: A built-in cron-based scheduler lets you write RAT Script that runs automatically on a recurring schedule — hourly, daily, on specific days of the week, or any custom cron expression. Tasks can be enabled/disabled, triggered manually with Run Now, and each run is tracked and audited.

Game Server Script Functions: Seven new built-in script functions give event scripts direct control over the game server: `gs_start`, `gs_stop`, `gs_restart`, `gs_status`, `gs_broadcast`, `gs_countdown`, and `gs_countdown_cancel`. Countdowns support milestone announcements (T-60m through T-1s), configurable interval broadcasts, and cancellation. Broadcasts can be routed to in-game say, Discord, or both.

Text Match Event Type: A new `text.match` event type fires for every raw telnet console line, providing the full line as a `$raw_line` token. Use script conditions like `contains($raw_line, "...")` to react to any output the game server produces.

Administration

Owner Recovery Token
: Running `rat5-agent --issue-owner-token` starts the server normally and prints a one-time recovery token to the console log. Use the token from any connected RAT 5 Client to create a new Owner account, even when owner accounts already exist. This eliminates permanent lockout scenarios without touching the database.
Additions

• Pre-start config writing control — Added a managed server setting to choose whether RAT writes a fresh server config file before starting the game server.

Changes

• Managed restarts and world generation now use the latest RAT-managed config values at startup when that setting is enabled.

Fixes

• Fixed cases where managed startup paths could launch the game server without first applying the latest config values.
• Improved reliability around managed shutdown/startup handling tied to these server-setting flows.
Config and install menu items were not displaying in some conditions.