Capturing parry/wounds figures

by Unknown

Back to Mechanic's Corner.

Unknown2005-08-25 05:10:52
Making a script to capture parry/wounds to the appropriate variables.

Only trouble is, I seem to have hit a strange stumbling block.

For one thing - I'm having trouble with the difference between (100) and any other number less than 3 digits - because it changes the pattern matching with/without the space there.
I thought that: ~(*&%d{PHead}~) would work, as * should match no space as well... But no luck sad.gif

So I've created a simpler one that's just works on conditionals, within lines, which is basically just &%d{PHead or whatever other variable}
which works fine... except when I get to the arms/legs and there are two on the same line.
I thought that: &%d{PRarm}*&%d{PLarm} should capture both - but it won't get the second one, for some reason.

Any ideas, on either account? wacko.gif
Murphy2005-08-25 06:02:36
I wouldn't bother with parry, just do UNPARRY then change the parry to what you want.
Unknown2005-08-25 11:12:55
Use %s to match whitespace. Using * matches anything and everything, but not nothing. Regular expressions are easier to match, though, in my opinion.

For a regular expression, you would use something like \\(\\s*(?PHead:\\d+)\\) to capture your head. The \\s* matches 0 or more spaces.