Skip to content

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.

ModuleDescription
arrowShows or clears the quest arrow at the edge of a player's screen, which points to a spot of the map.
bankOpens the players' bank boxes, as a banker does.
bleedBegins and ends the bleeding of a mobile, and tells whether it bleeds.
boardThe 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.
bookCreates and reads personalized scrolls from templates/books.
carveWhat a knife takes off a corpse: the carve tables of templates/carves.
championsWhat the scripts ask of the champion spawns: where the altar stands, and the exorcism.
clilocConstants for the client texts (cliloc numbers) that many scripts say, such as cliloc.TOO_FAR; pass them to mobile.message_cliloc.
combatStarts and ends the melee fights of mobiles, and tells whom a mobile fights.
commandsRuns the commands of the server, as its console or as a player.
craftThe crafts of data/crafts: their groups and recipes, and the resource lists they use.
diceRolls dice notation, such as 1d4+2.
effectPlays graphic effects for the players around: at a point, on a mobile or an item, flying between two, or a lightning bolt.
engineIdentifies the server running the script; read only.
eventsSubscribes functions to server events.
guildThe player guilds held by their guildstones: the roster, the fealty, the wars and the alliances.
gumpOpens the gumps of templates/gumps on players; their script gets the answer.
harvestWhat is gathered from the world and runs out by area, such as the fish of the sea.
helpWhat 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_pickerShows a player the client's hue picker and runs a function with the hue it picked.
itemReads and changes an item: name, amount, owner, consume, delete, message.
jailThe 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.
localizationGives the server texts in the server's language.
locationsThe 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.
logWrites to the server log.
mapShows map items to players and sets the area they show and their course of pins.
mobileActs 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.
moongatesThe public moongates of the loaded maps, from data/moongates.toml: the maps and the cities a gate can take a traveller to.
mountPuts a player on a mount, such as the ethereal horse of a statuette.
npcActs as an NPC: speaks, plays sounds, walks and reads where it is.
npcguildTakes members for the guild of a trade, as a guildmaster does.
partyThe parties of the players: who is in one, who leads it and who it holds.
petAsks about the creatures a player has tamed and tames a wild one, as the Animal Taming skill does.
profileThe profile of a player's character: the text the player writes about themselves.
promptAsks a player for a line of text and runs a function with what it typed.
scheduleThe 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".
skillTries a mobile at a skill, which may rise with the try.
spellThe spells of Magery: what a spell is, the spellbook, and casting.
stableLeaves a player's pets in the stable and takes them back, as a stablemaster does.
targetGives a player the target cursor and runs a function with what it picked.
timerSchedules functions on the game loop.
trainerTeaches skills for gold, as a trainer does.
vendorOpens the shop window of a vendor, as a vendor does.
worldAsks about the world: who stands where, whether a place is guarded, what time it is, the moons.
wait(seconds) -> number

Suspends 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

Buy me a coffee