Sketch's where

A 'where' global that groups together players in the same room.

Author: Sketch@M*U*S*H
Category: Globals
Commands: @create, @lock, @power, @set.
Features: #lambda.
Compatibility: PennMUSH.

Instructions

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

MUSHCode for Sketch's where

@create where2
@lock where2==me
@set where2 = !NO_COMMAND
@power where2 = See_All
&CMD_WHERE where2=$where:@pemit/silent %#=[benchmark([u(header)]%r[u(fn_do_display,%#)]%r[u(footer)],1,%#)
&DISPLAY where2=u(fn_strip_trailing_whitespace,map(#lambda/u(display_location,%0,\%0,elements(%1,matchall(%2,\%0))),unique(sort(%2,name)),%b,%r))
&DISPLAY_LOCATION where2=align(<32 [sub(width(%0),33)],left(%b[ansi(hb,name(%1))],32),table(iter(sort(%2,name),name(##),%b,|),15,sub(width(%0),33),|,%b))
&FN_DO_DISPLAY where2=u(display,%0,lwho(%0),u(fn_get_locations,%0,lwho(%0)))
&FN_GET_LOCATIONS where2=iter(%1,ifelse(findable(%0,##),loc(##),#-1))
&FN_STRIP_TRAILING_WHITESPACE where2=regeditall(%0,\\s+(%r|$),$1)
&FOOTER where2=repeat(-,78)
&HEADER where2=center(Player locations,78)%r[repeat(-,78)]
&ROW where2=ansi(hc,<>[ljust(ansi(g,%1),sub(36,ceil(fdiv(strlen(%0),2))),>)][ljust(ifelse(%0,ansi(g,%0),:),add(37,ceil(fdiv(strlen(%0),2))),<)]<>)

where