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
acusick007
Newbie


Joined: 09 Jan 2009
Posts: 5

PostPosted: Sat Jun 18, 2011 3:24 pm   

[3.34] Trigger Help
 
Hi, I am having trouble getting a trigger setup. The line I would like to capture is as follows.
Code:
PROT: ON BARK: ON VEST: ON GXP%: [30.440%] CL: [*89.12%]

My current trigger loosk like this.
Code:
PROT: (%w) BARK: (%w) VEST: (%w) GXP~%: ~[&%f{gxp}~%~]

As you can see the CL: and everything that follows is not captured. There are 2 states to the CL: part.
First is:
Code:
CL: [*<floating>%]

and
Code:
C: [<floating>%]


Is there a way to use one trigger to capture both states and keep a record as to weather or not the * is present?

Thank you for the help.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4772
Location: Pensacola, FL, USA

PostPosted: Sat Jun 18, 2011 9:58 pm   
 
there is no %f
use %d.%d
though since you are naming the variable in the pattern you may need to use *

Code:
PROT: (%w) BARK: (%w) VEST: (%w) GXP~%: ~[({~*|})&[%d.]{gxp}~%~]


#IF (%4="*") {blah}
_________________
Discord: Shalimarwildcat
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Jun 21, 2011 11:18 pm   
 
Sure there's a %f, it matches floating point numbers.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4772
Location: Pensacola, FL, USA

PostPosted: Wed Jun 22, 2011 2:50 am   
 
you would think... but no

http://forums.zuggsoft.com/modules/mx_kb/kb.php?mode=doc&page=3&refpage=3&a=cmud_Pattern_Match

those are what is available
_________________
Discord: Shalimarwildcat
Reply with quote
Fizgar
Magician


Joined: 07 Feb 2002
Posts: 333
Location: Central Virginia

PostPosted: Wed Jun 22, 2011 4:53 pm   
 
There is indeed a %f it might not be documented but it's there and works. Remember documentation isn't always up to date.

Assuming that both the GXP and CL percentages show in the prompt every time, the pattern in the trigger below should work. It's a regex but that will allow the trigger to match whether the * is present before the CL percentage or not. The GXP variable is populated just as your original trigger was trying to do, %5 will contain the * if it's present and %6 will be the actual value of CL. All parameters are printed out for debugging purposes so you don't have to refer back to this post when testing it out. Hope this helps.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="290" regex="true" copy="yes">
    <pattern>PROT: (\a+) BARK: (\a+) VEST: (\a+) GXP\%: \[(?gxp:[+-]?[0-9,]*\.?[0-9]*)\%\] CL: \[(\*)?([+-]?[0-9,]*\.?[0-9]*)\%\]</pattern>
    <value>#print ~%1 = %1
#print ~%2 = %2
#print ~%3 = %3
#print ~%4 = %4
#print ~%5 = %5
#print ~%6 = %6</value>
  </trigger>
</cmud>
_________________
Windows Vista Home Premium SP2 32-bit
AMD Athlon Dual Core 4400+ 2.31 GHz
3 GB RAM
CMUD 3.34
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