Trakis2006-04-30 05:36:08
I am trying to make a prompt capture using MUSHclient with Python scripting. I am taking the prompt and making a trigger that matches on this:
"(.*?)+h, (.*?)+m, (.*?)+e, (.*?)+p +\\-"
The line will match my prompt, but when I try to refer to the wildcards in my script, they come up empty (for example, %1 does not contain my hp).
I've tried the following variations for matching:
-"\\d+h, \\d+m, \\d+e, \\d+p +\\-"
-"+h, +m, +e, +p +\\-"
And the following variations for the script.
1. world.SetVariable("currenthp", %1)
2. world.SetVariable("currenthp, "%1")
3. world.SetVariable("currenthp", wildcards)
... and quite a few others.
However, none of these methods seem to work! I tried a few tests with simpler matching patterns, and I am unable to do anything with %1 at all.
Is it possible that my wildcards are matching, but not being saved? I know there are several ways to match the prompt using variations of regexp, but for all the combinations I've tried, something has been going wrong.
I've looked through almost every post on the Python scripting page for MUSH, read over some regexp stuff, and my head is swimming, since I've been looking at these screens of code examples for so long. Is there anyone who can ease my suffering and just tell me what I'm doing wrong? Heh.
"(.*?)+h, (.*?)+m, (.*?)+e, (.*?)+p +\\-"
The line will match my prompt, but when I try to refer to the wildcards in my script, they come up empty (for example, %1 does not contain my hp).
I've tried the following variations for matching:
-"\\d+h, \\d+m, \\d+e, \\d+p +\\-"
-"+h, +m, +e, +p +\\-"
And the following variations for the script.
1. world.SetVariable("currenthp", %1)
2. world.SetVariable("currenthp, "%1")
3. world.SetVariable("currenthp", wildcards)
... and quite a few others.
However, none of these methods seem to work! I tried a few tests with simpler matching patterns, and I am unable to do anything with %1 at all.
Is it possible that my wildcards are matching, but not being saved? I know there are several ways to match the prompt using variations of regexp, but for all the combinations I've tried, something has been going wrong.
I've looked through almost every post on the Python scripting page for MUSH, read over some regexp stuff, and my head is swimming, since I've been looking at these screens of code examples for so long. Is there anyone who can ease my suffering and just tell me what I'm doing wrong? Heh.
Trakis2006-04-30 06:48:14
Heh.. I took a break for a few hours, came back, and figured I'd try it with (), like (\\d)... Guess that worked.
I am so dum!
I am so dum!