MOO-cows Mailing List Archive
[Prev][Next][Index][Thread]
ANSI+
Well, the first thing I should probably explain is how ANSI+ will be
different from ANSI 2.1. Besides having a lot of new features and options,
the most noticable change will be that the ANSI tags will be different.
They will no longer just be one-word names that are divided into a few main
groups. The tags will now be in the format:
[xy:] or
[xy:argument]
Where XY is the two-letter abreviation of the tag and ARGUMENT is string
(usually just one letter). There will be three types of tags, each of which
will use their arguments differently:
1) built-in tags - These tags are the basis for ANSI+. They are hardcoded
into the ANSI+ code and should remain the same on every MOO that uses it.
Some of them require arguments, others do not. Any arguments specified are
used by each tag individually. So far, I have 5 built-in tags:
[NOTE: for these examples, I'm using [FC:red] which I won't get around to
describing until later, for now just remember that it changes the foreground
color to red.]
Comment (CT) - These tags are ignored when parsing the string, along with
any argument specified.
Quote (QT) - These tags are used to make sure something isn't parsed
by ANSI+. The argument specified will be surrounded by brackets and will
replace the quote tag. For example, if someone asked you how to change the
color to red, you could reply: [QT:FC:red] and ANSI+ would parse that into
the text "[FC:red]". Brack and I generally used [null] for this but that
tended to get very confusing and this way is much better.
Default (DF) - This tag will do the same thing that [normal] used to do;
it will change the color and background back to the default, turn off
underlining, etc. This tag takes no arguments.
Push (PH) - This tag stores the current ANSI state to the stack.
Push takes no arguments either.
Pop (PP) - This tag will remove the last state from the stack and
change everything to that state. For example, if you had the code:
return strsub(this.greet_msg, "%N", player.ansi_name);
it would usually work fine. But what if this.greet_msg was set to:
"Hello %N, how are you today?"
and player.ansi_name was set to:
"[FC:red]Dark_Owl"
In the string returned by the original verb, the "how are you today" part
would be red, not white like it was originally intended to be. We could
easily get around this by putting a [DF:] at the end of player.ansi_name,
but what if this.greet_msg also had ANSI tags, for example:
"[FC:blue]Hello %N, how are you today?"
To fix this problem, push and pop have been created. This way we can set
player.ansi_name to:
"[PH:][FC:red]Dark_Owl[PP:]"
and the color will automatically switch back to the color it was originally.
There are two arguments accepted by Pop: keep and all. Using the keep
argument, the current state is set to the last one in the stack, but the
stack remains the same (so you could keep popping the same state over and
over). The all argument pops the last argument from the stack and then
clears the rest of them. Push and Pop statements can be nested up to 9
levels deep.
2) State tags - These tags are used for on-off type ANSI operations such
as colors, underline, boldface, etc. If an argument is specified, the state
of that tag will be set to that argument, otherwise it will be set back to
the default. The state tags can be changed easily on each individual MOO,
but here are the ones that it will have to start with:
Foreground Color (FC) - Arguments are black, red, blue, green, cyan,
magenta, yellow, and white. When called without an argument it will change
the color back to the default (generally white).
Background Color (BC) - Same arguments as FC. When called without an
argument it will changed the color back to the default (generally black).
Underline (UL) - All terminal programs handle this tag
differently, some underline the text, some make it inverse, some make it
cyan, etc. The only argument is "Y" for yes, no if not specified.
Inverse (IN) - Reverses foreground and background color.
Arguments are the same as Underline.
Italics (IT) - ANSI Standout mode... I'm not sure exactly what
it is because none of my terminal programs support it. I'm including it
just in case. Arguments are the same as Underline.
Boldface (BF) - Arguments are "Y" for yes and "faint" to make
the text dim (again, my terminal programs don't support this so I'm not sure
what it looks like). No argument means regular intensity.
3) Non-state tags - Any tags which don't represent states. They can also
be changed easily on the individual MOOs. The only one I will probably be
including, though, is:
Beep (BP) - Sends a beep. Takes no arguments.
But I'm also planning on using these on NestMOO and other MOOs can use them
if they want:
Single-line Box (SB) - Box drawing characters. Arguments are:
TL - top-left corner
BL - bottom-left corner
TR - top-right corner
BR - bottom-right corner
HOR - horizontal line
VER - vertical line
Double-line Box (DB) - Same arguments as SB, but with double lines.
If these are turned on, they will send the correct ASCII characters (around
180-210 I think), otherwise they will send + for the corners, - for VER,
and | for HOR.
Well, anyway, that's all of the tags so far. Sorry it was so spammy and
complicated :) Of course there are a few problems with this, but I'll get
around to those later. Anyone have any other ideas for tags?
--Dark_Owl
Home |
Subject Index |
Thread Index