 |
lubinski Newbie
Joined: 07 Feb 2008 Posts: 2
|
Posted: Thu Feb 07, 2008 9:10 pm
Text parsing |
How can i parse out the info in this string.
485h, 550m ex-
so that i can store the 485h as a health var and stick it in a status bar. What is the correct syntax to complete this? |
|
|
 |
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Thu Feb 07, 2008 9:22 pm |
Code: |
#trigger {(%d)h, (%d)m ex~-} {health=%1;mana=%2}
|
This trigger captures the health/mana amounts into variables, then you can put both variables on status bar.
I used the tilde ("~") just in case to escape the "-". Perhaps its not needed, so in case the trigger doesn't work, just remove it.
Prog |
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
 |
Leitia Adept

Joined: 04 May 2007 Posts: 292 Location: Boston
|
Posted: Thu Feb 07, 2008 11:54 pm |
ooooo looks like Achaea. ya know that string changes all about
this is true:
but those little letters are good too till you end up with something like Larkin's
Code: |
^(?Health:\d+)h\, (?Mana:\d+)m(?:\, (\d+)(e))?(?:\, (\d+)(w))? (?PromptFlags:[cexkdb@]*)(?: Vote)?\- |
that above is regex-cellent and included in ACP - the Achaean Curing Project
oh, too, there is a check box for prompts in the trigger, you might want that
I think the tilde is there because I pulled it out of the mapper, I have worked with this prompt a while and random do things like that |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Feb 08, 2008 10:29 am |
The tilde is there because the comma is punctuation and whoever wrote the pattern was a bit overzealous :P Same with all the quoted commas in your regex.
Were it me (since the prompt flags are always in the same order) I'd use
c?e?x?k?d?b?@?
instead. |
|
|
 |
|
|