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
JMinara
Beginner


Joined: 05 Jul 2005
Posts: 14

PostPosted: Mon Oct 23, 2006 9:01 am   

Patternmatching text with whitespaces and alphanumeric
 
Hi all,
I'm trying to write a substitution and I want to catch a variable length string so I can format it.

Here's the untouched code:
Quote:
see<pushBold/> a town guard<popBold/>, a public listings board, the town green pond, and<pushBold/> a scrawny newsboy<popBold/>.


My goal is to color the stuff between the pushBold and popBolds yellow.
I'd like to do something like

Code:
~<pushBold/~>(*)~<popBold/~>{.|,}


but that ends up turning everything between the first pushbold and the last popbold yellow.

What should I do? Can't figure this thing out and I've been banging my head against it a while.
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Oct 23, 2006 9:40 am   
 
there is always going to be a pushBold and a popBold, so I'd probably just focus on those.

#trigger {~<({push|pop}Bold/)~>} {#if (%1 = "push") {#psub "color mxp-color-value" %x1)} {#psub "/color" %x1)}}

That SHOULD convert the tags from XML to recognizeable MXP which should then of course be processed as MXP, but might be happening too late in the process to actually work. If that's the case, you'll probably have to go with #MXPTRIG instead and defining the pushBold and popBold tags.

The idea is that instead of trying to pick out the content that these tags are working on, you just replace them with something ZMud already knows how to handle.
_________________
EDIT: I didn't like my old signature
Reply with quote
JMinara
Beginner


Joined: 05 Jul 2005
Posts: 14

PostPosted: Mon Oct 23, 2006 3:24 pm   
 
MattLofton wrote:
there is always going to be a pushBold and a popBold, so I'd probably just focus on those.

#trigger {~<({push|pop}Bold/)~>} {#if (%1 = "push") {#psub "color mxp-color-value" %x1)} {#psub "/color" %x1)}}

That SHOULD convert the tags from XML to recognizeable MXP which should then of course be processed as MXP, but might be happening too late in the process to actually work. If that's the case, you'll probably have to go with #MXPTRIG instead and defining the pushBold and popBold tags.

The idea is that instead of trying to pick out the content that these tags are working on, you just replace them with something ZMud already knows how to handle.


The trigger will work but for some reason it's only firing once in any given line.. Can't figure out why. The second part doesn't even evaluate
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