Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Samedi
Newbie


Joined: 02 Dec 2005
Posts: 2

PostPosted: 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
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
bushd
Newbie


Joined: 15 Nov 2005
Posts: 8

PostPosted: 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.
Reply with quote
Samedi
Newbie


Joined: 02 Dec 2005
Posts: 2

PostPosted: Mon Dec 05, 2005 10:27 pm   
 
Variable technique seems to have done the trick. Many thanks!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net