Global Connection Watch
The +watch system allows people to create 'watch' lists, basically lists of friends and the like. This has two uses: 1: Your 'personal' wholist. 2: Monitoring connects/disconnects from your friends. The watch system also allows for a setting to monitor all connects, or to hide from having people see you connect.
Functions:
default(),
extract(),
filter(),
first(),
get(),
grab(),
hasattrval(),
hasflag(),
hastype(),
hidden(),
idle(),
if(),
ifelse(),
iter(),
itext(),
left(),
ljust(),
locate(),
lwho(),
match(),
mwho(),
name(),
not(),
num(),
or(),
orflags(),
rest(),
set(),
setdiff(),
setinter(),
setq(),
setr(),
setunion(),
space(),
time(),
timestring(),
u(),
words().
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for Global Connection Watch
@@ [------------------------- Global Connection Watch --------------------------]
@@
@@ The +watch system allows people to create 'watch' lists, basically lists of
@@ friends and the like. This has two uses: 1: Your 'personal' wholist. 2:
@@ Monitoring connects/disconnects from your friends. The watch system also
@@ allows for a setting to monitor all connects, or to hide from having people
@@ see you connect. A list of commands follows:
@@
@@ +watch: Shows your entire watch list and last time on.
@@ +watch/here: Shows those on your list that are online.
@@ +watch/add <player>: Adds a player to the list.
@@ +watch/rem <player>: Removes a player (or stray non player object).
@@ +watch/clean: Removes all non player objects from your list.
@@ +watch/hide: Toggles hiding from being seen (dis)connect.
@@ +watch/all: Toggles watching all (non hidden) connects.
@@
@@ Also, if set, your &watchfmt is triggered instead of the usual message.
@@ Example: &watchfmt me=think Watch: [name(%0)] has %1 at %2 M*U*S*H time.
@@
@@ [----------------------------------------------------------------------------]
@create Model Connection Watch
@lock/Basic Model Connection Watch==me
@lset Model Connection Watch/Basic=no_inherit
@set Model Connection Watch = WIZARD
@set Model Connection Watch = !NO_COMMAND
@ACONNECT Model Connection Watch=@break or(first(get(%#/watchopts),:),hidden(%#),setq(0,time()));@dol filter(fil_sees,setunion(lwho(),))=@trigger ifelse(hasattrval(##,watchfmt),##,me)/watchfmt=%#,connected,%q0,##
@set Model Connection Watch/ACONNECT=no_command prefixmatch
@ADISCONNECT Model Connection Watch=@break or(first(get(%#/watchopts),:),hasflag(%#,DARK),setq(0,time()));@dol filter(fil_sees,setunion(lwho(),))=@trigger ifelse(hasattrval(##,watchfmt),##,me)/watchfmt=%#,disconnected,%q0,##
@set Model Connection Watch/ADISCONNECT=no_command prefixmatch
&CMD_WATCH Model Connection Watch=$+watch:@pemit %#=%r%b[ljust(Name:,25)]Last on:%r[iter(rest(get(%#/watchopts),=),%b[ljust(left(name(itext(0)),20) \([itext(0)]\),25)][default(itext(0)/lastconnect,Is this a player?)],,%r)]%r%r%bTotal: [words(rest(get(%#/watchopts),=))] entries to your watchlist.%r
&CMD_WATCH_ADD Model Connection Watch=$+watch/add *:@pemit %#=[u(fun_watchsetup,%#)][ifelse(setr(0,locate(%#,*%0,apPX)),Watch: Added [name(%q0)] to your list.,Watch: No such player.)];@break not(%q0);&watchopts %#=[first(get(%#/watchopts),=)]=[setunion(rest(get(%#/watchopts),=),%q0)]
&CMD_WATCH_ALL Model Connection Watch=$+watch/all:@pemit %#=[u(fun_watchsetup,%#)][ifelse(first(rest(get(%#/watchopts),:),=),Watch: No longer watching everyone.[set(%#,watchopts:[first(get(%#/watchopts),:)]:0=[rest(get(%#/watchopts),=)])],Watch: Now watching all (dis)connects.[set(%#,watchopts:[first(get(%#/watchopts),:)]:1=[rest(get(%#/watchopts),=)])])]
&CMD_WATCH_CLEAN Model Connection Watch=$+watch/clean:@pemit %#=Watch: Purging non player objects from your list.;&watchopts %#=[first(get(%#/watchopts),=)]=[filter(fil_player,rest(get(%#/watchopts),=))]
&CMD_WATCH_HELP Model Connection Watch=$+watch/help:@pemit %#=\[------------------------- Global Connection Watch --------------------------\]%r%r The +watch system allows people to create 'watch' lists\, basically lists of%r friends and the like. This has two uses: 1: Your 'personal' wholist. 2:%r Monitoring connects/disconnects from your friends. The watch system also%r allows for a setting to monitor all connects\, or to hide from having people%r see you connect. A list of commands follows:%r%r +watch:[space(15)]Shows your entire watch list and last time on.%r +watch/here:[space(10)]Shows those on your list that are online.%r +watch/add <player>:%b%bAdds a player to the list.%r +watch/rem <player>:%b%bRemoves a player \(or stray non player object\).%r +watch/clean:[space(9)]Removes all non player objects from your list.%r +watch/hide:[space(10)]Toggles hiding from being seen \(dis\)connect.%r +watch/all:[space(11)]Toggles watching all \(non hidden\) connects.%r%r Also\, if set\, your &watchfmt is triggered instead of the usual message.%r Example: &watchfmt me=think Watch: \[name\(\%0\)\] has \%1 at \%2 M*U*S*H time.%r%r\[----------------------------------------------------------------------------\]
&CMD_WATCH_HERE Model Connection Watch=$+watch/here:@pemit %#=[setq(0,setinter(rest(get(%#/watchopts),=),ifelse(orflags(%#,Wr),lwho(),mwho())))][ifelse(%q0,%r%b[ljust(Name:,25)]Idle:%r%r[iter(%q0,%b[ljust(left(name(itext(0)),20) \([itext(0)]\),25)][extract(timestring(idle(itext(0))),1,2)],,%r)]%r%r%bTotal: [words(%q0)] on from your watchlist.,%r%bNo one on your watch list is online.%r)]
&CMD_WATCH_HIDE Model Connection Watch=$+watch/hide:@pemit %#=[u(fun_watchsetup,%#)][ifelse(first(get(%#/watchopts),:),Watch: No longer hiding.[set(%#,watchopts:0:[rest(get(%#/watchopts),:)])],Watch: Now hiding your (dis)connects.[set(%#,watchopts:1:[rest(get(%#/watchopts),:)])])]
&CMD_WATCH_REM Model Connection Watch=$+watch/rem *:@pemit %#=[u(fun_watchsetup,%#)][ifelse(setr(0,grab(rest(get(%#/watchopts),=),ifelse(num(*%0),num(*%0),num(%0)))),Watch: Removed [name(%q0)] from your list.,Watch: Not on your list.)];@break not(%q0);&watchopts %#=[first(get(%#/watchopts),=)]=[setdiff(rest(get(%#/watchopts),=),%q0)]
&DESCRIBE Model Connection Watch=Connection watch global.
@set Model Connection Watch/DESCRIBE=no_command visual public nearby
&FIL_PLAYER Model Connection Watch=hastype(%0,PLAYER)
&FIL_SEES Model Connection Watch=not(u(fun_wontsee,%0,%#))
&FUN_WATCHSETUP Model Connection Watch=if(hasattrval(%0,watchopts),,set(%0,watchopts:0:0=))
&FUN_WONTSEE Model Connection Watch=not(or(first(rest(get(%0/watchopts),:),=),match(rest(get(%0,watchopts),=),%1)))
&STARTUP Model Connection Watch=@attrib/access watchopts=no_command no_inherit no_clone mortal_dark wizard
@set Model Connection Watch/STARTUP=no_command prefixmatch
&WATCHFMT Model Connection Watch=@pemit/silent %3=Watch: [name(%0)] has %1 at %2 M*U*S*H time.
+watch/help
think Place the Model Connection Watch in your Master Room.