ChampionsMUSH Globals

Instructions

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

MUSHCode for ChampionsMUSH Globals

@@ Some general rules:
@@
@@ Any line which, like this, begins with @@, is a comment and should NOT
@@ be pasted into your MUSH
@@
@@ If you already have a global object like a WHO Machine, then you can
@@ just stick this code onto it instead of making up a whole new object
@@
@@ Commands:
@@ +who: Shows a list of players, their alias, and their &doing (set
@@ with &doing me=<stuff>)
@@
@@ +where: Shows a list of players and their location (checks for
@@ UNFINDABLE)
@@
@@ who: Shows a list of players, their alias, and their location (checks
@@ for UNFINDABLE)
@@ +finger: Shows 'finger' details for a given player
@@
@@ Code details:
@@ The who machine itself stores an attrib called @vz.
@@ This keeps track of the record number of players connected. It
@@ should also correct for people with multiple idle
@@ reconnects (using setunion) and does NOT count dark wizards (mwho()
@@ doesn't show dark folks)
@@
@@ You must be a WIZARD to set this up (only wizards can give @powers to
@@ objects)
@@
@@ This will create 2 objects, the Who Machine Parent, and the Who
@@ Machine. The Parent should be left in some other place besides
@@ the Master room. If your master room is not #2, you should
@@ change the @link of the who machine from #2 to the appropriate db#
@@
@@ +finger allows players to set the following attributes, view-able
@@ with +finger: &note, &quote @sex, and &elsemush (for else-mush
@@ character lists). Other fields may be added by doing:
@@ &FFIND_<fieldname> who machine parent=<stuff to evaluate>.
@@
@@ Disclaimer: I don't really support this code in any way. It's not
@@ really coded like this at all on Champions MUSH... I had to simplify
@@ it to make it standardized to work anywhere. Because these commands
@@ already exist as globals on CM, I can't test them on a global object
@@ the way I probably should. All I can say is, use at your own risk. If
@@ you have problems you can email me, but I will not make any guarantees
@@ that I'll have time to help. I will if I can; if not... you're on
@@ your own.
@@
@@ Coded by Steven @ Champions MUSH
@@

@create Who Machine parent

@lock/Basic Who Machine parent==me

@set Who Machine parent = SAFE

@set Who Machine parent = NO_COMMAND

@power Who Machine parent = See_All


&WHERE_TITLES Who Machine parent=[center(\[ [mudname()]: Current Player Locations \],75,-)]%r[ljust(Name,16)]Location%r[repeat(-,15)]%b[repeat(-,59)]

&WHERE_FUNCTION Who Machine parent=[iter(squish(mwho()),[ljust(mid(name(##),0,15),16)][switch(hasflag(##,unfindable),1,UNFINDABLE,mid(name(loc(##)),0,55))], ,%r)]

&FINGER_ALL_FUN Who Machine parent=[ansi(hm,center(\[ [name(%0)][switch(hasattr(%0,alias),1,%b\( Alias: [get(%0/alias)] \))] \],75,-))]%r[u(finger_fun,%0)]%r[ansi(hm,repeat(-,75))]

&FINGER_FUN who machine parent=[iter(lattr([parent(me)]/ffind_*),[edit(rest(##,_),_,%b)]: [ulocal(##,%0)], ,%r)]

&FFIND_LOCATION who machine parent=[ifelse(and(not(hasflag(%0,dark)),not(hasflag(%0,unfindable))),name(loc(%0)),UNKNOWN)]

&FFIND_IDLE who machine parent=[timestring(idle(%0))]

&FFIND_CONNECTION who machine parent=[ifelse(eq(match(mwho(),%0),0),get(%0/last),timestring(conn(%0)))]

&FFIND_ELSEMUSH who machine parent=[get(%0/elsemush)]

&FFIND_NOTE who machine parent=[get(%0/note)]

&FFIND_QUOTE who machine parent=[get(%0/quote)]

&FFIND_GENDER who machine parent=[get(%0/sex)]

@DESCRIBE Who Machine parent=[table(sort(lattr(me)),25,78)]


&WHO_TITLE_FUN Who Machine parent=[ljust(Name,17)][ljust(Alias,12)][ansi(hc,ljust(What are you DOING today?,42))][rjust(Idle,5)]%r[repeat(-,16)]%b[repeat(-,11)]%b[repeat(-,42)]%b[repeat(-,4)]

&WHO_LIST_FUN Who Machine parent=[setq(0,squish(mwho()))][iter(%q0,[ljust(mid(name(##),0,15),16)]%b[ljust(mid(get(##/alias),0,11),12)][ljust(mid(get(##/doing),0,40),41)]%b[rjust(extract(timestring(idle(##)),1,1),5)], ,%r)]

&OLDWHO_LIST_FUN Who Machine parent=[setq(0,squish(mwho()))][iter(%q0,[ljust(mid(name(##),0,15),16)]%b[ljust(mid(get(##/alias),0,11),12)][ljust(mid(switch(hasflag(##,unfindable),1,UNFINDABLE,name(loc(##))),0,40),41)]%b[rjust(extract(timestring(idle(##)),1,1),5)], ,%r)]


@create Who Machine

@link Who Machine = #2

@parent Who Machine=who machine parent

@lock/Basic Who Machine==me

@set Who Machine = SAFE

@power Who Machine = See_All

@power Who Machine = pemit_all

&CMD_+WHERE Who Machine=$+where: @pemit %#=[tagwrap(pre,[u(where_titles)]%r[u(where_function)]%r[repeat(-,75)])]

&CMD_+FINGER Who Machine=$+finger *: @pemit %#=[tagwrap(pre,[switch(strmatch([setq(0,pmatch(%0))]%q0,#-*),1,That is not a valid player.,ulocal(finger_all_fun,%q0))])]

@ACONNECT Who Machine=@switch/first gt([setq(0,words(setunion(mwho(),%#)))]%q0,%vz)=1,{@vz me=%q0},{think nope}

@VZ Who Machine=0

@DESCRIBE Who Machine=This machine runs the +who, +where, +finger, and other such commands for the MUSH.%r[table(lattr(me),18,80)]

&CMD_WHO Who Machine=$+who: @pemit %#=[tagwrap(pre,[u(who_title_fun)]%r[u(who_list_fun)]%r[repeat(-,76)]%r[center(\[ Players connected: [words(mwho())] \(Record: %vz\) \],76,-)])]

&CMD_OLDWHO Who Machine=$who: @pemit %#=[tagwrap(pre,[u(who_title_fun)]%r[u(oldwho_list_fun)]%r[repeat(-,76)]%r[center(\[ Players connected: [words(mwho())] \(Record: %vz\) \],76,-)])]

@@ & who
@@ --------------------------[ Global MUSH: +HELP ]--------------------------
@@ The 'who' command is a special command that allows players to view who
@@ is currently connected. Unlike the capital 'WHO' command, which is
@@ common to all MUSHes, 'who has been programmed specifically with
@@ information that is (hopefully) more useful to you. This connected
@@ players, their alias , their idle time, and their location.
@@
@@ Files of related interest: +HELP +WHO, +HELP +WHERE
@@
@@ Usage: who
@@ -----------------------------------------------------------------------------
@@ & +who
@@ --------------------------[ Global MUSH: +HELP ]--------------------------
@@ The +WHO command is a special command that allows players to view who
@@ is currently connected. Unlike the capital 'WHO' command, which is
@@ common to all MUSHes, +WHO has been programmed specifically with
@@ information that is (hopefully) more useful to you. This includes
@@ connected players, their alias , their idle time, and their 'doing.'
@@ You can set any 'doing' you want (35 character limit) by typing &doing
@@ me=<whatever> and it will appear in the connected players list
@@ whenever someone types +WHO. For specific current locations of all
@@ players, see +HELP +WHERE.
@@
@@ Usage: +WHO
@@ -----------------------------------------------------------------------------
@@ & +where
@@ --------------------------[ Global MUSH: +HELP ]--------------------------
@@ The +WHERE command gives you a list of the name and location of every
@@ player connected. It's useful for getting a good idea of where
@@ several people are at once. Like 'who' and +FINGER, +WHERE supports
@@ the UNFINDABLE flag, so if you @set yourself=unfindable, your current
@@ location will NOT appear on the +WHERE list. As a side note, +WHERE
@@ does not tell you how many players are connected. Only +WHO and WHO do
@@ that.
@@
@@ Usage: +WHERE
@@ -----------------------------------------------------------------------------
@@ & +finger
@@ --------------------------[ Global MUSH: +HELP ]--------------------------
@@ The +finger command allows you to view general information about a
@@ specific player. Some of the finger-stats are set for you
@@ by the game. Others you must set for yourself.
@@
@@ Fields for +finger:
@@
@@ Field How to set it
@@ ------------------------------ ---------------------------------
@@ Your Gender @set me=<Male | Female | Neuter>
@@ Your ElseMUSH characters &elsemush me=<list of characters>
@@ A Note about yourself &note me=<anything you want>
@@ You favorite quote &quote me=<anything you want>
@@ Your Alias @alias me=<alias>
@@
@@ Usage: +FINGER <player>
@@ -----------------------------------------------------------------------------
@@
@@