Settings
A setting is a value an operator changes without editing the file.
settings = {
bosses = { kind = "set", of = "monster", default = { "01005" }, doc = "monster codes to announce" },
channel = { kind = "enum", values = { "world", "staff" }, default = "world" },
max = { kind = "int", min = 0, max = 1000000, default = 500 },
rate = { kind = "num", min = 0, default = 1.5 },
on = { kind = "bool", default = true },
greeting = { kind = "text", max = 120, default = "Hello!" },
lines = { kind = "list", max = 32, default = { "first", "second" } },
}
| kind | value in Lua | %mod set takes |
|---|---|---|
bool | true or false | on, off, true, false, 1, 0 |
int | a whole number; min and max bound it | 30 |
num | a number; min and max bound it | 0.5 |
text | a string; max bounds its length | the rest of the line |
enum | one of values | one of the values |
list | strings in order; max bounds the count | a, b, c or ["a","b"] |
set | a lookup table: m:setting("bosses")["01005"] is true | a, b, c |
A list typed with commas cannot hold an entry that contains a comma.
Checked Codes
A list or set may say of = "item", of = "monster" or of = "map". Every entry must then be a code this server knows, in any case, and the server stores it in the content's own spelling. The check runs when the file loads and on %mod set, and a wrong code is refused with the closest valid one. Without of, entries are free text.
Where Values Live
Read a setting with m:setting("name"). Values are stored in the game database, never in settings.ini. A value an operator set wins over the default in the file. A setting with nothing stored uses the default, so changing a default in the file changes it on the next reload.
%mod set pit_boss_alert quiet_seconds 300
%mod set pit_boss_alert bosses 01005,01006,06A13
%mod set global_notice messages First line,Second line
%mod set checks the value against the declaration and applies it at once. Every module also has a setting called enabled, which %mod enable and %mod disable change; you cannot declare your own.
Commands
commands = {
{ name = "bossalert test", level = 2, doc = "send a test notice",
run = function(m, caller, arg) return "sent" end },
},
player_commands = {
{ name = "bosses", cooldown = 10, run = function(m, player, arg) return "Up: ..." end },
},
doc and help both hold a command's description. arg is the rest of the line, trimmed. A command answers by returning a string, which the caller sees as a system line, and an error in the command is answered the same way.
The caller table carries id (the character), name, account, level (the STAFF level, not the character level) and player, the full player table.
Staff Commands
Staff type %bossalert test some text, or %mod bossalert test some text.
levelis the lowest staff level allowed: 1 Moderator, 2 Game Master, 3 Administrator, 4 Super Administrator. With no level, only level 4 may use it.- A name may be several words, and the longest matching name wins.
- A name may not start with one of the server's own commands, or be the start of one (
lv,gold,money,move,port,help,guild,chipwar,modand the rest of%help). The load refuses it and names the clash.
Player Commands
Players type .bosses in any chat channel.
- The prefix is
lua.player_prefix, one to three punctuation characters, and never%. - A line that names a module command is consumed and never broadcast. Any other line is ordinary chat.
cooldownis seconds per character, 1 by default.