unfu~display

Submitted by sad hack on Sun, 2009-06-28 13:15

@@
@@ ========================================================================
@@ Display borders for unfu~
@@ ========================================================================
@@ ------------------------------------------------------------------------
@@ ________________________________________________________________________
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:
@@ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@


@set unfu~()=~`PACK`DISPLAY:[create(Display Functions,10)]
@link unfu~(DISPLAY)=unfu~()
@tel unfu~(DISPLAY)=unfu~()
@set unfu~(DISPLAY)=no_command
@@
@@ ------------------------------------------------------------------------
@power unfu~(DISPLAY)=many_attribs
@@
@@ ------------------------------------------------------------------------
&~ unfu~(DISPLAY)=
&CONTENT unfu~(DISPLAY)=
&CONTENT`UFUN unfu~(DISPLAY)=
@@
@@ ------------------------------------------------------------------------
@@ ________________________________________________________________________
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:
@@ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@

@@ H ____________________________________
@@ H(6))                                 )
@@ H ¯/  Head Text, one line only       /
@@ H (                                 (
@@ B  ) First line of body.             )   
@@ B (  Second line of body.
@@ B  ) Rest 
@@ B    of
@@ B    body.
@@ F                                     )
@@ F /__________________________________/_
@@ F((9) ¯   ¯¯¯¯¯        ¯¯¯¯¯¯¯¯¯¯¯¯¯                                  )
@@ F ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@ F                                   ( 
@@ F )____                            __)
@@ F((9)¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯)
@@ F ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@ 


@@ ------------------------------------------------------------------------
@@ ________________________________________________________________________
@@ .:....1....:....2....:....3....:....4....:....5....:....6....:....7....:
@@ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@describe unfu~(display)=u(~`describe)
&~`DESCRIBE unfu~(display)=u(CONTENT`UFUN`SCROLL1, CONTENT`UFUN`SCROLL1, , Display Functions%r[iter(lattrp(me/~`DESCRIBE`?), [u(%i0)], %b, %r)], y)
&~`DESCRIBE`0 unfu~(display)=[space(5)]This unfu~ content package contains user-defined functions available for use in the display of content. It only takes a few of these, combined with ancestor objects, and voil[chr(225)] ~ instant pretty stuff.
&~`DESCRIBE`1 unfu~(display)=[space(5)]The quick brown fox jumps over the lazy dog, only to discover that the sixth sick sheik's sixth sheep's sick. One, two, three, four, five, six, seven; all good children will go to heaven.
&~`DESCRIBE`2 unfu~(display)=[space(5)]Now is the time, and high time at that, for all you peeps to come to the Boston THC party. Dude, it only takes a couple tokes and voil[chr(225)] ~ instant appreciation for pretty stuff. Wow.%R
&~`DESCRIBE`3 unfu~(display)=Syntax: u\(\, , , \[\%r]\, \)
&~`DESCRIBE`4 unfu~(display)=Example: think u\([unfu~(DISPLAY)]/CONTENT`UFUN`SCROLL1\,CONTENT`UFUN`SCROLL1\,width\(\%#\)\, Foo\%rBar\%rBaz\%rBlah\, y\)
@@
@@ ------------------------------------------------------------------------
&CONTENT`UFUN`SCROLL1 unfu~(display)=u(%0`SETQ, %1, %2, %3)[u(%0`HEAD)][u(%0`BODY)][u(%0`FOOT)]
&CONTENT`UFUN`SCROLL1`SETQ unfu~(display)=[setq(y, dec(ifelse(isnum(%0), %0, width(%#))), h, switch(%1, */CONTENT`*, ifelse(hasattrpval(setr(u, localize(unfu~(first(%1, /)))), HEAD), ulocal(%qu/HEAD)[setq(b, after(%1,ulocal(%qu/HEAD)))], first(%1, %r)[setq(b, rest(%1, %r))]),first(%1,%r)[setq(b, rest(%1,%r))]), a, %2, l, ansi(%2, \(), r, ansi(%2, \)), s, ansi(%2h,\)), t, ansi(%2, /))]
&CONTENT`UFUN`SCROLL1`HEAD unfu~(display)=%b[ansi(%qah, repeat(_, sub(%qy, 2)))]%r[ansi(%qa, \(6)]%qs%qs[space(sub(%qy,5))]%qs%r[align(3 -[sub(%qy,8)] 2,%b [ansi(%qa,/)]%r %ql%b, %qh,%b%qt%r%ql)]%r
&CONTENT`UFUN`SCROLL1`BODY unfu~(display)=align(3 [sub(%qy,8)] 2,%b %qr%r %ql%b%r%b %qr%r,%qb,%b%qr)
&CONTENT`UFUN`SCROLL1`FOOT unfu~(display)=%qr%r %qt[ansi(%qah,[repeat(_,sub(%qy,4))])]%qt%r[ansi(%qa,\(6)]%qs[ansi(%qa,repeat(_,sub(%qy,4)))]%qs
@@
@@ ------------------------------------------------------------------------
@@ NOTES: unfu~() always returns the pack/full`attr`path of a successful
@@ match (i.e., a non-error result) followed by a %r, followed by the
@@ returned output. To remove these from a display, use:
@@
@@ rest(unfu~(blah, blah, blah),%r)
@@
@@ Additionally, the display pack has no HEAD attribute and will assume
@@ that the first %r-delimited item goes in the scroll heading. So, if the
@@ content being displayed does not include this already, you can place it
@@ manually, as in:
@@
@@ unfu~(display, scroll1, width(%#), this heading%r<this content>)
@@
@@ And putting this together, you can package an unfu~() return into a
@@ display the following ways (referencing the aforementioned tweaks):
@@
@@ by default, an unfu~() return will result in it's obj/attr`path being
@@ the header (obj/attr`path is the first %r-delimited item). If this is
@@ not desired, do something along one of the following lines...
@@
@@ if the unfu~() return has an appropriate %r-delimited header after the
@@ obj/attr`path, do:
@@
@@ unfu~(display, scroll1, <width>, rest(unfu~(blah),%r))
@@
@@ if the output doesn't have such a header, do:
@@
@@ unfu~(display, scroll1, <width>, this header%r[rest(unfu~(blah),%r)])
@@
@@ Last, but not least (or, maybe least?), scroll1 accepts an ansi color
@@ input as it's 5th parameter:
@@
@@ unfu~(display, scroll1, <width>, <header%rcontent>, <ansi>)
@@
@@ ... which it will hilite for the "depth/reflection" effect on the
@@ leading edge of the "scroll" graphic.
@@
@@ ------------------------------------------------------------------------
@@ ========================================================================
@@ Examples (you should cut these out before quoting this script):
@@ ------------------------------------------------------------------------
@@ formatting a room display
@@
@descformat here=rest(unfu~(display,scroll1,width(%#),name(me)%r%0,y),%r)
@@
@conformat here=align(setr(w, dec(div(width(%#),2))) %qw, rest(unfu~(display, scroll1, dec(%qw), Players%r[map(#lambda/name(\%0)%r, lvplayers(me))], y), %r), rest(unfu~(display, scroll1, dec(%qw), Things%r[map(#lambda/name(\%0)%r, lvthings(me))], y), %r))
@@
@exitformat here=rest(unfu~(display, scroll1, width(%#), Exits%r[map(#lambda/align(setr(w, div(sub(width(%#), 10), 2)) 8 %qw, name(\%0), leads to, name(loc(\%0)))%r, %0)], y), %r)
@@
@@ ------------------------------------------------------------------------
@@ formatting help text (someone feel free to write this appropriately)
@@
@@ @command/disable help
@@ @hook/override help= blah
@@
@@ rest(unfu~(display, scroll1, <width>, %0%r[textfile(help, %0)], g),%r)
@@
@@ resulting in the help text being wrapped in a green scroll1 display.
@@
@@ ------------------------------------------------------------------------
@@ ========================================================================
@@ Below are some display concepts "in the works".
@@ ------------------------------------------------------------------------
@@

@@ Speech bubble
@@  ________
@@ ( Trispis says,
@@  )   __________)
@@     ( Text .... here )
@@                 ¯¯¯¯¯
@@
@@ Thought Bubble
@@  ________
@@ ( Trispis thinks :
@@  )   ,~~~~~~~~~~~'
@@     { Text ---- here }
@@                 ~~~~'
@@
@@ Emote... ?
@@  ________
@@ ( Trispis  
@@  )¯¯| text here |
@@            ¯¯¯¯¯
@@
@@ Narration (IC) Emit bubble (bots, weather, ambience)?
@@  _
@@ ( Text
@@  )    here_)
@@            
@@
@@ System Emit?
@@ +-----
@@ | Text here. |
@@        ------+
@@
@@ Street signs and shingles.
@@
@@ o___________________________,
@@ | 9   ¿                   ¿ `
@@ |6    :                   :
@@ |    _?___________________?_
@@ |   | Text here             |
@@ |    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@
@@ o
@@ +-----+-------------------+--o
@@ | 9   ?                   ?
@@ |6    :                   :
@@ |    _¿___________________¿_
@@ |   | Text here             |
@@ |    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@@