Softcode functions
From TinyMUX
Functions are data manipulation tools, which accept the data to be changed as a parameter and provide the altered data as a return value. Contrast this to commands, which are actions and instruct the server to make some sort of change.
If you want to display a character sheet or a who list to a player, you need to use a command to instruct the server to display something, but you use functions to collect the data to be displayed, and to format it nicely for display.
A few functions actually make changes on the server. These are called side effect functions, and should be used carefully. The greatest problem with side effect functions (in my personal opinion) is maintainability - a coder doesn't initially expect a function to make a change to the server, and will often overlook functions while trying to find a server-affecting bug.
For this reason, I recommend using side effect functions sparingly, if at all.
| | See Also: Functions and compare with commands. |
Function Classes
Arithmetic
abs() add() band() bnand() bor() bxor() ceil() crc32() dec() die() fdiv() floordiv() fmod() iabs() iadd() idiv() imul() inc() isign() isub() mod() mul() pack() power() rand() remainder() sha1() shl() shr() sign() sub() sqrt() unpack()
Comsystem Information
channels() comalias() comtitle() cwho()
Database Information
exit() inzone() loc() locate() lrooms() mail() mailfrom() nearby() next() num() rloc() room() search() stats() valid() where() zfun() zone() zwho()
Floating-Point Conversion
Game Information
config() dumping() motd() mudname() poll() version()
Lists
choose() columns() extract() elements() foreach() filter() filterbool() first() fold() ilev() index() insert() itemize() iter() ladd() last() ldelete() list() lnum() lrand() map() match() matchall() member() mix() munge() parse() pickrand() remove() rest() revwords() setdiff() setinter() setunion() shuffle() sort() sortby() splice() table() words()
Logarithms
Logical
and() andbool() cand() candbool() cor() corbool() land() lor() not() or() orbool() t() xor()
Miscellaneous
@@() ansi() art() beep() error() fcount() isdbref() isint() isnum() israt() isword() lit() null() r() setq() setr() subevl() textfile()
Object Information
andflags() aposs() attrcnt() bittype() children() cmds() con() controls() ctime() default() edefault() elock() entrances() eval() flags() fullname() get() get_eval() grep() grepi() hasattr() hasattrp() hasflag() haspower() hastype() home() lattr() lattrcmds() lattrp() lcmds() lcon() lexits() lflags() lparent() localize() lock() money() moniker() mtime() name() obj() objeval() objmem() orflags() owner() parent() pfind() pmatch() poss() powers() s() subj() type() u() udefault() ulocal() v() visible() xget()
Player Information
conn() connlast() connleft() connmax() connnum() connrecord() conntotal() doing() findable() hasquota() height() host() idle() lwho() lports() playmem() ports() width()
Relational
eq() gt() gte() lt() lte() max() min() neq()
Side-Effect Functions
create() emit() link() oemit() pemit() remit() set() tel()
Stack
empty() items() lstack() peek() pop() push()
Strings
accent() after() alphamax() alphamin() before() capstr() case() cat() center() chr() comp() decrypt() delete() edit() encrypt() escape() grab() graball() if() ifelse() lcstr() ljust() lpos() merge() mid() ord() pos() regmatch() regmatchi() regrab() regraball() regraballi() regrabi() repeat() replace() reverse() right() rjust() roman() scramble() secure() space() spellnum() squish() strcat() strip() stripaccents() stripansi() strlen() strmatch() strmem() strtrunc() switch() translate() trim() ucstr() wordpos() wrap()
Time
convsecs() convtime() digittime() exptime() secs() singletime() startsecs() starttime() time() timefmt() writetime()
Trigonometric
acos() asin() atan() cos() ctu() dist2d() dist3d() pi() sin() tan() vadd() vcross() vdim() vdot() vmag() vmul() vsub() vunit()
WOD Realms (optional)
Reality Levels (optional)
hasrxlevel() hastxlevel() listrlevels() rxlevel() txlevel()
