Garthorn's View Object

A view system that supports an AVIEW attribute.

Author: Garthorn
Category: Globals
Compatibility: CobraMUSH, PennMUSH.

Instructions

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

MUSHCode for Garthorn's View Object

@create View Object 2.01
@lock/Basic View Object 2.01==me
@lset View Object 2.01/Basic=no_inherit
@set View Object 2.01 = WIZARD
@set View Object 2.01 = !NO_COMMAND
&CHECK.ALL View Object 2.01=[squish(iter(lattr(%0), switch(##, VIEW_*, after(##, VIEW_), )))]
&CHECK.HASVIEW View Object 2.01=[match(u(check.universal, %0, %1), edit(%2, %b, ~)*)]
&CHECK.VIEWABLE View Object 2.01=[switch(u(%0/viewable, %1), , squish(iter(lattr(%0), switch(##, VIEW_*, after(##, VIEW_), ))), u(%0/viewable, %1))]
&DESCRIBE View Object 2.01=Garthorn's View Object, 2nd revision. Incorporates Aview. +help to be written soon.
@set View Object 2.01/DESCRIBE=no_command visual public nearby
&VIEW.BASE View Object 2.01=$view: @pemit %#=[switch(setr(0, u(check.viewable, %l, %#)), , {You look about [name(%l)], finding nothing interesting to look at.}, {You look about [name(%l)], finding the following to view: [iter(%q0, %r[edit(capstr(lcstr(##)), ~, %b)])]})]
&VIEW.OBJECT View Object 2.01=$view *: @select after(%0, 's)= , {@switch setr(2, locate(%#, %0, nhmi)) = #-1, {@verb %l = %#, [switch(capstr(lcstr(setr(0, extract(setr(1, u(check.all, %l, %#)), match(%q1, edit(%0, %b, ~)*), 1)))), , , pemit(%#, You peer at the [edit(capstr(lcstr(%q0)), ~, %b)]:))]view_%q0, {You peer about [name(%l)], failing to find any '%0'.}, oview_%q0, , aview_%q0}, #-2, {@pemit %#=Please be more specific about what you're trying to view.}, {@pemit %#=You peer at [name(%q2)] [switch(u(check.viewable, %q2, %#), , {finding nothing of interest.}, {and see the following: [iter(u(check.viewable, %q2, %#), %r[capstr(lcstr(edit(##, ~, %b)))])]})] }}, {@switch setr(3, locate(%#, before(%0, 's), nhmi))= #-1, {@pemit %#=There is no '[before(%0, 's)]' to view.}, #-2, {@pemit %#=Please be more specific what you want to view.}, {@verb %q3= %#, [switch(setr(4, extract(setr(5, u(check.all, %q3, %#)), match(%q5, edit(after(%0, 's%b), %b, ~)*), 1)), , , pemit(%#, You peer at [name(%q3)]'s [capstr(lcstr(edit(%q4, ~, %b)))]:))]view_%q4, {You peer at [name(%q3)], but don't see any '[after(%0, 's%b)]'.}, oview_%q4, , aview_%q4}}

think Place this object in your master room.
think Commands: view, view <target>
think To add a view to a room, add an attribute named 'VIEW_<name>'.
think You may also set 'OVIEW_<name>' and 'AVIEW_<name>' attributes.