Building: Libs
Updated at Sat Apr 11 21:00:02 2026
Modules
- Global Namespace
- Array
- body
- cash
- combat
- compat
- cryo
- effect
- eq
- file
- fluid
- justice
- loot
- make
- mission
- mud
- nations
- obj
- person
- pontoon
- roomgroup
- ships
- simulation
- skill
- state
- system
- table
- term
- trap
- util
- wild
void act (object what, string txt, nilobject target, nilobject prop, string arg)
uses /txt/ as the text of an action and performs it as /what/. %1 appears to be "you" to what. If specified /target/ and /prop/ are used. Not shown to sleeping viewers.
[[query]] string acts (object what, string txt, nilobject target, nilobject prop, string txt2)
format /txt/ as if it were an action string performed by /what/. Optionally make it a targettable action aimed at /target/. Optionally using /prop/. Optionally use /txt2/ if the action uses %s to specify some text.
[[query]] string acts2 (object observer, object what, string txt, nilobject target, nilobject prop, string txt2)
format /txt/ as if it were an action string performed by /what/, from the point of view of /observer/
int airtight_rooms (object room)
[[query]] object assume (nilobject what)
type casting function for static analysis
void awaymsg (object towho, object possiblyaway)
If /possiblyaway/ is away, inform /towho/. Messages only sent once in a 5-miute time period. No messaging is done unless both parties are players.
nilstring check_syntax (object on, string prop)
checks lua trap /prop/ on /on/ for syntactical correctness. Return a string containing the error message if it fails, or nil if it succeeds.
[[query]] set children (object what)
returns all objects directly in /what/
void close (object what, bool silent)
Closes /what/, if its state is not already 1. Sends messaging, if /silent/ is not set to true.
[[pure]] void debug (any varargs)
int depressurise (object ob, bool silent)
bool destroy_coroutine (int i)
Deletes coroutine /i/ from the persistent coroutine table. Returns true if deletion was successful.
[[query]] string do_look (object observer, object where, object forwho, bool showyouare, bool shownvg, bool showexits, bool showlinked)
Returns the description of /where/ as if /observer/ had just used 'look' there. Colour and paragraphing choices are taken from /forwho/. /showyouare/ controls display of the 'you are' header line. /shownvg/ controls display of 'You are forced to wear your night vision' messaging. /showexits/ controls display of the 'obvious exits' block. /showlinked/ controls listing of players and mobiles in linked locations.
[[query]] string drunkify (object who, string txt)
mangle the text /txt/ to make it as spoken by /who/. Does slurring, mog conversion, literacy filter, etc.
void endpager (player who)
activate the pager upon /who/. done automatically if not done in a trap.
[[pure]] int findflag (string what)
returns the flag named /what/
[[pure]] int findpriv (string what)
returns the pflag named /what/
[[pure]] string flagname (flag f)
returns the name of flag with identifier /f/
[[query]] nilobject get (string id, bool wantreal)
looks up the object with specified /id/. if you are in a simulation, returns the simulated clone of it if applicable, unless /wantreal/ is 1.
int get_max_opcount ()
int get_opcount ()
[[query]] bool getapriv (object o, priv f)
returns 1 if /o/ has priv /f/ but has put it in abeyance (perhaps they remorted), otherwise nil.
[[query]] table getarr (object what, key id)
return JSON bundle /id/ on /what/ or if not present, nil
[[query]] bool getflag (object o, flag f)
returns 1 if /o/ has flag /f/, otherwise nil. Flag constants look like 'flag.Fixed'
[[query]] float getfloat (object what, key id, float d)
[[query]] nilobject getobj (object what, key id)
returns object property /id/ on /what/ or if not present, nil
int getopcount ()
gets the number of ops executed so far by the current lua script
[[query]] bool getpriv (object o, priv f)
returns 1 if /o/ has priv /f/, otherwise nil. Priv constants look like 'priv.God'
[[query]] table getprops (object what, string pref)
returns a table with all the properties on /what/ (only those starting with /pref/ if specified)
[[query]] bool getrflag (object o, flag f)
returns 1 if /o/ has flag /f/ set as a "reset flag" (eg. saved to disk, not cleared on reset).
[[query]] int getstate (object what)
returns which state /what/ is in
[[query]] nilstring getstr (object what, key id)
returns string property /id/ on /what/ or if not present, nil
table import (object from, nilstring prop)
executes trap /prop/ (defaults to "lua.lib") on /from/ and returns the result. Usually used to return a table of functions.
[[query]] bool is_dark (object where)
Is /where/ a dark room, or is it outdoors at night?
[[query]] bool is_illuminated (object where)
Are there any sources of light in /where/?
[[query]] bool is_valid_object (object what)
returns true if /what/ is a valid reference, or /false/ if the MudObject /what/ references has been deleted.
[[query]] string lang (string txt, object who)
translates the text /txt/ according to the language /who/ is speaking
[[query]] vector light_sources (object where)
Gets all the sources of light in /where/
void lock (object what, bool silent)
Locks /what/, if its state is not already 2, closing if it its state is not already 1. Sends messaging, if /silent/ is not set to true.
nilstring mail (string to, string from, string subj, string content)
sends a timestamped mail to /to/, from /from/, with the subject /subj/ and the body /content/. Returns nil on success, or an error message on failure.
int maxopcount ()
gets the maximum number of ops this lua script can execute before being forcibly terminated
[[query]] vector minis ()
returns all minimission templates
table mudarray (table a)
turn a lua integer indexed, 1-based table to a zero-based table with a count attribute for use by the innards of the mud
[[query]] string name (object what)
function not_equal (any arg)
void oact (object what, string txt, nilobject target, nilobject prop, string arg)
uses /txt/ as the text of an action and performs it as /what/. doesn't get sent to /what/. If specified, /target/ and /prop/ are used. Not shown to sleeping viewers.
void oact2 (object what, string txt, nilobject target, nilobject prop, string arg)
uses /txt/ as the text of an action and performs it as /what/. doesn't get sent to /what/ or /target/. If specified, /target/ and /prop/ are used. Not shown to sleeping viewers.
void open (object what, bool silent)
Opens /what/, if its state is not already 0. Sends messaging, if /silent/ is not set to true.
void others (object what, string txt, filter filter_fn)
send /txt/ to everything in the same room as /what/. Optionally, only show the message to objects matching /filter_fn/. newline not needed.
void othersf (object what, object avoid, string fmt, object varargs)
format /fmt/ according to internal mud printf rules and send to everyone in the same room as /what/ except /avoid/
[[query]] object owner (object o)
returns the object that /o/ is in
int pressurise (object ob, bool silent)
[[pure]] string privname (priv p)
returns the name of pflag with identifier /p/
any proxy_table (any table)
[[query]] set quests ()
returns all quests
int random (int range)
returns number between 0 and /range/-1
any random_choice (any choices)
table randomname (string section, nilstring nation)
returns firstname and surname. /section/ should be male or female
[[query]] any rawget (any t, any n)
[[query]] set recchildren (object what)
returns all objects in /what/, or in objects in those, etc.
int register_coroutine (function f, bool autoresume)
registers /f/ as a persistent coroutine. If /autoresume/ is true, the coroutine will be automatically resumed by the mud every tick. Otherwise, you must resume the coroutine at least once to prevent it being reaped
void sendf (object what, string fmt, object varargs)
format /fmt/ according to internal mud printf rules, and send to /what/
void sendr (object what, string txt, bool exclude_linked, filter filter_fn)
send /txt/ to everything in the room /what/. Also sends to any linked rooms unless exclude_linked is set to 1
void sendrg (object where, string mesg, bool spread, object comefrom)
void sendzone (zonetag zone, string txt)
send /txt/ to all players in rooms with zone /zone/
void sendzonebut (zonetag zone, object notr, string txt)
send /txt/ to all players in rooms with zone /zone/, except for those in /not/
void set (object what, key id, object val)
sets property /id/ on /what/ to /val/
void setarr (object what, key id, table val)
sets property /id/ on /what/ to table /val/
void setbflag (object o, flag f, bool v)
sets the current and reset flag /f/ on /o/ to /v/
void setflag (object o, flag f, bool v)
sets the flag /f/ on /o/ to /v/
void setfloat (object what, key id, float value)
void setstate (object what, int n)
sets /what/ to be in state /n/
[[query]] vector starting_children (object what)
returns all objects that originate and are curerently in /what/
void startpager (player who, bool pagercodes)
start the pager on /who/. all further output sent to them will be send instead to a file and then paged back to them later. If specified, pagercodes will be handled when the output is shown to the user.
void syslog (priv pfl, string cat, object who, string msg)
generate a log message /msg/ from /who/ in category /cat/, displayed to those with pflag /pfl/
void syslog2 (priv pfl, flag fl, string cat, object who, string msg)
generate a log message /msg/ from /who/ in category /cat/, displayed to those with pflag /pfl/ and hidden from those with flag /fl/
[[query]] nilobject tryget (string id, bool wantreal)
same as get but hints to our static analysis that you are ok if the literal string passed in doesn't exist
[[query]] string type (void something)
returns "nil", "number", "string", "table", "function" or "userdata", depending on /something/.
void unset (object what, key id)
removes the property /id/ on /what/
[[query]] untainted untaint (string what)
type casting function for static analysis
[[query]] object void ()
return the empty room or void where vanished objects go.
Array
void Array.clear ()
Array member function. Removes all elements from an array.
void Array.contains (value what)
Array member function. Returns true if the array contains value /what/
void Array.find_and_remove (value what)
Array member function. If the array contains /what/, removes the first occurrence and returns 1. Otherwise returns nil.
void Array.find_and_remove_all (value what)
Array member function. If the array contains /what/, removes all occurrences of it and returns 1. Otherwise returns nil.
void Array.insert (value what, int where)
Array member function. Inserts /what/ at index /where/, or at the beginning of the array if /where/ is unspecified.
array Array.new (object on, string arrayname)
retrieves or creates the array called /arrayname/ on /on/
void Array.remove (int where)
Array member function. Removed the element at index /where/
iterator Array.values ()
Array member function. A loop iterator. Use like "for i,v in myarray:values() do"
body
[[query]] string body.action (object who, nilstring original)
get the (possibly mogged) action string associated with /who/ emoting /original/ (or the default action text)/
[[query]] float body.blood_alcohol (object who)
The blood alcohol percentage of /who/
[[query]] bool body.can_breathe_air (object who)
Can /who/ breathe air without artificial assistance?
[[query]] bool body.can_breathe_water (object who)
Can /who/ breathe underwater without artificial assistance?
[[query]] bool body.can_fly (object who)
Can /who/ fly?
[[query]] bool body.can_heal (object who)
can /who/ regenerate damage naturally?
[[query]] bool body.can_swim (object who)
Can /who/ swim?
[[query]] bool body.can_talk (object who)
Can /who/ talk?
[[query]] bool body.can_walk (object who)
Can /who/ walk on land?
[[query]] int body.get_attribute (object who, int attribute)
get the standard attribute /attribute/ (from the attribute table) value of /who/. Takes into account mog, implants, etc.
[[query]] nilstring body.getstr (object who, key what)
Gets string property /what/ from the body object of the species that /who/ belongs to, or one of its ancestors.
[[query]] bool body.has_legs (object who)
Does /who/ have any legs?
[[query]] void body.set_attribute (object who, int attribute, int value)
sets the value of the standard attribute /attribute/ on /obj/
[[query]] nilstring body.species (object o)
returns the name of the species of /o/
[[query]] object body.species_object (object o)
returns the body template object corresponding to the species of /o/
[[query]] string body.vocalisation (object who, nilstring original)
get the (possibly mogged) speech associated with /who/ saying /original/ (or the default speech text).
cash
[[query]] int cash.balance (object o, object cur)
obtain the /cur/ balance of /o/
[[query]] int cash.convert (int amt, nilobject from, nilobject to)
convert /amt/ from /from/ to /to/. if /from/ or /to/ is nil, this means ICUs
[[query]] vector cash.currencies ()
return all the currencies defined in the game
[[query]] object cash.currency (object o)
returns the preferred currency that /o/ uses
void cash.dofine (object mob, object victim, int amount, object cur)
pay /amount/ units in /cur/ from /from/ to /to/
[[query]] string cash.format (int amt, object o, bool long_form)
format /amt/ which is denominated in /o/. l can be 1 to indicate long format
[[query]] int cash.get (object o, object cur)
obtain the amount of /cur/ that /o/ is carrying
void cash.give (object who, int amount, object curr)
give /who/ /amount/ in /curr/
object cash.match (table args, object currency)
matches a currency amount in string table /args/. Defaults to /currency/ if no explicit currency is named. Returns the matched currency object and the numerical value of the matched amount.
void cash.pay (object from, object to, int amount, object cur)
pay /amount/ units in /cur/ from /from/ to /to/
void cash.set (object o, object cur, int amt)
set the amount of /cur/ that /o/ is carrying to /amt/
void cash.transaction (object o, nilobject source, int amt, string note, object cur)
modify /o/'s account in /cur/ by /amt/ units
[[query]] int cash.value (object o)
how much is /o/ worth in ICUs
[[query]] int cash.value_at (object what, object shop, object who)
void cash.wipe (object who)
kill all cash held by /who/
combat
void combat.startfight (object attack, object victim)
makes /attack/ start a fight with /victim/
void combat.stopfighting (object who)
stop /who/ fighting. Note that combat will automatically restart unless you call stopfighting on all participants in a fight.
compat
void compat.doaction (object who, object targ, string cmd)
make /who/ do /cmd/ at /targ/. use interpret instead.
[[query]] string compat.id (object what)
returns the id of /what/. use get(what, "id") instead.
void compat.killroom (object room, string why)
kill the entire /room/ because /why/
void compat.rawsend (object what, string txt)
send /txt/ as-is to /what/ without appending a newline.
void compat.restorestuff (object what)
puts /what/ back in their original body with their original stuff.
cryo
[[query]] nilobject cryo.anyfreedock (object dock)
returns a random free dock which is free, from the list of docks on /dock/
[[query]] nilobject cryo.anyfreequarters ()
return some random free quarters anywhere on the station
[[query]] nilobject cryo.findport (string code)
given a port /code/ (like "BCR"), return a dock object
void cryo.mushroom (object who)
makes /who/ go to the mushroom zone
void cryo.takeevidence (object who, object what, string z)
make /who/ take everything from /what/ in zone /what/ as evidence.
effect
[[query]] nilobject effect.addtimer (object on, string endlua, int duration)
spawn a simple timed effect, triggering /endlua/ after /duration/ seconds.
[[query]] vector effect.get (object who)
returns all effects targetted at /who/
[[query]] vector effect.get_template (object who, object templ)
returns all effects targetted at /who/ based on effect template /templ/
void effect.purge (object who, bool noaftereffect)
causes every effect targetted at /who/ to timeout. The effect's /endlua/ will not be triggered if /noaftereffect/ is true
nilobject effect.spawn (object on, object efftemplate, object source)
creates a new effect based on an existing template /efftemplate/. /source/ is the cause object for audit purposes.
nilobject effect.spawn_plain (object on, string name, int duration, object source, string ticklua, string endlua)
spawns a custom effect object on /on/, calling /ticklua/ every second for /duration/ seconds and /endlua/ when the time runs out. /name/ and /source/ are for cosmetic/audit/debug purposes only.
void effect.timeout (object effect, bool noaftereffect)
finishes effect /effect/. the effect's /endlua/ will not be triggered if /noaftereffect/ is true
eq
[[query]] string eq.abilities (object what)
returns a string describing the capabilities of /what/
[[query]] nilobject eq.airsupply (object who, bool hostile)
returns the object that is providing /who/ with air. This can be /who/ itself, or nil if they are asphyxiating. Set /hostile/ to 1 if you want to check if they could survive in a hostile atmosphere even if they aren't currently in one.
[[query]] int eq.armour (object who)
returns the total value of armour worn by /who/, plus their natural armour
[[query]] vector eq.clothing (object who)
returns all clothing worn by /who/. Includes wornfrom equipment.
set eq.dragged (object what)
returns the objects that are currently trying to drag /what/, if any.
[[query]] string eq.format_wornon (string wornon, object who)
[[query]] nilobject eq.get_wornfrom (object what)
returns the object from whom /what/ will inherit clothing and equipment, if any
[[query]] set eq.held_items (object who)
return sall the objects /who/ is gripping in their hands, including weapons.
bool eq.hold (object who, object what, nilstring hand)
set /what/ as held by /who/ without any messaging. Be aware that this skips some logic called by the hold verb which you should use instead in most cases. Returns true if holding was successful.
[[query]] vector eq.implants (object who)
returns all cybernetic implants installed in /who/. Includes wornfrom equipment.
[[query]] bool eq.is_storeable (object what)
returns true if /what/ could be saved for a player upon quit, or kept in quarters over a reset or reboot
[[query]] nilobject eq.spacesuit (object who)
returns the object that is protecting /who/ from vacuum (and some other hostile environments)
void eq.unhold (object who, object what)
unset /what/ as gripped by /who/ without any messaging.
void eq.unwield (object who, object what)
unset /what/ as a weapon of /who/ without any messaging.
[[query]] nilobject eq.weapon (object who)
return the object that /who/ is wielding. Includes wornfrom equipment. Use the weapons hook instead.
[[query]] set eq.weapons (object who)
return all the objects that /who/ is wielding.
bool eq.wear (object who, object what)
make /who/ wear /what/. Only invokes the most minimal wearability logic (check that nothing else is worn on the same location at the same wornlevel), and so shoudl be avoided in most cases. Returns true if wearing suceeded.
[[query]] bool eq.wears (object who, object what)
return true if /who/ is wearing the actual object /what/
[[query]] bool eq.wears_clone (object who, object what)
return true if /who/ is wearing the actual object /what/
bool eq.wield (object who, object what, nilstring hand)
set /what/ as weapon of /who/ without any messaging. Be aware that this skips some logic called by the wield verb which you should use instead in most cases. Returns true if wielding was successful.
[[query]] nilobject eq.wornon (object who, string where)
returns the outermost clothing worn by /who/ on their /where/
file
[[query]] int file.player_getint (string id, key attribute, int def)
returns the value of attribute /attribute/ associated with (possibly offline) player /id/.
[[query]] nilstring file.player_getstr (string id, key attribute)
returns the value of attribute /attribute/ associated with (possibly offline) player /id/.
void file.player_set (string id, key attribute, int value)
sets or updates the value of /attribute/ on (possibly offline) player /id/.
void file.player_unset (string id, key attribute)
removed attribute /attribute/ from (possibly offline) player /id/.
string file.view (string domain, string name)
shows the raw file contents of /domain/ file /name/. Domain is something like /help/ or /info/ and should be all lower case. /name/ should not have any file suffices such as ".i" for info files.
fluid
[[query]] int fluid.capacity (object where)
returns the remaining volume in /where/, taking into account fluid contents
[[query]] nilstring fluid.describe (object fluid)
returns a string describing the fluids in /where/, or nil if /where/ is dry
[[query]] nilstring fluid.describe_in (object where)
returns a string describing the fluids in /where/, or nil if /where/ is dry
void fluid.fill_with_fluid (object where, object fluid)
remove all fluids from /where/ and fill with /fluid/#include "justice.h"
[[query]] nilobject fluid.get (object where)
get the object defining the fluids in /where/, or nil if it is dry.
void fluid.vanish_contents (object where)
removes all fluids from /where/
[[query]] int fluid.volume (object fluid)
returns the volume of fluid object /fluid/
[[query]] int fluid.volume_in (object where)
returns the volume of fluid in /where/
justice
void justice.arrest (object crim, object victim, string help)
/victim/ will cry /help/ on the intercom. this will cause the arrest of /crim/ if in policed area.
[[query]] bool justice.arrested (object who)
is /who/ under arrest internationally, or within the current jurisdiction?
void justice.fine (object who, int amount, string why, object jur)
place a fine on /who/, value of /amount/ ICUs, with /why/ on their record in /jur/ if specified, otherwise the jurisdiction of the room they are in.
[[query]] nilobject justice.interviewroom (object where)
find the police interview room associated with /where/
[[query]] nilobject justice.jurisdiction (object where)
return the jurisdiction that applies in /where/
[[query]] string justice.jurisdiction_name (object where)
returns the name of the jurisdiction that applies in /where/
[[query]] nilobject justice.police_station (object where)
returns the police room associated with /where/
loot
any loot.fill_with (object substance)
void loot.make (object target, table loot_table, any maker)
any loot.random_cash (int amount)
make
object make.autoclone (object what, object where, zonetag zone)
clones a /what/ and places it in /where/. creates auto objects too. everything'll be part of /zone/
[[query]] nilstring make.cantedit (object who, object what)
if /who/ is not allowed to alter the properties of /what/, return a string detailing the reason. Returns nil if there are no permissions problems
[[query]] nilstring make.cantexec (object who, object what)
if /who/ is not allowed to make /what/ run commands, return a string detailing the reason. Returns nil if there are no permissions problems
[[query]] nilstring make.cantstat (object who, object what)
if /who/ is not allowed to view the properties of /what/, return a string detailing the reason. Returns nil if there are no permissions problems
[[query]] nilstring make.canttouch (object who, object what)
if /who/ is not allowed to alter temporary properties of /what/, return a string detailing the reason. Returns nil if there are no permissions problems
object make.clone (object what, object where, object mis)
clones a /what/ and places it in /where/
object make.clone_ship (object what, object mission, zonetag zone)
clones ship template /what/ for /mission/
object make.copy_object (object what, object where, string newid, nilstring newzone)
copies /what/ and places it /where/. By default it will be in the same zone as /what/, unless you specify otherwise. WARNING! This is a *permanent* object, and will remain after the zone is reset.
object make.create_exit (object from, string dir, object dest, bool create_reverse)
object make.create_temporary (string id)
Creates a temporary object with the supplied ID. Object will cease to exist when it is no longer referenced by your script.
void make.debug (bool dstate)
set detailed debugging to be on or off
[[query]] bool make.debugging ()
are we doing a detailed lua debug right now?
object make.deserialise (string text, nilstring id)
deserialises /text/ into a temporary object that isn't accessible via the main mudobject index, and will be automatically deleted when the last reference to it is removed. If /id/ is set, overrides any id specificied in /text/.
void make.index (object o)
Inserts temporary object /o/ (eg. created bu make.create_temporary or make.deserialise) into the global MudObject index. Will error if the id of /o/ already exists in the index.
[[query]] bool make.isdirty (object what)
returns true if /what/ has unsaved changes
void make.log (string msg)
generate a "fiddle" logmessage, only shown to those with the "SeeEditSpam" flag
[[pure]] string make.opposite_direction (string orig)
void make.reset (object what)
resets /what/ to its starting conditions
[[query]] string make.serialise (object what)
returns the serialised form of /what/
[[query]] nilstring make.validate_identifier (string what)
checks if /what/ is a reserved word, zone, object, player or verb ID. Returns null if not, or an error message if it is.
mission
[[query]] bool mission.accepted (object who, object mission)
return true if /who/ has accepted /mission/
void mission.clearmini (object obj)
makes /obj/ a freestanding object that isn't associated with a mission
[[query]] bool mission.done (object who, object what)
return true if /who/ has done mission, minimission or simulation /what/
void mission.fail (object who, object mis, nilstring why)
mark /who/ as having failed mission or minimission /mis/, with optional logmessage /why/
[[query]] nilobject mission.find (string what)
returns the mission object for the mission /what/
[[query]] nilobject mission.find_by_name_or_id (string str, object who)
[[query]] object mission.get (object o)
return the mission object for mission with id /o/
[[query]] object mission.getmini (object blah)
returns the minimission that owns /blah/
void mission.give (object who, object what)
grant /who/ mission, minimission or simulation /what/ with a cash reward, if one was set
void mission.grudge (object who, object what)
grant /who/ mission, minimission or simulation /what/ with no cash reward
[[query]] bool mission.ismission (object what)
returns true if /what/ is a mission, minimission or simulation which will be listed under the 'sims' command and is a valid argument for mission::done
[[query]] vector mission.mini_instances (object mission)
returns all the instances of minimission /mission/.
[[query]] int mission.mpoints_rank (int mpoints)
returns the rank granted to a player with /mpoints/ mission points.
[[query]] int mission.mpoints_required (int rank)
returns the number of mission points required to reach rank /rank/
[[query]] set mission.objects (object what)
returns all the objects belonging to minimission instance /what/, or the minimission instance that owns /what/.
[[query]] int mission.reward (object who, object mission)
returns the reward value for /mission/ adjusted for the rank of /who/
[[query]] nilobject mission.runner (object mission)
return the player who has currently accepted /mission/, if any. Only works on full missions, not mini templates.
[[query]] vector mission.running (object who)
void mission.setmini (object obj, object mis)
associates the object /obj/ with the minimission /mis/. The object will be destroyed with the minimission.
mud
mud. (string planet)
[[query]] int mud.abv (object what)
the amount of alcohol by volume in /what/. 100% alcohol means an abv level of 10000
[[query]] bool mud.actionverb (string vn)
returns true if the string /vn/ corresponds to a currently existing action
[[query]] vector mud.all_worn_or_implant_with_flag (object o, flag f)
return all objects worn by or implants installed in /o/ which have the flag /f/.
[[query]] vector mud.allholdsclone (object o, object f)
return all objects recursively in /o/ which are /f/ or are clones of /f/
[[query]] vector mud.allholdsflag (object o, flag f)
return all objects recursively in /o/ which have the flag /f/. includes /o/ if applicable.
[[query]] vector mud.allobjects ()
returns all objects in the mud
[[query]] vector mud.alltreatas (object o, object f)
return all objects recursively in /o/ which are /f/ or inherit from /f/
[[query]] vector mud.allzones ()
returns all the zones in the mud
[[query]] nilobject mud.anychildfrom (object blah)
return a random object/player/room etc from /blah/
[[query]] nilobject mud.anychildwithflag (object blah, flag flag)
return a random object from /blah/ with /flag/
[[query]] nilobject mud.anyobjectfrom (object blah)
return a random object from /blah/
[[query]] nilobject mud.anyplayerfrom (object blah)
return a random player from /blah/
[[query]] nilobject mud.anyroominzone (zonetag zone)
returns a random room from /blah/
[[query]] nilobject mud.archetype (object o)
returns the racial or national archetype object for o
void mud.broadcast (object forwho, string msg)
[[query]] bool mud.can_fly (object who)
return true if /who/ can fly (is an avian or has CanFly)
[[query]] bool mud.can_see_in (object who, object where)
can /who/ see in /where/? takes into account nightvision, etc
[[query]] bool mud.canattack (object who, object what)
return true if /who/ can attack /what/ without getting arrested
[[query]] bool mud.cansee (object who, object whoelse)
can /who/ see /whoelse/? takes into account privs and invisibility levels, etc
bool mud.check_for_blocking (object who, object where, object dir, bool incombat)
triggers blocking behavious of mobiles in /where/ when /who/ tries to go /dir/. Returns false if blocking occurred.
[[query]] bool mud.contains (object o, object w)
returns true if /w/ is in /o/ either directly or via other objects, otherwise false.
int mud.damage (object who)
returns the total amount of damage that can be done by /who/, including their current weapon
[[query]] bool mud.dead (object what)
return true if /what/ is dead
[[query]] string mud.defaultrank (int level)
returns the default rank corresponding to /level/
[[query]] string mud.describe (objvector o)
return a string describing the objects in /o/, for example "two trees, eleven jellybabies and a helicopter"
[[query]] string mud.describe_for (objvector ow, object who)
return a string describing the objects in /o/, for example "two trees, eleven jellybabies and a helicopter"
[[query]] string mud.describe_location_of (object what)
says the name of /what/s owner, and if what is being worn, wielded, etc
table mud.destinations (object where)
returns a table containing directions and destinations from /where/ without instantaiting any rooms
void mud.dismount (object o)
makes /o/ stop riding anything
void mud.do_arrival (object who, object from, object dest)
do all the after-room-change trap triggering at /dest/ and state fixing on /who/, as if they'd just come from /from/
int mud.empty_ship (object o)
empties the ship /o/ of all players. returns how many there were.
[[query]] table mud.exits (object o)
[[query]] nilobject mud.find_object (object forwho, string what, bool wantreal)
try to match /what/ as an object from /forwho/s point of view. Will not return objects by ID for mortals, or objects that /forwho/ cannot see, or any exits.
table mud.find_route (who , from , to )
finds a route for /who/ from /from/ to /to/. Returned as a table of (direction, destination id) string pairs
[[query]] nilobject mud.findpit (object in)
Find a pit object inside object /in/
[[query]] bool mud.forced (object o)
returns true if /o/ is being forced to do whatever calls this lua
[[query]] string mud.format_mass (int mass, player p)
return a nicely formatted string describing mass /mass/ grammes in playter /p/s preferred units
[[query]] string mud.format_roomname (object room, object play, nilstring ic, nilstring oc, nilstring sin)
return preposition-prefixed form of /room/'s name, from the pov of /play/. The room name will be wrapped with /ic/ and /oc/ (eg, to colour it), if set. If /sin/ is set to "to", the preposition will be changed to a "to" form, eg "in" will become "into".
[[query]] nilobject mud.freequarters (object of)
find out whether there are any free quarters referred to by the quarters office /of/
[[query]] char mud.gender (object o)
returns a one-char string which is 'm', 'f', 'n', 'a', etc, or '?'
[[query]] nilobject mud.getfloor (object o)
returns the floor of given room
[[query]] nilobject mud.getmount (object o)
returns the thing /o/ is riding, if any
void mud.give (object from, object what, object dest)
makes /from/ give /what/ to /dest/
[[query]] vector mud.globalwithflag (flag f)
returns all objects in the mud which have flag /f/ set.
void mud.harm (object who, int amount)
remove /amount/ health points from /who/
[[query]] bool mud.has_commbadge (object o)
returns true if /o/ is wearing a commbadge, has a commbadge implant, has commbadge prives or is in a commbadge-enabled zone
[[query]] bool mud.has_vision (object who)
can /who/ see anything at all?
void mud.heal (object who, int amount)
heal /who/ up to /amount/ health points (which may be negative, which may cause death).
[[query]] int mud.health (object who)
return the amount of health /who/ has. Will return simulated health if they are in a simulation.
[[query]] nilobject mud.holdsclone (object o, object c)
if /o/ holds any clones of /c/, return one of them. recurses into containers.
[[query]] nilobject mud.holdsflag (object o, flag f)
returns true if /o/ holds any object with flag /f/
[[query]] nilobject mud.holdszone (object o, string z)
returns any object held by /o/ with zone /z/
[[query]] bool mud.is_drink (object what)
whether /what/ is drinkable
[[query]] bool mud.is_food (object what)
whether /what/ is edible
[[query]] bool mud.is_jammed (object o)
return true is /o/ is within the area of effect of a jammer
[[query]] bool mud.is_planet (string planet)
[[query]] bool mud.is_zone (string zn)
returns true if /zn/ is the id of a zone
[[query]] bool mud.isverb (string vn)
return true if the string /vn/ corresponds to a currently existing command, alias or action
object mud.kill (object who, nilstring msg, nilobject source, nilstring type)
make /blah/ die, with log message /source/ (/cause/) /msg/ (each of which can be nil). returns the corpse if any, which you should set a cause of death on.
[[query]] nilobject mud.leader (object o)
returns the object /o/ is following, if any
[[query]] bool mud.linked (object from, object dest)
are /from/ and /dest/ linked?
void mud.long_drop (object who, object ground, nilstring logmsg, nilobject paraground, bool silent)
move /who/ to /ground/, as if they have fallen a very long way. Tests for parachuting (to /paraground/ if set) and death. /silent/ suppresses messaging and /logmsg/ overrides default death log.
[[query]] string mud.longdefaultrank (int level)
returns the long default rank corresponding to /level/
[[query]] int mud.mass_capacity_left_in_grams (object o)
[[query]] int mud.mass_within (object o)
return the mass of the children of /o/ recursively, in grams
[[query]] vector mud.match_opt (object who, table arg, int options, objset from, filter filter_fn)
try to match /arg/ from the point of view of /who/, given the matcher flags /options/. Matcher flags look like match.LookBoth. If you set /options/ to match.LookSpecial and supply a table of objects to /from/, match_opt will try to match an object in that table.
[[query]] vector mud.matchcont (object who, table arg, object container)
try to match /arg/ from the point of view of /who/ - only look in inventory
[[query]] vector mud.matchinv (object who, table arg)
try to match /arg/ from the point of view of /who/ - only look in inventory
[[query]] nilobject mud.matchplayer (object who, string str)
try to match /str/ to a person, from the point of view of /who/
[[query]] vector mud.matchprep_opt (object who, table arg, int options, string prep, objset from, filter filter_fn)
try to match /arg/ from the point of view of /who/, looking for /prep/, applying match options as described under match_opt
[[query]] int mud.max_health (object who)
returns the maximum amount of health /who/ could have.
[[query]] int mud.maxlevel (object what)
the maxlevel on the specified object, converted to a rank number if necessary
[[query]] int mud.minlevel (object what)
the minlevel on the specified object, converted to a rank number if necessary
[[query]] bool mud.mobile (object o)
returns true if /o/ a mobile
void mud.mount (object who, object what)
makes /who/ mount /what/. No sanity checking is done whatsoever! Terminates existing mount with no messaging.
[[query]] bool mud.naked (object who)
returns true if /who/ is naked
void mud.name_mobile (object mob, nilstring nation)
give /mob/ a random human name
[[query]] string mud.nation (object what)
returns the nation of /what/
[[query]] string mud.parse_emote (object o, string a)
parse an emote string for @targets.
[[query]] bool mud.person (object o)
returns true if /o/ is a player or a mobile
table mud.planet_objects (string planet)
Returns all the objects belonging to all the zones associated with /planet/, or nil if there are none.
table mud.planet_zones (string planet)
Returns all the zones associated with /planet/, or nil if there are none.
[[query]] bool mud.player (object o)
returns true if /o/ a player
[[query]] string mud.player_name (string id)
returns the colour and capitalised name of the player with /id/, who need not be logged in
[[query]] int mud.privs (object who)
returns the effective level that /who/ is at, taking into account remort
[[query]] nilobject mud.quarters (object of, string area)
return the quarters belonging to /of/, if any
[[query]] int mud.ran_level (object who)
return the level that /who/ has actually run to
string mud.randomname (string section, nilstring nation)
generic random name. returns a name from the /section/ array on the names object /nation/
[[query]] string mud.rankname (object who)
returns the full form of /who/'s rank as a string
[[query]] object mud.rankobj (object who)
returns the rank object associated with /who/s service and nationality
int mud.rankprivs (string rankname)
returns the privs level associated with rank /rankname/
[[query]] vector mud.realobjects ()
returns all non-destroy-on-reset, non-wilderness, non-transient, non-exit objects in the mud
[[query]] set mud.riders (object o)
get the riders of the mount /o/
[[query]] int mud.serving (object what)
the serving size of /what/, or the serving size of it's empty object
void mud.set_health (object who, int new_value)
return the amount of health /who/ has. Will return simulated health if they are in a simulation.
void mud.setfloor (object where, object newfloor)
If /where/ has a floor, swaps the old floor with /newfloor/ and moves everything that was upon it onto the new floor. Otherwise simply adds the floor and rectifies the state of all the children of /where/.
[[query]] nilobject mud.ship (object of)
return the spaceship belonging to /of/, if any
[[query]] string mud.short_rank (object who)
returns the short form of /who/'s rank as a string
bool mud.traverse (object who, object link, nilstring motionverb)
makes /who/ traverse the exit /link/
[[query]] bool mud.wearsclone (object o, object c)
returns true if /o/ wears any clones of /c/
[[query]] nilobject mud.wearsflag (object o, flag f)
if /o/ wears any objects or has any implants with flag /f/ return one of them. otherwise return nil.
[[query]] bool mud.zone_getflag (object where, flag f)
[[query]] int mud.zone_getint (object where, key prop, int def)
attempt to get an int property /prop/ from /where/, and recursing upwards through its parents folloing fwd links. Returns /default/ if no property is found.
[[query]] nilstring mud.zone_getstr (object where, key prop, nilstring def)
attempt to get a string property /prop/ from /where/, and recursing upwards through its parents folloing fwd links. Returns /default/ if no property is found.
nations
[[query]] bool nations.match (object a, object b)
returns true if the nation strings of /a/ and /b/ intersect
obj
[[query]] any obj.attributes (object what, string pref)
returns a table with all the attributes on /what/ (only those starting with /pref/ if specified). Unlike getprops, attribute values are not returned.
[[query]] string obj.brief_state (object what)
returns a short descriptive string decribing the state of /what/, eg. on fire.
void obj.cancel_plan (object what)
immediately cancels any pending plans on /what/.
void obj.close (object o)
closes door or container /o/ with no messaging. Does not check if there is an 'other' object to close.
[[query]] bool obj.closed (object o)
returns true if /o/ is closed (applies to containers and doors)
[[query]] set obj.components (object what)
gets the components of composite object /what/, if any
[[query]] nilobject obj.composite_parent (object what)
gets the parent composite object of which /what/ is a component, if any
int obj.counter (object o)
void obj.do_tell (object who, object to, string msg)
tell /to/ /msg/ from /who/
void obj.drop (object o, objset items)
drop all the objects in items
void obj.file_plan (object what, nilstring plan)
makes /what/ file plan /plan/, or the default plan if no plan attribute is given.
[[query]] vector obj.find_treatas (object what)
returns an ordered list of objects representing the C3 method resolution order for /what/
[[query]] string obj.get_external_desc (object o)
returns the external description of the object if present, according to the object's state or description inheritance. Note: no examine or room_desc traps will be triggered by this action!
[[query]] string obj.get_internal_desc (object o)
returns the internal description of the object if present, according to the object's state or description inheritance. Note: no examine or room_desc traps will be triggered by this action!
[[query]] string obj.get_long (object o)
returns the long name of the object if present, otherwise "???" (can also be long.%i if the object has stated longs, and is in a suitable state)
[[query]] string obj.get_name (object o)
returns the name of the object if present, otherwise "???" (name could be from name.0 or name.1 if they exist and that is the current state)
[[query]] string obj.get_plural_long (object what)
returns the long plural name of the object if present, otherwise "???" (can also be long.%i.plural if the object has stated longs, and is in a suitable state)
[[query]] string obj.get_plural_name (object what)
returns the plural form of /what/'s name (can also return stated plurals, if such attributes exist and the object is in a suitable state)
bool obj.interpret (object what, untainted cmd, bool allowalias, string err)
does /cmd/ as /what/, with optional error string /err/ if /what/ does not evaluate to a command. returns false if command interpretation failed.
void obj.interpretf (object what, untainted fmt, object varargs)
processess /fmt/ according to internal mud printf rules, and makes /what/ do it as if it were a command
[[query]] bool obj.is_temporary (object what)
returns true if /what/ is a temporary object that the mud will automatically erase at some point in the future, eg. a clone.
[[query]] bool obj.isa (object o, object c)
returns true if /o/ is /c/ or has treatas set to /c/
void obj.lock (object o)
locks door or container /o/ with no messaging. Does not check if there is an 'other' object to lock.
[[query]] bool obj.locked (object o)
returns true if /o/ is locked (applies to containers and doors, implies item is closed)
void obj.move (object what, object where)
moves /what/ to be in /where/
[[query]] nilobject obj.next_treatas (object what, object current)
Finds the next object in the C3 method resolution order for /what/ after /current/
[[query]] set obj.objects_upon (object what)
returns all the objects that are upon /what/
bool obj.once (object o)
first time it is run on /o/ it will return 1, from then on it will return 0 until the object is reset
void obj.open (object o)
opens door or container /o/ with no messaging. Does not check if there is an 'other' object to open.
[[query]] bool obj.opened (object o)
returns true if /o/ is open (applies to containers and doors)
any obj.prop_get (string prop)
void obj.respond (object who, string msg)
Send message /msg/ to /who/'s last interlocutor in the same way as they last communicated with /who/, eg. a tell or sayto, etc.
void obj.say (object who, string msg)
makes /who/ say /msg/
void obj.set_upon (object what, nilobject onto)
places object /what/ onto /onto/, eg. makes people stand upon it, etc. If /onto/ is nil, remove /what/ from whatever it is currently upon.
void obj.setstance (object who, int pose, nilobject on)
make /who/ be in stance /pose/, (from the stance table, eg. standing, sitting, etc). Optionally supply an object for them to perform the stance upon.
void obj.smash (object smasher, object what)
smashes /what/ and handles its contents.
bool obj.stage (object o, int gate, int stage)
if state is currently at gate, then advance to stage, and return true; otherwise return false
[[query]] int obj.stance (object who)
gets the stance that /who/ is in: standing, sitting, etc
void obj.swap (object a, object b)
swap /a/ and /b/'s owners.
[[query]] nilobject obj.treatas_ancestor (object what)
Returns the highest priority object at the deepest point in the breadth-first traversal of /what/s treatas hierarchy
[[query]] int obj.treatas_get_int (object what, key attr, int def)
Returns the value of /attr/ from the first object in /what/s C3 method resolution order which cas /attr/ set, or /def/ if none have it.
[[query]] nilstring obj.treatas_get_str (object what, key attr)
Returns the value of /attr/ from the first object in /what/s C3 method resolution order which cas /attr/ set.
[[query]] bool obj.treatas_has_flag (object what, flag f, bool s)
Returns true if /what/ or one of /what/'s ancestors has flag /f/ set to /s/
[[query]] bool obj.treatas_has_str (object what, key attr, string val)
Returns true if /what/ or one of /what/'s ancestors has /attr/ equal to /val/
bool obj.try_smash (object smasher, object what)
let /smasher/ try to smash /what/. If the function returns true, you should generate some suitable messaging and call smash(), below.
void obj.unlock (object o)
unlocks door or container /o/ with no messaging. Does not check if there is an 'other' object to unlock.
[[query]] nilobject obj.upon (object what)
returns the object, if any, that /what/ is upon (eg. standing, sitting, sleeping, whatever).
void obj.vanish (object o)
if /o/ is a clone, delete, if not move to "empty"
void obj.vanish_all (object o)
vanish /o/ and all objects in it, recursively
[[query]] int obj.volume_of (object what)
gets the volume of space /what/ takes up, in millilitres.
person
void person.follow (object who, nilobject leader)
makes /who/ follow /leader/, or stop following someone if /leader/ is nil
[[query]] nilobject person.following (object who)
returns the person that /who/ is following, or nil if they aren't in a group
pontoon
int pontoon.addplayer (object dealer, object who)
void pontoon.firstdeal (object who)
bool pontoon.nextturn (object who)
int pontoon.nonplayers (object who)
int pontoon.pontoon (object who)
void pontoon.results (object who)
roomgroup
int roomgroup.airtight (object where, string message)
Returns the number of non-space rooms that are currently directly connected, but returns this as a negative value if any doors are open to 'space'. Returns nil if the room its called on is itself in 'space'. Space = anywhere with Airless, Outdoors and NoGravity flags.
int roomgroup.depressurise (object where, nilstring message)
Returns the number of rooms it has depressurised. A default message is provided if none is supplied.
int roomgroup.pressurise (object where, nilstring message)
Returns the number of rooms it has pressurised; As a negative number if it all leaked out into space. A default message is provided if none is supplied.
void roomgroup.send (object where, string message)
Send a message to all rooms in a roomgroup
ships
void ships.generate_ship (object tmpl, object player)
[[query]] float ships.get_current_coords_x (object room, object ship)
[[query]] float ships.get_current_coords_y (object room, object ship)
[[query]] float ships.get_current_coords_z (object room, object ship)
[[query]] float ships.get_star_x (string star)
[[query]] float ships.get_star_y (string star)
[[query]] float ships.get_star_z (string star)
returns the ship docked at /where/, if any.
returns the ship docked at /where/, if any.
void ships.send (object ship, string msg)
simulation
void simulation.start (object who, object where, object what)
starts simulation /what/ in simulator /where/ for /who/
[[query]] nilobject simulation.storage (object where, object who)
void simulation.vanish (object what, object who)
When used in a running simulation, the item will dissapear as if vanished. It will return to player when the holo ends. When used outside a holo it is the same as vanish.
skill
void skill.advance (object actor, int skill, int difficulty)
bool skill.check (object actor, object prop, int skill, int difficulty)
state
[[query]] nilobject state.get (player p)
returns the lua state object /p/ is currently in, if any
[[query]] string state.getstr (player p, key prop)
reads the /prop/ property of /p/'s current lua state
void state.pop (player p)
makes /p/ return to his previous state.
void state.push (player p, object s)
puts /p/ into lua state /o/.
void state.set (player p, object s)
replaces /p/'s current lua state with /s/.
void state.setstr (player p, key prop, string val)
stores /val/ in the /prop/ property on the current instance of /p/'s lua state
system
[[query]] stringvector system.all_players ()
returns a list of all player IDs, offline or connected.
table system.command_stack ()
returns a table containing the current mud command stack
[[query]] stringvector system.help_files ()
returns a list of all help files
[[query]] stringvector system.info_files ()
returns a list of all info files
[[query]] nilstring system.last_verb ()
returns the highest "verb" entry in the command stack, or nil if no verb has been executed
void system.log_stacktrace (priv pfl, string cat)
generate a log of the current command stack, in category /cat/, displayed to those with pflag /pfl/
[[query]] stringvector system.policy_files ()
returns a list of all policy files
[[query]] int system.relations (object what)
returns the number of relations that /what/ is currently participating in.
table
table table.copy (table original)
Does a deep copy of /original/, including its metatable (if any)
int table.size (table what)
Returns the number of elements in /what/. Use when /what/ doesn't have numeric 1-based indices.
term
[[query]] bool term.can_mplex (player p)
does /player/'s mudclient support multiplexing?
[[query]] int term.columns (player p)
returns the number of columns /p/ wants in their screen
[[query]] void term.flush (player o)
cause current buffer of /o/ to be sent to them.
void term.mplex_choose (player p, int i)
sends the code to choose multiplexed connection /i/ on /o/ for any output. 1 is subwindow for games, 0 is main window.
void term.mplex_flush (player p)
flush data for the purposes of mplexing
void term.mplex_hide (player p, int i)
hide the multiplexed window /i/ from player /p/
void term.mplex_roomupdate (object o)
call the 'mplex' trap on the room for everyone in it who has mplex support.
void term.mplex_setsize (player p, int i, int cols, int rows)
sets the size of the subwindow /i/ on /o/ to /cols/ by /rows/.
void term.mplex_show (player p, int i)
show the multiplexed window /i/ to player /p/
[[query]] string term.player_colour_mode (player p)
returns a string representing the colour mode that player is in
[[query]] int term.player_connected_since (player p)
returns the time that /p/ logged on
[[query]] int term.player_fd (player p)
returns the file descriptor number associated with /p/'s socket, if they're connected
[[query]] string term.player_host (player p)
returns /p/'s hostname, if known
[[query]] string term.player_ip (player p)
returns /p/'s ip address, or - is /p/is linkdead
[[query]] string term.player_ipv (player p)
return the ip version used by /p/, either v4 or v6
[[query]] bool term.player_is_unicode (player p)
returns true if /p/ has unicode turned on somehow
[[query]] int term.player_last_active (player p)
returns the time at which /p/ last executed a command
[[query]] bool term.player_linkdead (player p)
is player /p/ linkdead?
[[query]] string term.player_locality (player p)
returns the physical location associated with /p/'s ip address, if known
[[query]] string term.player_mccp (player p)
returns the version and compression factor of MCCP /p/ is using, if any
[[query]] string term.player_port (player p)
returns the name of the port that /p/ original connected to: main, mono, ssl, webmake or unknown.
[[query]] string term.player_protocol (player p)
returns the protocol /p/'s client is using
[[query]] string term.player_secure (player p)
returns true if this connection is believed to be secure (via TLS/WSS or local access)
[[query]] string term.player_state_id (player p)
returns the id of the interpreter state /p/ is currently in
[[query]] string term.player_terminal (player p)
returns /p/'s terminal, if their client has identified itself
[[query]] string term.player_termsize (player p)
returns the size of /p/'s terminal window, if their client supports NAWS
[[query]] int term.rows (player p)
returns the number of rows /p/ wants in their screen
void term.send_data (object p)
void term.send_gmcp_table (player p, string data)
[[query]] bool term.wants_gmcp_table (player p)
trap
[[noreturn]] void trap.abort ()
abort the current script execution without raising an error.
void trap.backtrace ()
returns a table containing the current lua stack of line numbers and chunknames in human readable(ish) form.
any trap.const_exec (eventname a, object pl, object o1, nilobject o2, nilobject treatas, nilobject o3, nilstring txt)
as per trap.exec, except operations that have side effects are explicitly forbidden and will result in errors.
[[query]] int trap.elapsed ()
return the number of milliseconds that have elapsed since the chain of lua executions leading up to this function call began.
[[query]] any trap.exec (eventname a, object pl, object o1, nilobject o2, nilobject treatas, nilobject o3, nilstring txt, table extra)
call the lua trap /a/ on /o1/ with o1 /o1/, o2 /o2/ (optional; if not then NULL) and pl /pl/. If /treatas/ is specified, the trap is loaded from that object but run on /o1/. Returns all the non-table values returned by the called trap. Example: trap.exec("foo", obj, obj) will execute the lua script "lua.foo" on object obj.
[[query]] bool trap.get_trace ()
Get the current lua tracing mode
[[query]] bool trap.is_const ()
are we operating in immutable object mode?
void trap.set_trace (bool state)
Set the current lua tracing mode
void trap.super ()
call the trap on the treatas that this trap has overridden. Returns all the same values as the called trap returns.
util
[[query]] string util.build_plural_action (string stem, bool as_subject)
Turns /stem/ into an pluralisable action string such as "dance%[s]". If /as_subject/ is set to true, returns strings like "dance%<s>" instead.
[[pure]] string util.capitalise (string what)
capitalise the first letter of the given string
[[pure]] stringvector util.check_spelling (string w)
If /w/ appears to be misspelled, return a table of suggested spellings. Otherwise returns an empty table.
string util.colour_reverse (string what)
Reverse the string /what/, keepings its colour information.
string util.colour_trim (object forwho, string what, int width)
Trims /what/ to length /width/, accounting for colours visible to /forwho/
[[query]] int util.daylen (object room)
returns length in seconds of a mud day for /room/
[[pure]] string util.escape_colour (string what)
returns /what/ with all escape codes escaped.
table util.explode (string what, string matchpattern, int limit)
Splits /what/ into zero or more strings matching /matchpattern/, up to /limit/ strings if /limit/ is set
[[query]] vector util.filter (objvector w, filter fn)
return only the objects of /w/ for which filter /fn/ returns true
[[query]] vector util.filter_array (objvector w, key prop)
returns all objects in /w/ which have array attribute /prop/
[[query]] vector util.filter_flag (objvector w, flag f)
returns all objects in /w/ which have flag /f/ set
[[query]] vector util.filter_int (objvector w, key prop)
returns all objects in /w/ which have integer attribute /prop/
[[query]] vector util.filter_out_flag (objvector w, flag f)
returns all objects in /w/ which don't have flag /f/ set
[[query]] vector util.filter_out_int (objvector w, key prop)
returns all objects in /w/ which don't have integer attribute /prop/
[[query]] vector util.filter_out_str (objvector w, key prop)
returns all objects in /w/ which don't have string attribute /prop/
[[query]] vector util.filter_out_temporary (objvector w)
returns only the objects of /w/ which would not be marked is_temporary
[[query]] vector util.filter_str (objvector w, key prop)
returns all objects in /w/ which have string attribute /prop/
[[query]] table util.filterprops (object what, string filter)
returns a table with all the string properties on /what/ where the value contains the string /filter/.
any util.find (table table, any value)
[[query]] string util.format_time_to_minute (nilobject who, int when)
format /when/ (a time_t value), including date and time to the minute using timezone that /who/ has asked for. If /who/ is nil, the default mud timezone is used.
[[pure]] string util.formatduration (int dur, bool nosecs)
converts a duration in seconds to a string: "x days x hours x minutes x seconds". If nosecs is true, seconds will not be returned.
string util.formatitime (int timespan)
Formats a timespan in seconds as a string with hours, miniutes and seconds.
[[query]] string util.formattime (nilobject who, string format, int when)
format /when/ (a time_t value) with string /format/ (same as strftime uses) using timezone that /who/ has asked for. If /who/ is nil, the default mud timezone is used.
[[pure]] bool util.id_sort (string a, string b)
Our internal string comparison algorithm, which returns 1 < 2 < 10
[[query]] bool util.in_list (string what, string list)
return true if /what/ is in the comma-separated list /list/
[[query]] string util.infotext_parse (object who, string what)
Processes special $ escape codes in /what/, such as for helpfiles. If /who/ has a client that supports it, appropriate links will be generated.
[[query]] bool util.inlist (object who, string list)
return true if /who/'s id is in the comma-separated list /list/
[[pure]] string util.lpad (string what, int width)
left-pad the given string to /width/ spaces. bear in mind colourcodes and doublewidth characters, etc.
[[query]] int util.measure_width (string what, object who)
returns the length of string /what/ accounting for colour and other escape codes.
[[query]] int util.mudhour (object room)
returns mud-time hour between 0 and 23 for /room/
[[query]] int util.mudminute (object room)
returns mud-time minute between 0 and 59 for /room/
[[query]] int util.now ()
returns the current time, in seconds, since 1970
[[pure]] string util.pad (string what, int width)
pad the given string to /width/ spaces. bear in mind colourcodes and doublewidth characters, etc.
[[pure]] int util.parsetime (string what, string format)
parse /what/ according to string /format/ (same as strptime uses) and returns a time_t value. Due to limitations of our internal storage format, this is limited in range, so be aware that dates a long time in the past or future will not parse correctly!
[[query]] string util.plural_phrase (string w)
attempts to pluralise phrase /w/
[[pure]] bool util.prep (string cand)
eturns true if /cand/ is in the valid prepositions list.
[[pure]] string util.remove_articles (string txt)
eturns /txt/, minus leading articles
[[pure]] string util.rev (string what)
reverse /what/
[[pure]] string util.strip_colour (string what)
returns /what/ with all colour codes removed.
[[pure]] string util.toascii (string w)
strip colour codes and latin1 or unicode characters from /w/, making is plain ascii
[[query]] set util.where (player p, string what, bool rooms, bool clones, bool exact)
returns all objects findable by /p/ matching the name /what/. If /rooms/ is true, return only rooms. If /clones/ is true, inlcude clones in list. If /exact/ is true, don't use the matcher; check only short and altshort of objects instead.
[[query]] string util.wordwrap (object forwho, string s, int width, string prefix)
if /s/ is longer than /width/, linewrap it by inserting newlines and padding each new line with /prefix/.
wild
[[query]] int wild.altitude (string wild, int x, int y)
returns the altitude, associated with the wilderness /wild/ at co-ordinates /x/,/y/. Altitude is the ground level, so z is zero. Caveat: Will return 0 in the event of the location not being found, as well as for sea level.
[[query]] bool wild.exists (string wild)
returns true if /wild/ is the tag name of an existing wilderness
[[query]] int wild.flow (string wild, int x, int y)
gets the direction of flow (generally for rivers) as a bitwise combination of directions, associated with the wilderness /wild/ at co-ordinates /x/,/y/. Use the "flow" table in wilderness.libs to interpret the result, or the "nice_flow" function to turn it into a direction.
[[query]] bool wild.hasair (string wild, int x, int y)
returns true if the wilderness location has air or not
[[query]] bool wild.isdirty (string wild)
returns true if /wild/ has unsaved changes.
[[query]] string wild.landmark (string wild, int x, int y, int z)
returns a string describing the landmark associated with the wilderness /wild/ at co-ordinates /x/,/y/
[[query]] stringvector wild.loaded_wilderni ()
returns all currently loaded wilderni.
[[query]] nilstring wild.locate (string wild, int x, int y, int z)
returns the id of the room object in wilderness /wild/, co-ordinates /x/,/y/,/z/. This may be a normal room which has been patched in, and may not exist at all for above or belowground locations.
[[query]] string wild.overlay (string wild, int x, int y)
returns the overlay type, if any, associated with the wilderness /wild/ at co-ordinates /x/,/y/. Overlays are things like overhead maglev lines, or underground tunnels.
[[query]] nilstring wild.randomloc (string wild, int loctype, int z, bool allow_instantiated)
returns the zone that wilderness /wild/ is associated with
[[query]] object wild.terrain (string wild, int x, int y)
returns the terrain type object associated with the wilderness /wild/ at co-ordinates /x/,/y/
[[query]] nilstring wild.zone (string wild)
returns the zone that wilderness /wild/ is associated with