Simple Globals

A series of globals, including +pronounce (how to pronounce someone's name, given they've set an attribute), +laston (last time someone was on), +where, +inspect (room inspector for missing attributes and such), and +globals (list of globals).

Author: Maxi Rose
Category: Globals
Commands: @force, @pemit, @switch, @trigger.
Compatibility: CobraMUSH, PennMUSH, TinyMUX.

Instructions

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

MUSHCode for Simple Globals

Many of these globals were coded by Opa of PernMUSH and are released with her permission. Please do not bother her about fixing or supporting this code. It is provided as-is. The only caveat I have for you using this, is that if you improve this code significantly or make some really great project using a good portion of this code, please give me a copy. :)

@}>-`--,-- Maxi Rose Ghost of a Texas Lady

teleute@interlog.com

-----------------------------------------------------------------------------

Pronounce command: Lets people write the phonetics of how to pronounce
their character's name. Nothing more than an attr call.
LastOn command: Will tell you when a specified player last logged on, and
how long they were on for.
NewLast command: An update to LastOn, I think.
Where command: Gives a columned list of all the players and where they are.
Inspect command: Helps make sure all rooms and their exits have appropriate
descs and osucc, etc. Works one room at a time.
Globals command: I think it tells all staff what globals are in the master
room along with any players that may be there.


&DO-PRONOUNCE Globals Object (GO)=$+pronounce *:@pemit %#=u(PRINT_ATTR_FN,num(*%0),PRONOUNCE,name is pronounced)
&PRINT_ATTR_FN Globals Object (GO)=[switch(%0,#-1,No such player.,[name(%0)]'s %2: % [edefault(%0/%1,Not set)])]
&DO_LASTON_GLOBAL Globals Object (GO)=$+last *:@pemit %#=[setq(0,get(*%0/last))][setq(1,sub(secs(),convtime(%q0)))][switch(isdbref(num(*%0)),0,There is no such player.,[switch(gt(sub(secs(),convtime(%q0)),86400),0,{Name%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%bOn?%bHours Ago%b%b%bLast connected at%r[repeat(-,61)]%r[switch(hasflag(*%0,dark),0,[ljust(name(*%0),21)][switch(hasflag(*%0,conn),0,[ljust(No,4)][rjust(div(%q1,3600),5)]:[center(trunc(mul(sub(fdiv(%q1,3600),trunc(fdiv(%q1,3600))),60)),2,0)][rjust(%q0,28)]%r,1,[ljust(Yes,4)][center(0,12)]%q0)],1,[ljust(name(*%0),21)][ljust(No,4)][center(round(fdiv(%q0,3600),0),12)]%q0%r)]},{Name%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%bOn?%bDays Ago%b%b%b%BLast connected at%r[repeat(-,61)]%r[switch(hasflag(*%0,dark),0,[ljust(name(*%0),21)][switch(hasflag(*%0,conn),0,[ljust(No,4)][center(div(ceil(fdiv(%q1,43200)),2),12)]%q0%r,1,[ljust(Yes,4)][center(0,12)]%q0)],1,[ljust(name(*%0),21)][ljust(No,4)][center(div(ceil(fdiv(%q1,43200)),2),12)]%q0%r)]})])]
&DO-WHERE Globals Object (GO)=$+where:@fo %#=+where 1
&DO-WHERE-NUM Globals Object (GO)=$+where *:@tr me/TRIG-WHERE=%0,%#
&TRIG-WHERE Globals Object (GO)=@pemit %1=[setq(0,u(FN_LWHO_OK,%1))][setq(1,iter(%q0,loc(##)))][setq(2,sort(setunion(parse(%q1,switch(1,gte(words(matchall(%q1,##)),%0),##)),),d))]Locations[space(39)]Players[iter(%q2,%r[ljust(mid([name(##)][setq(3,owner(##))][switch(1,or(hasflag(##,jump_ok),hasflag(%1,wizard),strmatch(%1,%q3),hasflag(##,visual)),\(##[flags(##)]/[name(%q3)]\))],0,46),48)][u(FMT_WHERE_3COL,u(FN_WHERE_NAMES,##))])]%rNo more locations.
&FN_WHERE_NAMES Globals Object (GO)=[sort(iter(setinter(lcon(%0),%q0),mid(name(##),0,9)))]
&FMT_WHERE_3COL Globals Object (GO)=[iter(extract(%0,1,3),ljust(##,9))][setq(4,extract(%0,4,sub(words(%0),3)))][switch(0,words(%q4),,%r[space(47)][u(FMT_WHERE_3COL,%q4)])]
&DO_LASTON_GLOBAL_NEW Globals Object (GO)=$+newlast *:@pemit %#=[setq(0,get(*%0/last))][setq(1,sub(secs(),convtime(%q0)))][switch(isdbref(num(*%0)),0,There is no such player.,[switch(gt(sub(secs(),convtime(%q0)),86400),0,{Name%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%bOn?%bHours Ago%b%b%bLast connected at%r[repeat(-,61)]%r[switch(hasflag(*%0,dark),0,[ljust(name(*%0),21)][switch(hasflag(*%0,conn),0,[ljust(No,4)][rjust(div(%q1,3600),5)]:[center(trunc(mul(sub(fdiv(%q1,3600),trunc(fdiv(%q1,3600))),60)),2,0)][rjust(%q0,28)]%r,1,[ljust(Yes,4)][center(0,12)]%q0)],1,[ljust(name(*%0),21)][ljust(No,4)][center(round(fdiv(%q0,3600),0),12)]%q0%r)]},{Name%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%bOn?%bDays Ago%b%b%b%BLast connected at%r[repeat(-,61)]%r[switch(hasflag(*%0,dark),0,[ljust(name(*%0),21)][switch(hasflag(*%0,conn),0,[ljust(No,4)][center(div(ceil(fdiv(%q1,43200)),2),12)]%q0%r,1,[ljust(Yes,4)][center(0,12)]%q0)],1,[ljust(name(*%0),21)][ljust(No,4)][center(div(ceil(fdiv(%q1,43200)),2),12)]%q0%r)]})])]
&DO-INSPECT Globals Object (GO)=$+inspect:@pemit %#=switch(0,controls(%#,%l),Permission denied.,Evaluating room...%r%r[u(FN_INSPECT_EVAL)]%r%rEvaluation complete)
&FN_INSPECT_EVAL Globals Object (GO)=[setq(0,lexits(%l))][name(%l)]\(%l[flags(%)]\) owned by [name(owner(%l))]%rExits:[iter(%q0,%r%b%b[name(##)]\(##[flags(##)]\) owned by [name(owner(##))])]%r%rProblem\(s\):[switch(0,words(get(%l/Desc)),%r--the room is not described)][switch(locate(%l,out,cE),#-1,%r--there is no 'out' exit for the room)][iter(drop ex examine give help h kill move p page say throw version enter get goto inventory inv i look l mp view news pose read score take use whisper,switch(1,[setq(1,locate(%l,##,cE))]isdbref(%q1),%r--[name(%q1)] exit \(%q1\) is duplicating a MUSH command with its alias of '##'))][iter(%q0,u(FN_INSPECT_PROBS,##))]%r%rWarning\(s\):[switch(0,words(get(%l/Succ)),%r--the room has no @succ)][iter(%q0,u(FN_INSPECT_WARNS,##))]
&FN_INSPECT_BACKLINK Globals Object (GO)=[setq(1,lexits(loc(%0)))][extract(%q1,match(iter(%q1,loc(##)),%l),1)]
&FN_INSPECT_ACRONYM Globals Object (GO)=[setq(2,name(%0))][edit(iter(iter(lnum(strlen(%q2)),mid(%q2,##,1)),switch(0,member(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9,##),,##)),%b,)]
&FN_INSPECT_PROBS Globals Object (GO)=[setq(3,[name(%0)] exit \(%0\))][setq(4,n ne e se up s sw w nw down)][setq(5,u(FN_INSPECT_BACKLINK,%0))][setq(6,trim(iter(%q4,switch(0,match(fullname(%0),##,;),,##))))][setq(7,trim(iter(%q4,switch(0,match(fullname(%q5),##,;),,##))))][setq(8,[name(%q5)]\(%q5[flags(%q5)]\))][setq(9,u(FN_INSPECT_ACRONYM,%0))][iter(desc succ osucc odrop,switch(0,words(get(%0/##)),%r--%q3 has no @##))][switch(0,words(lock(%0)),,words(get(%0/Fail)),%r--%q3 is locked but has no @fail)][switch(locate(%l,%q9,cE),%0,,#-2,,%r--%q3 needs the acronym alias '%q9')][switch(0,isdbref(loc(%0)),%r--%q3 is not linked to a destination)][switch(0,words(%q5),%r--%q3 doesn't have a backlink)][switch([gt(words(%q),1)]:[gt(words(%q7),1)]:[abs(sub(match(%q4,%q6),match(%q4,%q7)))],1:*,%r--%q3 has more than one directional alias,*:1:*,{%r--the backlink of %q3\, %q8\, has more than one directional alias},*:*:5,,{%r--the directional alias of %q3 and its backlink\, %q8\, do not match up})]
&FN_INSPECT_WARNS Globals Object (GO)=[setq(3,[name(%0)] exit \(%0\))][setq(4,n ne e se up s sw w nw down)][setq(5,u(FN_INSPECT_ACRONYM,%0))][switch(0,words(iter(%q4,switch(0,match(fullname(%0),##,;),,##))),%r--%q3 has no directional alias)][switch(0,match(%q4,%q5),,{%r--the acronym alias of %q3\, '%q5'\, conflicts with a standard direction})]
&MASTER Globals Object (GO)=#5
&DO_GLOBALCHECKER Globals Object (GO)=$+globals:@switch [hasflag(%#,wizard)]=0,@pemit %#=Permission denied.,{@pemit %#=%b[ljust(Global Name,24)]|Num(Per)|Description%r[repeat(-,25)]+[repeat(-,8)]+[repeat(-,40)]%r[setq(0,words(iter(lcon(v(master) v(master),switch(owner(##),##,,lattr(##)))))]%b[iter(sort(v(master) [lcon(v(master))]),switch(owner(##),##,[ljust(name(##),24)]|*PLAYER*|Working on the globals no doubt%r,{[ljust([name(##)],24)]|[rjust([words(lattr(##))],3)]%([rjust(div(mul(100,words(lattr(##))),[r(0)]),2,0)]%%%)|[u(wrap,get(##/desc),[space(25)]|[space(8)]|,40)]%r}))][repeat(-,25)]+[repeat(-,8)]+[repeat(-,40)]%r[ljust(Total,25)]|[rjust(r(0),3)](---)|}
&WRAP_FN Globals Object (GO)=[switch(lte(strlen(%0),%2),1,%0,{[extract(%0,1,[sub([wordpos(%0,%2)],1)])]%r%1[u(wrap,[extract(%0,[wordpos(%0,%2)],9999)],%1,%2)]})]
&CREDITS Globals Object (GO)=These commands and functions were coded by Opa of PernMUSH.