Lua API reference
Every module, function, constant and enum the server publishes to Lua scripts. These pages are generated from the server’s code on every build. To learn how scripts are written and loaded, read Writing Lua scripts.
Modules
Section titled “Modules”| Module | Description |
|---|---|
arrow | Shows or clears the quest arrow at the edge of a player's screen, which points to a spot of the map. |
bank | Opens the players' bank boxes, as a banker does. |
bleed | Begins and ends the bleeding of a mobile, and tells whether it bleeds. |
board | The bulletin boards: items whose template has the script bulletin_board, each with its own messages. A script opens one on a player, posts on it in any name, lists its messages and removes one. The module does not check who calls it nor how far anyone stands: the item script's on_use already asks for two tiles and sight, and a script for the staff checks world.is_staff first. |
book | Creates and reads personalized scrolls from templates/books. |
carve | What a knife takes off a corpse: the carve tables of templates/carves. |
champions | What the scripts ask of the champion spawns: where the altar stands, and the exorcism. |
cliloc | Constants for the client texts (cliloc numbers) that many scripts say, such as cliloc.TOO_FAR; pass them to mobile.message_cliloc. |
combat | Starts and ends the melee fights of mobiles, and tells whom a mobile fights. |
commands | Runs the commands of the server, as its console or as a player. |
craft | The crafts of data/crafts: their groups and recipes, and the resource lists they use. |
dice | Rolls dice notation, such as 1d4+2. |
effect | Plays graphic effects for the players around: at a point, on a mobile or an item, flying between two, or a lightning bolt. |
engine | Identifies the server running the script; read only. |
events | Subscribes functions to server events. |
guild | The player guilds held by their guildstones: the roster, the fealty, the wars and the alliances. |
gump | Opens the gumps of templates/gumps on players; their script gets the answer. |
harvest | What is gathered from the world and runs out by area, such as the fish of the sea. |
help | What the help gump needs from the server: the wait and the pause of the I am stuck button, the starting city nearest to a character, and the queue of the requests for the game masters (create, list, take, answer, close). The module does not check who calls it: a script that is for the staff checks world.is_staff first. |
hue_picker | Shows a player the client's hue picker and runs a function with the hue it picked. |
item | Reads and changes an item: name, amount, owner, consume, delete, message. |
jail | The jail of data/jail.toml: its cells and who is in them, sending a player or an NPC to a cell for some days, and releasing it early. The module does not check who calls it: a script that is for the staff checks world.is_staff first. |
localization | Gives the server texts in the server's language. |
locations | The named places of the loaded maps, from data/locations.toml: the tree of maps and categories the go gump lists, and the places a name finds. |
log | Writes to the server log. |
map | Shows map items to players and sets the area they show and their course of pins. |
mobile | Acts on a mobile in the world, a player or an NPC: teleports it, reads where it is, plays a sound on it, tells a player something. |
moongates | The public moongates of the loaded maps, from data/moongates.toml: the maps and the cities a gate can take a traveller to. |
mount | Puts a player on a mount, such as the ethereal horse of a statuette. |
npc | Acts as an NPC: speaks, plays sounds, walks and reads where it is. |
npcguild | Takes members for the guild of a trade, as a guildmaster does. |
party | The parties of the players: who is in one, who leads it and who it holds. |
pet | Asks about the creatures a player has tamed and tames a wild one, as the Animal Taming skill does. |
profile | The profile of a player's character: the text the player writes about themselves. |
prompt | Asks a player for a line of text and runs a function with what it typed. |
schedule | The calendar of data/schedule.toml: whether a seasonal event is on, the list of events, switching one on or off like the .event command, and when a timed task runs next. A script cannot add entries to the calendar: a custom action is a task with action = "lua". |
skill | Tries a mobile at a skill, which may rise with the try. |
spell | The spells of Magery: what a spell is, the spellbook, and casting. |
stable | Leaves a player's pets in the stable and takes them back, as a stablemaster does. |
target | Gives a player the target cursor and runs a function with what it picked. |
timer | Schedules functions on the game loop. |
trainer | Teaches skills for gold, as a trainer does. |
vendor | Opens the shop window of a vendor, as a vendor does. |
world | Asks about the world: who stands where, whether a place is guarded, what time it is, the moons. |
Globals
Section titled “Globals”wait(seconds) -> numberSuspends the running coroutine and resumes it on the game loop after the given seconds; it returns the seconds actually waited.
print(...)Writes its values, separated by tabs, to the server log at Information level.
Every published enum is a read-only global table, keyed by member name: see Enums.
Made with ❤️ by Tom
