Custom Who and Where

This is a fairly customizable WHO and WHERE command holder. It has an 'options' field for things a staffer may want to edit.

Author: Mercutio@M*U*S*H
Category: Globals
Commands: @create, @lock, @nspemit, @set.
Features: regexp commands.

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Custom Who and Where

@create Custom Who and Where <CWW>
@lock Custom Who and Where <CWW>==me
@set Custom Who and Where <CWW> = !NO_COMMAND
&CMD Custom Who and Where <CWW>=Contains the commands.
&CMD`CWHERE Custom Who and Where <CWW>=$^\+?c?@?where(is)?$:@nspemit %#=[u(me/fn`do`cwhere)]
@set Custom Who and Where <CWW>/CMD`CWHERE=regexp
&CMD`CWHO Custom Who and Where <CWW>=$^\+?c?@?\who$:@nspemit %#=[u(me/fn`do`cwho)]
@set Custom Who and Where <CWW>/CMD`CWHO=regexp
&CREDITS Custom Who and Where <CWW>=Contains the credit file for this object.
&CREDITS`DESC Custom Who and Where <CWW>=%b%b%b//[repeat(-,68)]%\%\%r[align(3 -68 3,,[u(me/credits`text)]%r,,%b,||)]%r%b%b%b%\%\[repeat(-,68)]//
&CREDITS`ERROR Custom Who and Where <CWW>=YOU ARE NOT RUNNING PENNMUSH! THIS CODE WILL NOT WORK FOR YOUR CODEBASE UNLESS MODIFIED! THIS CODE IS /NOT/ SUPPORTED CROSS-PLATFORM DUE TO THE REQUIREMENT OF THE 'align()' FUNCTION!
&CREDITS`TEXT Custom Who and Where <CWW>=%rThis is a fairly customizable WHO and WHERE command holder. It has an 'options' field for things a staffer may want to edit. In the 'format' fields, it is decided how things will look, and in what manner things are listed. This does not include the permissions of players, which one will need to find in the 'fn' field along with all the other functions that are used by this command object. This object requires: '@config/set null_eq_zero=yes' to be set, as well as a 'isstaff()' function as well as isbuilder() that evaluates whether or not someone is staff or has the builder bit!%r%rCredits go in full to Onyx@UniversitasMagis, also known as Mercutio@M*U*S*H or Mercutio@AngelicLayerMUSH.%r%rIf this text looks extremely garbled, you do not have an ALIGN() function. Meaning you are not running PennMUSH, or are running an extremely old version of it!
&DEFAULTS Custom Who and Where <CWW>=Contains the default values. Change them if needed.
&DEFAULTS`AREA Custom Who and Where <CWW>=<6
&DEFAULTS`BIT Custom Who and Where <CWW>=<1
&DEFAULTS`CONNECTION Custom Who and Where <CWW>=<8
&DEFAULTS`LOCATION Custom Who and Where <CWW>=<35
&DEFAULTS`NAME Custom Who and Where <CWW>=<16
&DEFAULTS`SORTING Custom Who and Where <CWW>=name
&DEFAULTS`STATUS Custom Who and Where <CWW>=<9
&DEFAULTS`WHEREPREFERENCES Custom Who and Where <CWW>=BIT:<1|NAME:<20|AREA:<20|LOCATION:<33
&DEFAULTS`WHERESORT Custom Who and Where <CWW>=locationname
&DEFAULTS`WHOPREFERENCES Custom Who and Where <CWW>=BIT:<1|NAME:<20|STATUS:<9|CONNECTION:<10|LOCATION:<33
&DEFAULTS`WHOSORT Custom Who and Where <CWW>=playername
&DESCRIBE Custom Who and Where <CWW>=if(match(first(version()),pennmush),u(me/credits`desc),u(me/credits`error))
@set Custom Who and Where <CWW>/DESCRIBE=no_command visual prefixmatch public nearby
&FN Custom Who and Where <CWW>=Contains the functions for the commands. Do not alter unless you know what you are doing.
&FN`CANSEEDB Custom Who and Where <CWW>=or(isstaff(%0),isbuilder(%0))
&FN`CANSEEHIDDEN Custom Who and Where <CWW>=isstaff(%0)
&FN`CANSEEUNFINDABLE Custom Who and Where <CWW>=if( isstaff(%0) , 1 , and( not(hasflag(%1,unfindable)) , not(hasflag(loc(%1),unfindable)) )
&FN`CWHERE Custom Who and Where <CWW>=[u(fn`workit,%0)][u(me/fn`nameline,%0)][u(me/fn`midline)][align( [u(fn`getnumbers,%0)] , [u(me/fn`getwformat,first(%q0,:),last(%q0,:))] , [u(me/fn`getwformat,first(%q1,:),last(%q1,:))] , [u(me/fn`getwformat,first(%q2,:),last(%q2,:))] , [u(me/fn`getwformat,first(%q3,:),last(%q3,:))] , [u(me/fn`getwformat,first(%q4,:),last(%q4,:))] , [u(me/fn`getwformat,first(%q5,:),last(%q5,:))] , [u(me/fn`getwformat,first(%q6,:),last(%q6,:))] , [u(me/fn`getwformat,first(%q7,:),last(%q7,:))] , [u(me/fn`getwformat,first(%q8,:),last(%q8,:))] , [u(me/fn`getwformat,first(%q9,:),last(%q9,:))] , [u(me/format`filler)] , [u(me/format`colseperator)] , [u(me/format`rowseperator)] )]
&FN`CWHO Custom Who and Where <CWW>=[u(fn`workit,%0)][u(me/fn`nameline,%0)][u(me/fn`midline)][align( [u(fn`getnumbers,%0)] , [u(me/fn`getformat,first(%q0,:),last(%q0,:))] , [u(me/fn`getformat,first(%q1,:),last(%q1,:))] , [u(me/fn`getformat,first(%q2,:),last(%q2,:))] , [u(me/fn`getformat,first(%q3,:),last(%q3,:))] , [u(me/fn`getformat,first(%q4,:),last(%q4,:))] , [u(me/fn`getformat,first(%q5,:),last(%q5,:))] , [u(me/fn`getformat,first(%q6,:),last(%q6,:))] , [u(me/fn`getformat,first(%q7,:),last(%q7,:))] , [u(me/fn`getformat,first(%q8,:),last(%q8,:))] , [u(me/fn`getformat,first(%q9,:),last(%q9,:))] , [u(me/format`filler)] , [u(me/format`colseperator)] , [u(me/format`rowseperator)] )]
&FN`DO Custom Who and Where <CWW>=
&FN`DO`CWHERE Custom Who and Where <CWW>=[if( get(me/option`customheader) , u(me/format`header),[repeat(-,width(%#))] )]%r[u(me/fn`cwhere , default(%#/[u(me/option`whereprefplayerattr)],u(me/defaults`wherepreferences)) )]%r[if( get(me/option`customfooter) , u(me/format`footer),[repeat(-,width(%#))] )]
&FN`DO`CWHO Custom Who and Where <CWW>=[if( get(me/option`customheader) , u(me/format`header),[repeat(-,width(%#))] )]%r[u(me/fn`cwho , default(%#/[u(me/option`whoprefplayerattr)],u(me/defaults`whopreferences)) )]%r[if( get(me/option`customfooter) , u(me/format`footer),[repeat(-,width(%#))] )]
&FN`GETCLIENT Custom Who and Where <CWW>=[switch(first(setr(t,terminfo(%0))),zmud,Z,ALCLIENT,A,Atlantis,N,SimpleMU,S,TINYFUGUE,T,ANSI,?,XTERM-COLOR,X,XTERM,X,MuckClient,C,KMuddy,K,dumb,D,mushclient,#,pueblo,@,Beip,B,linux,L,VT100,R,vt320,R,unknown,if(streq(%qt,unknown pueblo telnet),[ansi(fhr,!)],switch(1,andflags(%0,CA),*,andflags(%0,A),+,streq(%qt,unknown),0,-)))]
&FN`GETFORMAT Custom Who and Where <CWW>=iter( u(fn`getwholist) , if( match(get(me/option`invalidfieldnames) , %0) , DNE , [mid(udefault( me/format`%0 , DNE! , itext(0) , %1 ),0,[mid(%1,1,5)])] ) ,,%r )
&FN`GETNAMEFORMAT Custom Who and Where <CWW>=[udefault(me/format`nameformat`%0,[null()],%1)]
&FN`GETNUMBER Custom Who and Where <CWW>=delete(last(grab(%0,%1*,|),:),0,1)
&FN`GETNUMBERS Custom Who and Where <CWW>=[iter(%0, [last( itext(0) , : )] , | , %b )] [iter( [lnum(sub(10,words(%0,|)))] , 0 ,,%b )]
&FN`GETSTATUS Custom Who and Where <CWW>=[c_gendername(%0)] - [status(%0)]
&FN`GETWFORMAT Custom Who and Where <CWW>=iter( u(fn`getwherelist) , if( match(get(me/option`invalidfieldnames) , %0) , DNE , [mid(udefault( me/format`%0 , DNE! , itext(0) , %1 ),0,[mid(%1,1,5)])] ) ,,%r )
&FN`GETWHERELIST Custom Who and Where <CWW>=if( u(me/fn`canseehidden,%#) , sortkey(me/fn`wheresort,setdiff(lwho(),get(me/option`ignorelist))) , sortkey(me/fn`wheresort,setdiff(mwho(),get(me/option`ignorelist))) )
&FN`GETWHOLIST Custom Who and Where <CWW>=if( u(me/fn`canseehidden,%#) , sortkey(me/fn`whosort,setdiff(lwho(),get(me/option`ignorelist))) , sortkey(me/fn`whosort,setdiff(mwho(),get(me/option`ignorelist))) )
&FN`ISBUILDER Custom Who and Where <CWW>=haspower(%0,builder)
&FN`ISSTAFF Custom Who and Where <CWW>=isstaff(%0)
&FN`MIDLINE Custom Who and Where <CWW>=if( get(me/option`midline) , u(me/format`midline) )
&FN`NAMELINE Custom Who and Where <CWW>=[ansi(c,[ljust([align( [u(fn`getnumbers,%0)] , [u(me/fn`getnameformat,first(%q0,:),last(%q0,:))] , [u(me/fn`getnameformat,first(%q1,:),last(%q1,:))] , [u(me/fn`getnameformat,first(%q2,:),last(%q2,:))] , [u(me/fn`getnameformat,first(%q3,:),last(%q3,:))] , [u(me/fn`getnameformat,first(%q4,:),last(%q4,:))] , [u(me/fn`getnameformat,first(%q5,:),last(%q5,:))] , [u(me/fn`getnameformat,first(%q6,:),last(%q6,:))] , [u(me/fn`getnameformat,first(%q7,:),last(%q7,:))] , [u(me/fn`getnameformat,first(%q8,:),last(%q8,:))] , [u(me/fn`getnameformat,first(%q9,:),last(%q9,:))] ,-,-)],width(%#),-)])]%r
&FN`SORT Custom Who and Where <CWW>=switch( %0 , locationname , name(loc(%1)) , locationdb , loc(%1) , playername , name(%1) , idletime, idle(%1) , conntime , conn(%1) , playerdb , %1 , area , getarea(loc(%1)) )]
&FN`WHERESORT Custom Who and Where <CWW>=u(me/fn`sort , [udefault(%#/[get(me/option`wheresortattribute)],get(me/defaults`wheresort))] , %0 )
&FN`WHOSORT Custom Who and Where <CWW>=u(me/fn`sort , [udefault(%#/[get(me/option`whosortattribute)],get(me/defaults`whosort))] , %0 )
&FN`WORKIT Custom Who and Where <CWW>=[iter( %0 , [setq(dec(#@), itext(0) )] , | ,)]
&FORMAT Custom Who and Where <CWW>=Edit these files if you want to add more fields. But only if you know what you are doing.
&FORMAT`AREA Custom Who and Where <CWW>=getarea(loc(%0))
&FORMAT`BIT Custom Who and Where <CWW>=[getbit(%0)]
&FORMAT`COLSEPERATOR Custom Who and Where <CWW>=%b
&FORMAT`CONNECTION Custom Who and Where <CWW>=[rjust(first(timestring(conn(%0))),3)]/[ljust(first(timestring(idle(%0))),3)]
&FORMAT`DOING Custom Who and Where <CWW>=[doing(%0)]
&FORMAT`FILLER Custom Who and Where <CWW>=%b
&FORMAT`FOOTER Custom Who and Where <CWW>=[ansi(hb,[rjust(%< [ansi(hc,timefmt($X - $d/$m/$y))] >------,width(%#),-)])]
&FORMAT`HEADER Custom Who and Where <CWW>=[ansi(hb,[rjust([ansi(hb,<)] [ansi(hc,Who is online?)] [ansi(hb,>--------)],width(%#),-)])]
&FORMAT`LOCATION Custom Who and Where <CWW>=[if( u(fn`canseeunfindable,%#,%0) , [trim(first(name(loc(%0)),-))] [if( u(me/fn`canseedb,%#,%0) ,<[loc(%0)]>)] , Unfindable! )]
&FORMAT`MAIL Custom Who and Where <CWW>=[first(rest(mail(%0)))]
&FORMAT`MIDLINE Custom Who and Where <CWW>=[ansi(hb,repeat(-,width(%#)))]%r
&FORMAT`NAME Custom Who and Where <CWW>=[name(%0)] [if( u(me/fn`canseedb,%#,%0) ,<%0>)]
&FORMAT`NAMEFORMAT Custom Who and Where <CWW>=This is a sub-attribute tree that contains the information for the NAMELINE for each of these FORMATS except for that ones that are 'ignored', such as the header and footer.
&FORMAT`NAMEFORMAT`AREA Custom Who and Where <CWW>=[ansi(n,Area)]
&FORMAT`NAMEFORMAT`BIT Custom Who and Where <CWW>=-
&FORMAT`NAMEFORMAT`CONNECTION Custom Who and Where <CWW>=[ansi(n,Con/Idl)]
&FORMAT`NAMEFORMAT`DOING Custom Who and Where <CWW>=[ansi(n,Doing)]
&FORMAT`NAMEFORMAT`LOCATION Custom Who and Where <CWW>=[ansi(n,Location)]
&FORMAT`NAMEFORMAT`MAIL Custom Who and Where <CWW>=[ansi(n,Mail)]
&FORMAT`NAMEFORMAT`NAME Custom Who and Where <CWW>=[ansi(n,Name)]
&FORMAT`NAMEFORMAT`STATUS Custom Who and Where <CWW>=[ansi(n,Status)]
&FORMAT`ROWSEPERATOR Custom Who and Where <CWW>=%r
&FORMAT`SPACE Custom Who and Where <CWW>=%b
&FORMAT`STATUS Custom Who and Where <CWW>=[u(fn`getstatus,%0)]
&OPTION Custom Who and Where <CWW>=The options to the commands on this object.
&OPTION`CUSTOMFOOTER Custom Who and Where <CWW>=1
&OPTION`CUSTOMHEADER Custom Who and Where <CWW>=1
&OPTION`IGNORELIST Custom Who and Where <CWW>=
&OPTION`INVALIDFIELDNAMES Custom Who and Where <CWW>=COLSEPERATOR FILLER FOOTER HEADER MIDLINE ROWSEPERATOR
&OPTION`MIDLINE Custom Who and Where <CWW>=0
&OPTION`NAMELINE Custom Who and Where <CWW>=1
&OPTION`WHEREPREFPLAYERATTR Custom Who and Where <CWW>=hiddendata`wherepreference
&OPTION`WHERESORTATTRIBUTE Custom Who and Where <CWW>=hiddendata`wheresort
&OPTION`WHOPREFPLAYERATTR Custom Who and Where <CWW>=hiddendata`whopreference
&OPTION`WHOSORTATTRIBUTE Custom Who and Where <CWW>=hiddendata`whosort

look Custom Who and where <CWW>