Old School Ops

Running Modules

What happens when a module fails, the limits every module runs under, what a module cannot do, the %mod commands, the lua settings, and troubleshooting.

Applies to RF Online 4.55RF Online 4.15RF Online 1.5RF Online 2.2.3.2 · updated 2026-11-06
On this page

Switching One Module

commanddoes
%mod listwhat is loaded, with each module's commands
%mod statusevery module's state and counters
%mod status <module>one module: its settings, errors and gate counters
%mod reloadload or reload every module file
%mod disable <module>switch one module off, remembered across restarts
%mod enable <module>switch it back on, which also re-arms it after repeated errors
%mod set <module> <setting> <value>change one setting

When a Module Fails

A Lua error in a hook is logged with the file and line, counted in %mod status, and answered to the caller of a command. Ten errors inside a minute switch the module off until %mod enable, and its gates then answer with their fail policy. A module can switch itself off with m:disable("reason").

Catching an Expected Error

When an error is expected and harmless, such as a full bag or a player who logged out, catch it:

local ok, err = pcall(rf.give_item, id, "irtal01", 1)
if not ok then rf.notice(id, "Your bag is full.") end

A call that runs over its time or instruction budget is stopped, and pcall cannot catch that.

Limits

limitdefaultsetting
one event, timer, command or inbound message100 ms and 1,000,000 instructionslua.event_budget_ms
a gate20 ms and 200,000 instructionslua.gate_budget_ms
a damage gate20 ms and 20,000 instructionslua.damage_budget_ms
on_start, on_stop2 s
text built in one call64 MiB
events waiting per module1024lua.event_queue
modules gating one point4lua.max_gates
pending timers per module64
m:log lines20 a second; more are dropped and counted

A handler with a lot to do should do a batch and schedule the rest with m:after: Examples shows how.

What a Module Cannot Do

A module cannot read or write the game's own tables, send raw bytes, send anything to an official client, open files, or see another module's data.

Modules are code you run on your own server. Only Lua's base, string, table and math libraries exist; io, os, debug, package, coroutine, load and require do not. The standard and rf tables are read-only. print writes to the server log.

Troubleshooting

  • Nothing happens. Is lua.enabled on? Does %mod list show the module? Is the file directly in scripts/modules, not in examples/, and without a leading _?
  • %mod reload reports a problem. It names the file, the module and the key. An unknown key or event comes with the closest valid name.
  • A module stopped working. %mod status <module> shows its state, its counters and its last error. Fix the cause, %mod reload, then %mod enable <module>.
  • Lines from m:log are missing. More than 20 lines a second are dropped and counted.

The %mod Commands

commandlowest staff level
%mod reload3
%mod enable3
%mod disable3
%mod set3
%mod status1
%mod list1
%mod1

Server Settings

These are on the GameCP's Settings page, under Lua Modules.

settingdefaultwhat
lua.enabledtrueLua modules. The kill switch for every operator Lua module. ON by default: the server runs whatever modules are in the folder below, and an empty folder costs nothing. Turning it off stops every event, gate, command and timer within seconds, without a restart.
lua.dirmodulesModule folder. Where the module files are, relative to the server's scripts folder unless absolute. Default: "modules". A file whose name starts with _ is not loaded, and neither is the examples folder. Read at server start.
lua.player_prefix.Player command prefix. What a player types before a module's player command in chat. Default: "." (so .bosses). One to three punctuation characters, never %. Read at server start.
lua.strictfalseStrict module checking. Off by default: an unknown key in a module is a warning with a suggestion. On refuses the module instead. Read at server start.
lua.event_queue1024Event queue per module. How many events may wait for one module before new ones are dropped and counted. Default: 1024. Range 16 to 65536. Read at server start.
lua.max_gates4Modules per gate. How many modules may gate one gate point. Default: 4. Range 1 to 16. Read at server start.
lua.event_budget_ms100Handler budget (ms). How long one event handler, timer, command or inbound message may run. Default: 100. Range 1 to 2000. Read at server start.
lua.gate_budget_ms20Gate budget (ms). How long one auction, chat or loot gate may run before its declared fail policy answers. Default: 20. Range 1 to 500. Read at server start.
lua.damage_budget_ms20Damage gate budget (ms). How long one damage gate may run. It is on every hit, so keep it small. Default: 20. Range 1 to 100. Read at server start.
lua.damage_max_factor10Damage gate ceiling. The most a damage gate may multiply a hit by; a larger answer is clamped. Default: 10. Range 1 to 1000. Read at server start.
lua.breaker_errors10Errors before a module is switched off. How many errors inside the window below switch a module off until %mod enable. Default: 10. Range 1 to 1000. Read at server start.
lua.breaker_window_s60Error window (seconds). The window the error count above is taken over. Default: 60. Range 1 to 3600. Read at server start.
Something here wrong?

Out of date, incomplete, or assuming something it should not. Documentation errors are bugs, and this one arrives tagged and pointed at this page.

Top xp sources

How xp works
Loading…

Open the full search page