MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: Javascript/Java [Re: Interactive MOO]



Antonio Martos wrote:
> 
> Only to comment you what Ive just done.
> I made the following:
> 
> @create $thing named AnsiCodes
> @prop $AnsiCodes.escape "e"
> (it is a letter)
> 
> I called it $AnsiCodes
> then shutdown() and look for that "e" in the db file.
> I replaced it for ascii 27 (escape code)
> then restart again and programed verbs with things like:
> 
> notify(player,$AnsiCodes.escape+"[32m"+text);
> 
> and you get colored text if you use an ansi terminal.
> 
> So, it is posible to use, (not to enter?) , non-printable chars on
> lambda?
> Maybe all of you knew this, but I didnt.

It's even easier with version 1.8.0. This code segment will do the same thing:

set_connection_option (player,"binary",1)
notify (player,"~1B[32m"+text)
set_connection_option (player,"binary",0)

I've implemented an ANSI color/bold/flashing text system in my MOO (a LPMOO)
using LPMOO buffers, and am in the process of porting it to Lambda 1.8.0.
It modifies several verbs throughout the database, to include $player:notify,
:linesplit, and :@more, $string_utils:left, :columnize, :right, and
$code_utils:show_who_listing to properly display text with certain special
embedded color codes.  For example, the string "^RRed ^GGreen ^BBlue" will
be displayed to an ANSI terminal with each word colored appropriately.  It
can be turned on and off by the user, and has a special debug mode that
displays the embedded color symbols (^R, etc) instead of hiding them.

The effect of this is that these color codes can be embedded into nearly any
MOO text and will display nicely to anyone, whether they want ANSI or not.

The system also lends itself well to HTMLification.

I will make this system available to anyone who requests it, when I am done
porting it.  If you want to see it in action on a running LPMOO,

telnet://mserv1.wizvax.net:9999

Connect as a guest, type '@color on', then '@who'.  Most players colorize
their names.

http://mserv1.wizvax.net:9988

Follow the link that says "Click here to see @who" and notice how the colors
in the names of connected players are translated into HTML.

I realize someone alse also has an ANSI system out there...but I started
writing this one before I knew the other was available...and I like it.  :P


Follow-Ups: References:

Home | Subject Index | Thread Index