Elf programming example #3 |
Task: | completely restructure the appearance of a message received from the mud. Custom colors and (optionally) phrase design are used. You can even use such triggers to nationalise the messages (for example: an italian mud could appear as an english one). |
This task is very easy, yet powerful, for ELF.
We simply need a trigger to recognise the
message we want to remap/highlight.
In this case the trigger will be
[*] tells you
'*'
We also need to set the flags check complete lines, remove original line and last trigger to check if activated to avoid testing an incomplete line, to completely override default line printing and to stop trigger checking (since this is the only action we want to do with such a line).
Please note that this trigger can be used
with the strip PROMPT and fully paint it
example in order to have a cleaner and clearer output from the mud.
All you need to do is placing this trigger
after the one that strips the prompt and before the one that writes the
rest of the line.
By writing other such triggers you may
completely redefine the appearance of what you receive from the mud, both
as to sequence of characters used and to colors.
There are several advantages in doing
so:
The functions starting with @FG set the foreground color according to what comes next. @ParmS returns a string containing one of the variable parts in the trigger definition. For example: @ParmS(2a) returns all (the a between the parenthesis) the second paramenter as a string.
Thus, this trigger outputs what Elfred tells you, writing in yellow everything but the name of Elfred itself that is shown in green.
Here is the necessary
programming for this task:
trigger Highlight TELLS YOU | |
trigger | [*] tells you '*' |
flags | check complete lines, remove original line, last trigger to check if activated |
commands | @OutStr @FGYellow+"["+@FGGreen+@ParmS(1a)+@FGYellow+"] tells you '"+@ParmS(2a)+"'" |
These
pages were developed with Netscape Composer
4.03 by Alfredo Milani-Comparetti
Last modified on 8 nov 1997 |