silly regex!

by Simimi

Back to Mechanic's Corner.

Simimi2008-06-21 14:41:27
So I'm having a bit of a regex issue. This worked fine in previous version of MUSH but in one of the recent versions, Nick changed the way the multi-line trigger handler was implemented. I'm a bit frustrated with it. Anyone else care to have a lookit? From the autosipper plugin in my sig.

**ONE**
CODE
FIXED: THANK YOU GARTINUA!



**TWO**
CODE
FIXED: THANK YOU ZARQUAN!


**THREE**
While I have everyone here, is there a consensus on fighting in choke? Right now my system just stops in choke and tracks all of the affs and continues passing them into the aff handling function, but it stops checking curing queues and just tells me what is going on, like

if in choke then
aff trigger happens and passes to handling function and
Note("+STUPIDITY")
Note("--EAT BLAH)

I mean it isn't pretty but at least I can see what is happening... Ideas on other ways to handle choke? Theory is cool too.

Lastly, I was wondering how I might handle illusions? Right now every aff goes to IllusionCheck() before being sent to setaff() (CamalCase means it isn't finished yet). IllusionCheck puts it in a temporary table and waits for lines like seeing the illusion. I'm really not sure how else I can decide what is real and what isn't in an illusion fight.


Thanks for everything all. It is much appreciated.
Unknown2008-06-21 14:52:49
Don't know about the first one, but the second one is almost certainly not supposed to be (\\d+) as that only matches numbers. smile.gif
Simimi2008-06-21 15:45:18
OH MY censor.gif GOD ZARQUAN YOU ARE censor.gif censor.gif ing ME.

and thank you for the quick eye. I'm not sure how I missed that, honestly.
Simimi2008-06-22 02:50:26
Bump for more eyes? wub.gif
Gartinua2008-06-23 04:31:01
CODE
match="^.*?.*?\\n.+?\\n  Level  \\: (\\d+) \\((\\d+)\\%\\)\\s+Rank      \\: (.+?)\\n  Health \\: (\\d+)\\/(\\d+)\\s+Endurance \\: (\\d+)\\/(\\d+)\\n  Mana   \\: (\\d+)\\/(\\d+)\\s+Willpower \\: (\\d+)\\/(\\d+)\\n  Ego    \\: (\\d+)\\/(\\d+)\\s+Reserves  \\: (\\d+)\\%\\n  Karma  \\: (\\d+)\\%\\s+Esteem    : (\\d+)\\%$"

Help score says it looks like:
CODE
Chade d'Illici
  Sex    : Male          Race      : Igasho
  Level  : 69 (62%)      Rank      : Stellar
  Health : 3888/3888     Endurance : 10070/18340
  Mana   : 2439/2439     Willpower : 11095/11095
  Ego    : 3060/3060     Reserves  : 71%
  Karma  : 8%

I thought it was the % to next level, but its displayed as a integer in oldsc and float in the others. Your trigger is for oldscore not score or qsc. I use qsc myself and the variables found in mudbot.

It's not lua matching, that uses %d, it looks like PCRE.

^.*?.*?\\n looks a bit strange to me . means any character * means 0-many and ? means 0-1, next line is .+? which has a similar problem

What I do is make a simple expression and then build it out. So nuke everything including the ^ in front of Level

Or perhaps it should be
^\\S+\\s+\\S+\\n Sex\\s+: \\S+\\s+Race\\s+: \\S+\\n

If it is *real* PCRE then
^\\w.+\\n.+\\n Level(etc)

should work
Simimi2008-06-23 10:25:37
The odd was to catch people's names, when I intended to release my system. Now I do not see a reason to do so, so I have removed all of that.I have gotten it matching now though, off of an old trigger that was in an older version of the same plugin. For me, it matches oldscore as:
CODE
^.*?.*?\\n.+?\\n  Level  \\: (\\d+) \\((\\d+)\\%\\)\\s+Rank      \\: (.+?)\\n  Health \\: (\\d+)\\/(\\d+)\\s+Endurance \\: (\\d+)\\/(\\d+)\\n  Mana   \\: (\\d+)\\/(\\d+)\\s+Willpower \\: (\\d+)\\/(\\d+)\\n  Ego    \\: (\\d+)\\/(\\d+)\\s+Reserves  \\: (\\d+)\\%\\n  Karma  \\: (\\d+)\\%\\s+Esteem    : (\\d+)\\%$


I forget what it is but I believe PCRE. Thanks for the help as you solved a problem I didn't know I had on a different regex!