Who and Where
An object that demonstrates a 'who' and 'finger' command.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Who and Where
@create Multi-function object
@link Multi-function object = #2
@lock/Basic Multi-function object==me
@lset Multi-function object/Basic=no_inherit
@lock/Enter Multi-function object=#0
@lset Multi-function object/Enter=no_inherit
@set Multi-function object=OPAQUE
@set Multi-function object=WIZARD
@set Multi-function object=NO_LEAVE
@set Multi-function object=!NO_COMMAND
&CMD_WHO Multi-function object=$who:Think PEmit(%#,[Ansi(hb,=)][Ansi(hr,\[)][Ansi(hw,[MUDName()]: Who's connected?)][Ansi(hr,\])][Ansi(hb,[Repeat(=,[Sub(58,StrLen(MUDName()))])])]%r[Ansi(hb,[Repeat(_,79)])]%r[Ansi(hy,[Space(1)]Name[Space(12)]Nick[Space(3)]On For[Space(6)]Idle For [Space(3)]Location)]%r[Ansi(hb,[Repeat(-,79)])]%r[Parse(MWho(),[Ansi(UFun(ME/FN_PLAYERCOLOUR,##),[Space(1)][LJust(Name(##),15)])] [LJust(Left(XGet(##,ALIAS),6),6)] [LJust(Extract(Left(Squish(TimeString(Conn(##))),11),1,3),11)] [LJust(Extract(Left(Squish(TimeString(IdleSecs(##))),11),1,3),11)] [Switch(Loc(##),{#-1},[Ansi(hx,\(Unfindable\))],[UFun(ME/FN_ELLIPSIS,Name(Loc(##)),31)])]%r,,)][Ansi(x,.)]%r[Center([Ansi(hc,WIZARD)] - [Ansi(hy,ROYALTY)] - [Ansi(hm,BUILDER)] - PLAYER - [Ansi(hg,GUEST)],79)]%r[Ansi(hb,[Repeat(=,[Sub(76,[Val(StrLen(UFun(ME/FN_NUMCONNECTED)))])])])][Ansi(hg,\[)][Ansi(hw,[UFun(ME/FN_NUMCONNECTED)])][Ansi(hg,\])][Ansi(hb,=)])
&DESCRIBE Multi-function object=My WHO object, treat it nice. :)
@set Multi-function object/DESCRIBE=no_command visual public nearby
&DO_FINGER Multi-function object=$finger *:@PEmit [Num(*{%N})]=[Switch([HasType(*{%0},PLAYER)],1,[Ansi(hb,[Repeat(=,79)])]%r[Ansi(hw,Center(Information on "[Name(*{%0})]",79))]%r[Ansi(hb,[Repeat(=,79)])]%r%r[Ansi(hw,General)]%r[Ansi(hb,[Repeat(-,7)])]%r [LJust(Position,12)]: [Switch([XGet([Num(*{%0})],POSITION)],{},(None set),[XGet([Num(*{%0})],POSITION)])]%r [LJust(Nickname,12)]: [Switch([XGet([Num(*{%0})],ALIAS)],{},(Not given),[XGet([Num(*{%0})],ALIAS)])]%r [LJust(E-mail,12)]: [Switch([XGet([Num(*{%0})],EMAIL)],{},(Not given),[XGet([Num(*{%0})],EMAIL)])]%r [LJust(ICQ #,12)]: [Switch([XGet([Num(*{%0})],ICQ)],,(None set),[XGet([Num(*{%0})],ICQ)])]%r%r [LJust(Gender,12)]: [Switch([XGet([Num(*{%0})],SEX)],{},None,[XGet([Num(*{%0})],SEX)])]%r [LJust(Age,12)]: [Switch([XGet([Num(*{%0})],AGE)],{},(Not given),[XGet([Num(*{%0})],AGE)])]%r [LJust(Location,12)]: [Switch([Name(Loc([Num(*{%0})]))],{},(Unfindable),[Name(Loc([Num(*{%0})]))])]%r%r[Ansi(hw,Connection)]%r[Ansi(hb,[Repeat(-,10)])]%r [Switch(HasFlag([Num(*{%0})],CONNECTED),1,[LJust(On for,12)]: [Squish([TimeString([Conn([Num(*{%0})])])])]%r [LJust(Idle for,12)]: [Squish([TimeString([IdleSecs([Num(*{%0})])])])]%r, [Name(*{%0})] is not currently connected to [MUDName()].%r)] [LJust(Last online,12)]: [XGet([Num(*{%0})],LAST)]%r%r[Ansi(hw,Appearance)]%r[Ansi(hb,[Repeat(-,10)])]%r[Switch([Eval([Num(*{%0})],DESCRIBE)],{},You see nothing special.,[Eval([Num(*{%0})],DESCRIBE)])]%r%r[Ansi(hw,Note)]%r[Ansi(hb,[Repeat(-,4)])]%r[Switch([Eval([Num(*{%0})],NOTE)],{},None.,[Eval([Num(*{%0})],NOTE)])]%r%r[Ansi(hb,[Repeat(=,79)])],That player does not exist.)]
&FN_ELLIPSIS Multi-function object=[Switch(%1,>2,[Switch(StrLen(%0),>%1,[Left(%0,Sub(%1,3))]...,LJust(%0,%1))],#-1 LENGTH MUST BE 3 OR GREATER)]
&FN_NUMCONNECTED Multi-function object=There [Switch(Words(LWho()),1,is 1 player,are [Words(MWho())] players)] connected.
&FN_PLAYERCOLOUR Multi-function object=[Switch(HasFlag({%0},WIZARD),1,hc,[Switch(HasFlag({%0},ROYALTY),1,hy,[Switch(HasPower({%0},BUILDER),1,hm,[Switch(HasPower({%0},GUEST),1,hg,)])])])]
think Commands: 'who' and 'finger <player>'
@link Multi-function object = #2
@lock/Basic Multi-function object==me
@lset Multi-function object/Basic=no_inherit
@lock/Enter Multi-function object=#0
@lset Multi-function object/Enter=no_inherit
@set Multi-function object=OPAQUE
@set Multi-function object=WIZARD
@set Multi-function object=NO_LEAVE
@set Multi-function object=!NO_COMMAND
&CMD_WHO Multi-function object=$who:Think PEmit(%#,[Ansi(hb,=)][Ansi(hr,\[)][Ansi(hw,[MUDName()]: Who's connected?)][Ansi(hr,\])][Ansi(hb,[Repeat(=,[Sub(58,StrLen(MUDName()))])])]%r[Ansi(hb,[Repeat(_,79)])]%r[Ansi(hy,[Space(1)]Name[Space(12)]Nick[Space(3)]On For[Space(6)]Idle For [Space(3)]Location)]%r[Ansi(hb,[Repeat(-,79)])]%r[Parse(MWho(),[Ansi(UFun(ME/FN_PLAYERCOLOUR,##),[Space(1)][LJust(Name(##),15)])] [LJust(Left(XGet(##,ALIAS),6),6)] [LJust(Extract(Left(Squish(TimeString(Conn(##))),11),1,3),11)] [LJust(Extract(Left(Squish(TimeString(IdleSecs(##))),11),1,3),11)] [Switch(Loc(##),{#-1},[Ansi(hx,\(Unfindable\))],[UFun(ME/FN_ELLIPSIS,Name(Loc(##)),31)])]%r,,)][Ansi(x,.)]%r[Center([Ansi(hc,WIZARD)] - [Ansi(hy,ROYALTY)] - [Ansi(hm,BUILDER)] - PLAYER - [Ansi(hg,GUEST)],79)]%r[Ansi(hb,[Repeat(=,[Sub(76,[Val(StrLen(UFun(ME/FN_NUMCONNECTED)))])])])][Ansi(hg,\[)][Ansi(hw,[UFun(ME/FN_NUMCONNECTED)])][Ansi(hg,\])][Ansi(hb,=)])
&DESCRIBE Multi-function object=My WHO object, treat it nice. :)
@set Multi-function object/DESCRIBE=no_command visual public nearby
&DO_FINGER Multi-function object=$finger *:@PEmit [Num(*{%N})]=[Switch([HasType(*{%0},PLAYER)],1,[Ansi(hb,[Repeat(=,79)])]%r[Ansi(hw,Center(Information on "[Name(*{%0})]",79))]%r[Ansi(hb,[Repeat(=,79)])]%r%r[Ansi(hw,General)]%r[Ansi(hb,[Repeat(-,7)])]%r [LJust(Position,12)]: [Switch([XGet([Num(*{%0})],POSITION)],{},(None set),[XGet([Num(*{%0})],POSITION)])]%r [LJust(Nickname,12)]: [Switch([XGet([Num(*{%0})],ALIAS)],{},(Not given),[XGet([Num(*{%0})],ALIAS)])]%r [LJust(E-mail,12)]: [Switch([XGet([Num(*{%0})],EMAIL)],{},(Not given),[XGet([Num(*{%0})],EMAIL)])]%r [LJust(ICQ #,12)]: [Switch([XGet([Num(*{%0})],ICQ)],,(None set),[XGet([Num(*{%0})],ICQ)])]%r%r [LJust(Gender,12)]: [Switch([XGet([Num(*{%0})],SEX)],{},None,[XGet([Num(*{%0})],SEX)])]%r [LJust(Age,12)]: [Switch([XGet([Num(*{%0})],AGE)],{},(Not given),[XGet([Num(*{%0})],AGE)])]%r [LJust(Location,12)]: [Switch([Name(Loc([Num(*{%0})]))],{},(Unfindable),[Name(Loc([Num(*{%0})]))])]%r%r[Ansi(hw,Connection)]%r[Ansi(hb,[Repeat(-,10)])]%r [Switch(HasFlag([Num(*{%0})],CONNECTED),1,[LJust(On for,12)]: [Squish([TimeString([Conn([Num(*{%0})])])])]%r [LJust(Idle for,12)]: [Squish([TimeString([IdleSecs([Num(*{%0})])])])]%r, [Name(*{%0})] is not currently connected to [MUDName()].%r)] [LJust(Last online,12)]: [XGet([Num(*{%0})],LAST)]%r%r[Ansi(hw,Appearance)]%r[Ansi(hb,[Repeat(-,10)])]%r[Switch([Eval([Num(*{%0})],DESCRIBE)],{},You see nothing special.,[Eval([Num(*{%0})],DESCRIBE)])]%r%r[Ansi(hw,Note)]%r[Ansi(hb,[Repeat(-,4)])]%r[Switch([Eval([Num(*{%0})],NOTE)],{},None.,[Eval([Num(*{%0})],NOTE)])]%r%r[Ansi(hb,[Repeat(=,79)])],That player does not exist.)]
&FN_ELLIPSIS Multi-function object=[Switch(%1,>2,[Switch(StrLen(%0),>%1,[Left(%0,Sub(%1,3))]...,LJust(%0,%1))],#-1 LENGTH MUST BE 3 OR GREATER)]
&FN_NUMCONNECTED Multi-function object=There [Switch(Words(LWho()),1,is 1 player,are [Words(MWho())] players)] connected.
&FN_PLAYERCOLOUR Multi-function object=[Switch(HasFlag({%0},WIZARD),1,hc,[Switch(HasFlag({%0},ROYALTY),1,hy,[Switch(HasPower({%0},BUILDER),1,hm,[Switch(HasPower({%0},GUEST),1,hg,)])])])]
think Commands: 'who' and 'finger <player>'