Cmud prompt trigger

by Forren

Back to Mechanic's Corner.

Forren2007-04-26 06:14:18
So, here's what I made:

Pattern:

^(¤tHealth)h, (¤tMana)m, (¤tEgo)e, (¤tPower)p, (¤tEndurance)en, (¤tWillpower)w ($promptCharacters:%w)-$

Some curious issues with this pattern. #SHOW $promptCharacters shows what is currently in ¤tPower. I isolated them by using traditional %1, %2 characters, and it turns out that each of these seems to have created two %xs - %1 and %2 both refer to the number in ¤tHealth, %3 and %4 refer to the number in ¤tMana, etc. %7 should be what $promptCharacters is. Instead, $promptCharacters is %13!

Is Cmud still this buggy, or am I doing something wrong?
Unknown2007-04-26 11:11:43
It's quite likely that CMUD has a bug relating to capturing variables in your pattern, though I think Zugg said he fixed that one a long time ago. Your (¤tHealth) doesn't specify a wildcard type. You should add the %d to it.

I use regex and don't use variable names right in the pattern (because I made this trigger prior to Zugg's fix).

CODE
#REGEX {^(\\d+)h\\, (\\d+)m\\, (\\d+)e\\, (\\d+)p\\, \\d+en\\, \\d+w (.*?)\\-} {
#RAISE OnPrompt %1 %2 %3 %4 %5
} "" {nocr|prompt}