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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
vortis
Novice


Joined: 15 Jul 2010
Posts: 39
Location: USA

PostPosted: Thu Jan 27, 2011 7:29 pm   

[3.33a] Capture some text within parenthesis for creating variables -RESOLVED
 
I hope this is fairly easy, I haven't figured out how to get this to work right:

MUD Output:
a burly bouncer (0.849)
a small bouncer (0.250)


I want to capture and instance of (x.xxx) and convert the last xxx to a variable that I can then run a number check against, and color the word depending on the variable.

Here's the flowplan I want to build:
Capture (%1.%2)
If %1 > 0 - End
If %2 > .001 {#CW 1}
If %2 > .250 {#CW 2}
If %2 > .500 {#CW 3}
If %2 > .750 {#CW 4}

Attempt 1: (%1.%2)
My issue is that it is trying to parse the parenthesis in the trigger pattern so anything that has a period in it is getting captured and I am constantly getting stuck in infinite loops.

Attempt 2: ?%1.%2?
This is capturing random stuff from the MUD

Attempt 3: (%1.%2) Verbatim
This is only looking for a line that completely matches the pattern and doesn't allow the %1 and %2 to be different

Is there an easier way to accomplish this?


Last edited by vortis on Thu Jan 27, 2011 9:37 pm; edited 1 time in total
Reply with quote
Myrkul
Wanderer


Joined: 21 Aug 2008
Posts: 85

PostPosted: Thu Jan 27, 2011 8:06 pm   
 
[edit][/edit]


Last edited by Myrkul on Thu Apr 14, 2011 11:11 pm; edited 1 time in total
Reply with quote
vortis
Novice


Joined: 15 Jul 2010
Posts: 39
Location: USA

PostPosted: Thu Jan 27, 2011 8:19 pm   
 
Thanks! I'll try it out tomorrow.
Reply with quote
vortis
Novice


Joined: 15 Jul 2010
Posts: 39
Location: USA

PostPosted: Thu Jan 27, 2011 8:37 pm   
 
Is this what you recommend then? It seems to be working.

PATTERN:
~((%d).(%d)~)

TRIGGER:
#IF (%1<1) {
#IF (%2<250) {#CW 10}
#IF (%2>249 and %2<500) {#CW 9}
#IF (%2>499 and %2<750) {#CW 14}
#IF (%2>749 and %2<1000) {#CW 12}
}

XML:
<trigger priority="3680" id="368">
<pattern>~((%d).(%d)~)</pattern>
<value><![CDATA[#IF (%1<1) {
#IF (%2<250) {#CW 10}
#IF (%2>249 and %2<500) {#CW 9}
#IF (%2>499 and %2<750) {#CW 14}
#IF (%2>749 and %2<1000) {#CW 12}
}]]></value>
</trigger>
Reply with quote
Myrkul
Wanderer


Joined: 21 Aug 2008
Posts: 85

PostPosted: Thu Jan 27, 2011 9:00 pm   
 
[edit][/edit]


Last edited by Myrkul on Thu Apr 14, 2011 11:11 pm; edited 1 time in total
Reply with quote
vortis
Novice


Joined: 15 Jul 2010
Posts: 39
Location: USA

PostPosted: Thu Jan 27, 2011 9:03 pm   
 
Well I built this script to be universal for any mob, so there is no static entry prior to the (x.xxx) and I am totally ok with it capturing any (x.x) number and coloring it. I don't think that will much of an issue.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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