|
Samedi Newbie
Joined: 02 Dec 2005 Posts: 2
|
Posted: Sat Dec 03, 2005 12:49 am
Capturing a room name--multiple colors in one line |
OK, I've combed the fora for help, but haven't been able to solve this issue.
Playing Lusternia, and trying to use #TAG to capture the room name for the automapper. I've managed to work out triggers to capture based on the color of the line, but have run into trouble with room names containing multiple colors. An example (room name with codes):
%e[33mOn a flowered section of upper Whelk. %e[37m(road).
Using the following trigger:
#TRIGGER {^%e[33m(*)}{#TAG name %1}
Returns the following room name:
On a flowered section of upper Whelk. [37m~(road~). [0m
I've tinkered with this a bit and managed to make it drop [0m from the end, but the rest remains. How can I remove the ANSI codes from the room name? I've tried revising the output using %stripansi:
{#TAG name %stripansi(%1)}
which returns:
%stripansi(On a flowered section of upper Whelk. [37m~(road~). [0m)
Thanks very much for any help!
-Samedi |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Dec 03, 2005 3:42 am |
From the #TAG helpfile
Quote: |
Normally, these parameters are not evaluated or expanded since they represent literal text from the MUD. However, if an argument is a single variable reference, then the variable will be expanded. |
Cple things you can try
Code: |
*untested* Try without the refrence
#TRIGGER {^%e[33m(*)%e[*} {#TAG name}
*untested* This one should just capture the first part and not the (road) part unless you want the road part :P
#TRIGGER {^%e[33m(*)%e[*} {#TAG name %1}
*untested* This one should keep everything
#TRIGGER {^%e[33m(*)} {#NOOP}
#COND {(*)} {#TAG name %1} {reparse}
*untested* Lastly try use a variable
#TRIGGER {^%e[33m(*)} {
Rname="%1"
Rname=%stripansi(@Rname)
#TAG name @Rname
} |
Food for thought. You can parse out the Rname (Rtype) to automagicly set %roomcol and other mapper related functions depending on Rtype |
|
|
|
bushd Newbie
Joined: 15 Nov 2005 Posts: 8
|
Posted: Mon Dec 05, 2005 6:14 pm |
If EVERY room ends in a period to be more precise add that into the trigger and then add it back into the variable hardcoded.
|
|
|
|
Samedi Newbie
Joined: 02 Dec 2005 Posts: 2
|
Posted: Mon Dec 05, 2005 10:27 pm |
Variable technique seems to have done the trick. Many thanks!
|
|
|
|
|
|