Libs

Updated at Thu 01 May 2003 18:08:32 BST

bool acceptedobject who object quest
void actobject what string txt nilobject target:0 nilobject prop:0 string arg:0
bool actionverbstring vn
string actsobject what string txt nilobject target:0 nilobject prop:0 string txt2:0
string addtimerprotobject what string code int when
world allholdscloneobject o object f
world allholdsflagobject o flag f
world alltreatasobject o object f
world allwearsflagobject o flag f
object anyobjectfromobject blah
object anyplayerfromobject blah
object anyroominzonestring zone
void arrestobject crim object victim string help
object autocloneobject what object where string zone
int balanceobject o object cur
int bit_andint a int b
int bit_orint a int b
bool canattackobject who object what
void canceltimerstring code
string capitalisestring what
int cashobject o object cur
world childrenobject what
void clearmissionobject obj
object cloneobject what object where object mis:0
world clothingobject who
bool containsobject o object w
int convertint amt nilobject from nilobject to
object currencyobject o
bool deadobject what
string describeworld o
void dofineobject mob object victim int amount object cur:0
bool donemissionobject who object quest
bool dotrapstring a object pl object o1 object o2:0 object on:0 object o3:0
string drunkifyobject who string txt
void empty_shipprotobject o
void endpagerplayer who
void failmissionobject who object o
void failquestobject who object mis
void fineobject who int amount string why object jur:0
void flushobject o
string format_roomnameobject room object play string ic string oc string sin
string formatcashint amt object o int l:0
string formattimeobject who string format int when
object freequartersobject of
char genderobject o
object getstring id
bool getflagobject o flag f
object getfloorobject o
int getintobject what string id
int getintdobject what string id int d
object getmissionobject o
object getobjobject what string id
bool getprivobject o priv f
void getpropsobject what string pref:0
nilstring getstrobject what string id
void giveprotobject from object what object dest
void givecashobject who int amount object curr
void givemissionobject who object mission
void givequestobject who object mis
void grudgequestobject who object mis
void harmobject who int amount
void healobject medic object who int amount
object holdscloneobject o object c
object holdsflagobject o flag f
object holdszoneobject o string z
string idobject what
bool inlistobject who string list
void interpretprotobject what string cmd
bool isaobject o object c
object jurisdictionobject where
object killobject who nilstring msg
world killrobject room nilstring msg
string langstring txt object who
object leaderobject o
int mass_withinobject o
world matchobject who table arg
object matchplayerobject who string str
world matchprepobject who table arg string prep
object missionobject blah
bool mobileobject o
object mountobject o
void moveprotobject what object where
void mplex_chooseplayer p int i
void mplex_roomupdateobject o
void mplex_setsizeplayer p int i int cols int rows
int mudhourobject room
int mudminuteobject room
bool nakedobject who
string namestring id
void name_mobileobject mob
string nationobject w
int now
void oactobject what string txt nilobject target:0 nilobject prop:0 string arg:0
bool onceprotobject o
void othersobject what string txt object what2:0
object ownerobject o
string padstring what int width
void payobject from object to int amount object cur:0
bool personobject o
bool playerobject o
world playersobject player:0
string plural_nameobject what
int privsobject who
object quartersobject of
world quests
int randomint range
string rankobject who
string rankforint level
world recchildrenobject what
string remove_articlesstring txt
void resetprotobject what
void sayobject who string msg
void sendobject what string txt
void sendrobject what string txt
void sendzonestring zone string txt
void sendzonebutstring zone object notr string txt
void setprotobject what string id int val
void setprotobject what string id object val
void setprotobject what string id string val
void setbalanceobject o object cur int amt
void setcashobject o object cur int amt
void setflagprotobject o flag f bool v
void setmissionobject obj object mis
void setstateprotobject what int n
void startfightobject attack object victim
void startpagerplayer who
int stateobject o
int super
void swapobject a object b
void syslogpriv pfl string cat object who string msg
void tellobject who object to string msg
string toasciistring w
string typevoid something
void unsetprotobject what string id
int valueobject o
void vanishprotobject o
void vanish_allprotobject o
object weaponobject who
bool wearsobject who object what
bool wearscloneobject o object c
object wearsflagobject o flag f
void wipecashobject who
object wornonobject who string where
world zonestring what
world zonewithflagstring what flag f
    Mud-Lua Interface Generation

    Copyright (c) 2002 Abi Brady

basic operators

int bit_or(int a, int b)

    bitwise or

int bit_and(int a, int b)

    bitwise and

basic object functions

object get(string id)

    looks up the object with specified id. if you are in a holoprogram, returns the holoclone of it if any.

int getint(object what, string id)

    returns integer property id on what or if not present, -1

int getintd(object what, string id, int d)

    returns integer property id on what or if not present, d

object getobj(object what, string id)

    returns object property id on what or if not present, nil

nilstring getstr(object what, string id)

    returns string property id on what or if not present, nil

object owner(object o)

    returns the object that o is in

void unset(protobject what, string id)

    removes the property id on what

void set(protobject what, string id, int val)

    sets property id on what to val

void set(protobject what, string id, string val)

    sets property id on what to val

void set(protobject what, string id, object val)

    sets property id on what to val

void getprops(object what, string pref:0)

    returns a table with all the properties on what (only those starting with pref if specified)

world children(object what)

    returns all objects directly in what

world players(object player:0)

    returns all players visible to player, or all players if player is null.

world recchildren(object what)

    returns all objects in what, or in objects in those, etc.

world quests()

    returns all quests

world zone(string what)

    returns all objects in zone what.

world zonewithflag(string what, flag f)

    returns all objects in zone what which have flag f set.

flags

void setflag(protobject o, flag f, bool v)

    sets the flag f on o to v

bool getflag(object o, flag f)

    returns 1 if o has flag f, otherwise nil. Flag constants look like 'flag.Fixed'

bool getpriv(object o, priv f)

    returns 1 if o has priv f, otherwise nil. Priv constants look like 'priv.God'

advanced object info functions

bool actionverb(string vn)

    returns true if the string vn corresponds to a currently existing action

bool isa(object o, object c)

    returns true if o is c or has treatas set to c

int state(object o)

    returns which state o is in (for doors and containers, 0

int privs(object who)

    returns the effective level that who is at, taking into account remort

bool person(object o)

    returns true if o is a player or a mobile

bool player(object o)

    returns true if o a player

bool mobile(object o)

    returns true if o a mobile

object mount(object o)

    returns the thing o is riding, if any

bool naked(object who)

    returns true if who is naked

object leader(object o)

    returns the object o is following

char gender(object o)

    returns a one-char string which is 'm', 'f', 'n', 'a', etc, or '?'

object getmission(object o)

    return the mission object for mission with id o

void pay(object from, object to, int amount, object cur:0)

    pay amount units in cur from from to to

void dofine(object mob, object victim, int amount, object cur:0)

    pay amount units in cur from from to to

object quarters(object of)

    return the quarters belonging to of if any

object freequarters(object of)

    find out whether there are any free quarters referred to by the quarters office of

bool inlist(object who, string list)

    return true if who's id is in the comma-separated list list

string rank(object who)

   returns the rank of who as a string.

string rankfor(int level)

   returns the navy rank corresponding to 'level'

string nation(object w)

    returns the nation of the person w

contents examination

object getfloor(object o)

object holdsclone(object o, object c)

    if o holds any clones of c, return one of them. recurses into containers.

object holdsflag(object o, flag f)

    returns true if o holds any object with flag f

object holdszone(object o, string z)

    returns any object held by o with zone z

bool wearsclone(object o, object c)

    returns true if o wears any clones of c

object wearsflag(object o, flag f)

    if o wears any objects with flag f return one of them. otherwise return nil.

world allholdsflag(object o, flag f)

    return all objects recursively in o which have the flag f. includes o if applicable.

world allwearsflag(object o, flag f)

    return all objects recursively in o which have the flag f. includes o if applicable.

world allholdsclone(object o, object f)

    return all objects recursively in o which are f or are clones of f

world alltreatas(object o, object f)

    return all objects recursively in o which are f or are clones of f

bool contains(object o, object w)

    returns true if w is in o either directly or via other objects, otherwise false.

bool wears(object who, object what)

    return true if who is wearing the actual object what

object weapon(object who)

    return the object that who is wielding

financial

object currency(object o)

    returns the currency that o is set to use

int convert(int amt, nilobject from, nilobject to)

    convert amt from from to to. if they are nil it means ICUs.

string formatcash(int amt, object o, int l:0)

    format amt (currency is o) for display. l is one for long-style, zero for short-style

int cash(object o, object cur)

    return the amount of cash in cur that o has on them

void setcash(object o, object cur, int amt)

    make o have amt in cur

int balance(object o, object cur)

    return the amount of cash in cur that o has in the bank

void setbalance(object o, object cur, int amt)

    make o have amt in cur in their balance

void givecash(object who, int amount, object curr)

    give who amount in curr

void wipecash(object who)

    remove all cash from

void fine(object who, int amount, string why, object jur:0)

    fine who amount (in ICUs), for why, in jurisdiction jur. if j not given, use the default one for their location.

object jurisdiction(object where)

    return the jurisidiction that applies for where

utility

string formattime(object who, string format, int when)

    format when (a time_t value) as a time with string format, displaying it in who's timezone

int value(object o)

    return the value of o in ICUs.

string capitalise(string what)

    capitalise the given string

string pad(string what, int width)

    pad what out to width. colour-code safe.

string name(string id)

    returns the colour and capitalised name of the player with id, who need not be logged in

void swap(object a, object b)

    swap a and b's owners.

int random(int range)

    returns number between 0 and range-1

int mudhour(object room)

    returns mud-time hour between 0 and 23 for room

int mudminute(object room)

    returns mud-time minute between 0 and 59 for room

int now()

    returns the current time, in seconds, since 1970

object wornon(object who, string where)

    returns the outermost clothing worn by who on their where

world clothing(object who)

   returns all clothing worn by who

void flush(object o)

    cause current buffer of o to be sent to them.

void mplex_choose(player p, int i)

    sends the code to choose multiplexed connection i on o. 1 is subwindow for games, 0 is main window.

void mplex_setsize(player p, int i, int cols, int rows)

    sets the size of the subwindow i on o to cols by rows.

void mplex_roomupdate(object o)

    call the 'mplex' trap on the room for everyone in it who has mplex support.

bool dotrap(string a, object pl, object o1, object o2:0, object on:0, object o3:0)

    call the lua trap a on on (or o1 of on not specified) with o1 o1, o2 o2 (optional; if not then NULL) and pl pl. no txt support yet

int super()

    call the trap on the treatas that this trap has overridden

string format_roomname(object room, object play, string ic, string oc, string sin)

    return preposition-prefixed form of room's name, from the pov of play, with ic and oc as colourcodes for the name, and sin either "" for normal, or "to" for to-mode (in muon's bar -> to muon's bar, on foo -> onto foo).

int mass_within(object o)

    return the mass of the children of o recursively, in grams

bool canattack(object who, object what)

    return true is who can attack what without getting arrested

output

string lang(string txt, object who)

    translates the text txt according to the language who is speaking

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 send(object what, string txt)

    send txt to what. newline not needed.

void sendr(object what, string txt)

    send txt to everything in the room what and linked rooms

void others(object what, string txt, object what2:0)

    send txt to everything in the same room as what. newline not needed.

void act(object what, string txt, nilobject target:0, nilobject prop:0, string arg:0)

   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.

string acts(object what, string txt, nilobject target:0, nilobject prop:0, string txt2:0)

    format txt as if it were an action string performed by what

void oact(object what, string txt, nilobject target:0, nilobject prop:0, string arg:0)

   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.

void tell(object who, object to, string msg)

   tell to msg from who

void say(object who, string msg)

    makes who say msg

void sendzone(string zone, string txt)

    send txt to all players in rooms with zone zone

void sendzonebut(string zone, object notr, string txt)

    send txt to all players in rooms with zone zone, except for those in not

string describe(world o)

    given a world, give a string that describes the objects in it

basic object manipulation

void vanish(protobject o)

   if o is a clone, delete, if not move to "empty"

void vanish_all(protobject o)

    vanish o and all objects in it, recursively

string plural_name(object what)

   returns the plural form of what's name

string remove_articles(string txt)

   returns txt, minus leading articles

void empty_ship(protobject o)

    empties the ship o of all players

void move(protobject what, object where)

    moves what to be in where

object clone(object what, object where, object mis:0)

    clones a what and places it in where

object autoclone(object what, object where, string zone)

    clones a what and places it in where. creates auto objects too. everything'll be part of zone

void reset(protobject what)

    resets what to its starting conditions

bool once(protobject o)

    first time it is run on o will return 1, from then on will return 0 until object reset

void setstate(protobject what, int n)

    sets what to be in state n

object anyplayerfrom(object blah)

    return a random player from blah

object anyobjectfrom(object blah)

    return a random object from blah

object anyroominzone(string zone)

    returns a random room from blah

object mission(object blah)

    returns the minimission that owns blah

void setmission(object obj, object mis)

    associates the object obj with the minimission mis. The object will be destroyed with the minimission.

void clearmission(object obj)

    makes obj a freestanding object that isn't associated with a mission

void name_mobile(object mob)

    give mob a random human name

world match(object who, table arg)

    try to match arg from the point of view of who

world matchprep(object who, table arg, string prep)

    try to match arg from the point of view of who, looking for prep

object matchplayer(object who, string str)

    try to match str to a person, from the point of view of who

advanced object manipulation

void give(protobject from, object what, object dest)

   makes from give what to dest

void startfight(object attack, object victim)

   makes attack start a fight with victim

void interpret(protobject what, string cmd)

   does cmd as what

object kill(object who, nilstring msg)

   make blah die, with log message msg (which can be nil). returns the corpse if any, which you should set a cause of death on.

world killr(object room, nilstring msg)

    kill everything in room with message msg

void heal(object medic, object who, int amount)

    make medic heal who up to amount health points.

void harm(object who, int amount)

    remove amount health points from who

void syslog(priv pfl, string cat, object who, string msg)

quest related stuff

void givequest(object who, object mis)

    grant who the id quest with a cash reward

void grudgequest(object who, object mis)

    grant who the id quest but without any cash reward

void failquest(object who, object mis)

    mark who as having failed the id quest

bool accepted(object who, object quest)

    return true if who has accepted quest

bool donemission(object who, object quest)

    return true if who has done mission with qid quest

void givemission(object who, object mission)

    make who have done the minimission mission, reward them, message, etc.

void failmission(object who, object o)

    mark who as having failed the given minimission

slightly evil stuff

void startpager(player who)

    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.

void endpager(player who)

    activate the pager upon who. done automatically if not done in a trap.

string addtimer(protobject what, string code, int when)

    make what execute code in when seconds time. will run under the security context of the calling code.

void canceltimer(string code)

    cancel the timer that returned code when it was added

string type(void something)

    returns "nil", "number", "string", "table", "function" or "userdata", depending on something.

string toascii(string w)

    strip colour codes and latin1 or unicode characters from w, making is plain ascii

void 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.

bool dead(object what)

    return true if what is dead

string id(object what)

    returns the id of what. use get(what, "id") instead.