Archer's Globals Object

A globals object that demonstrates how to create the global commands who, finger, time, where and admin.

Author: Archer@M*U*S*H
Category: Globals
Commands: @create, @link, @lset, @set, @switch.
Compatibility: CobraMUSH, PennMUSH.

Instructions

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

MUSHCode for Archer's Globals Object

@create Globals Object
@link Globals Object = #0
@lock/Basic Globals Object==me
@lset Globals Object/Basic=no_inherit
@set Globals Object = VISUAL
@set Globals Object = !NO_COMMAND
&+ADMIN Globals Object=$admin +*:@switch [match([owner(me)],%#)]=0,{@pemit/silent %#=[ansi(hr,Permission denied.)]},{@switch [setr(0,[pmatch(*%0)])]=#-1,{@pemit/silent %#=[ansi(hr,"%0" is not a valid player.)]},{@switch [t([member([v(admin_list)],%q0)])]=1,{@pemit/silent %#=[ansi(hr,"%0" is already on the admin list.)]},{@set me=admin_list:[cat([v(admin_list)],%q0)];@pemit/silent %#='[ansi(h,[name(%q0)])]' added to the admin list.}}}
&-ADMIN Globals Object=$admin -*:@switch [match([owner(me)],%#)]=0,{@pemit/silent %#=[ansi(hr,Permission denied.)]},{@switch [t([member([v(admin_list)],[setr(1,[num(*%0)])])])]=0,{@pemit/silent %#=[ansi(hr,"%0" is not on the admin list.)]},{@set me=admin_list:[remove([v(admin_list)],%q1)];@pemit/silent %#='[ansi(h,[name(%q1)])]' removed from the admin list.}}
&ADMIN Globals Object=$admin:@pemit/silent %#=[u(me/header)][ljust([ansi(h,STA)],4)][ljust([ansi(h,Name)],23)][ljust([ansi(h,Position)],32)][ljust([ansi(h,Last On)],12)][iter([v(admin_list)],%r[ljust([switch([hasflag(##,WIZARD)],1,[ansi(hr,WIZ)],[switch([hasflag(##,ROYALTY)],1,[ansi(hb,ROY)],[ansi(hw,???)])])],4)][ljust([left([name(##)][switch([hasattr(##,alias)],1,%b<[get(##/alias)]>,)],22)],23)][ljust([left([u(me/check,[get(##/position)])],31)],32)][ljust([switch([conn(##)],-1,[elements([get(##/last)],1 2 3 4)],[ansi(hg,<Connected>)])],12)])]%r[u(me/footer)]
@set Globals Object=ADMIN_LIST:%b#7 #186 #1149 #1485 #1622 #1625 #4800 #1710 #4019 #1213 #6 #127 #128 #189 #1623 #2024 #2218 #3799 #5973 #3107 #6388 #6061 #5530
&CHECK Globals Object=[switch(%0,#-1*,%b,%0)]
&DESCRIBE Globals Object=Commands:%r%rwho%rfinger <name>%rtime%rwhere%radmin +<name> (owner only)%radmin -<name> (owner only)%radmin%r%rMore to come!
@set Globals Object/DESCRIBE=no_command visual public nearby
&FINGER Globals Object=$finger *:@pemit/silent %#=[switch([setr(0,[pmatch(*%0)])],#-1,{[ansi(hr,"%0" is not a valid player.)]},#-2,{[ansi(hr,I don't know which %0 you mean.)]},{[u(me/header)][ljust(Name: [ansi(h,[name(%q0)])][switch([hasattr(%q0,alias)],1,%b<[get(%q0/alias)]>,)],30)][ljust(Sex: [switch([poss(%q0)],his,Male,her,Female,their,Plural,Neuter)],30)]Status: [switch([hasflag(%q0,WIZARD)],1,[ansi(hr,WIZARD)],[switch([hasflag(%q0,ROYALTY)],1,[ansi(hb,ROYALTY)],[ansi(hg,PLAYER)])])]%rLocation: [switch([loc(%q0)],#-1*,[ansi(hr,UNFINDABLE)],[left([name([loc(%q0)])]%b%([loc(%q0)][flags([loc(%q0)])]%),64)])]%rPosition: [left([u(me/check,[get(%q0/position)])],68)]%rWWW: [left([u(me/check,[get(%q0/www)])],72)]%rElseMU*: [left([u(me/check,[get(%q0/elsemu)])],68)]%rE-mail: [ljust([left([u(me/check,[get(%q0/email)])],37)],39)]ICQ: [left([u(me/check,[get(%q0/icq)])],26)]%rReal Location: [left([u(me/check,[get(%q0/location)])],63)]%rLast On: [switch([conn(%q0)],-1,[ansi(hr,[get(%q0/last)])],[ansi(hg,[ljust(<Connected>,21)])][ljust(On For: [elements([timestring([conn(%q0)])], 1 2 3)],30)]Idle: [elements([timestring([idlesecs(%q0)])], 1 2)])]%r[u(me/footer)]%rNote: [u(%q0/note)]%r[u(me/footer)]
&FOOTER Globals Object=[ansi(h,[repeat(~,78)])]
&HEADER Globals Object=[ansi(h,[repeat(~,78)])]%r[center(<<<[ansi(h,[mudname()])]>>>,78)]%r[ansi(h,[repeat(~,78)])]%r
&TIME Globals Object=$time:@pemit/silent %#=[ansi(h,The current [mudname()] %(server%) time is:)] [time()]
&WHERE Globals Object=$where:@pemit/silent %#=[u(me/header)][ljust([ansi(h,Name)],25)][ansi(h,Location)][iter([lwho()],%r[ljust([left([name(##)][switch([hasattr(##,alias)],1,%b<[get(##/alias)]>,)],24)],25)][switch([loc(##)],#-1,[ansi(hr,UNFINDABLE)],[left([name([loc(##)])],45)][switch([hasflag([loc(##)],jump_ok)],1,%b%([left([loc(##)],6)]%),)])])]%r[u(me/footer)]
&WHO Globals Object=$who:@pemit/silent %#=[u(me/header)][ansi(h,[ljust(STA,4)])][ansi(h,[ljust(Name,20)])][ansi(h,[ljust(Location,38)])][ansi(h,[ljust(On For,12)])][ansi(h,[ljust(Idle,4)])][iter([lwho()],%r[ljust([switch([hasflag(##,WIZARD)],1,[ansi(hr,WIZ)],[switch([hasflag(##,ROYALTY)],1,[ansi(hb,ROY)],[ansi(hg,PLR)])])],4)][ljust([left([name(##)][switch([hasattr(##,alias)],1,%b<[get(##/alias)]>,)],19)],20)][switch([loc(##)],#-1*,[ljust([ansi(hr,UNFINDABLE)],38)],[ljust([left([name([loc(##)])],29)][switch([hasflag([loc(##)],JUMP_OK)],1,%b%([loc(##)]%))],38)])][ljust([elements([timestring([conn(##)])],1 2)],12)][ljust([elements([timestring([idlesecs(##)])],1)],4)])]%r[u(me/footer)]%r[center([ansi(hy,Connected Players:)]%b[ansi(hy,[words([lwho()])])],78)]%r[u(me/footer)]