 |
Aarlot Adept

Joined: 30 Dec 2003 Posts: 226
|
Posted: Tue May 31, 2005 6:28 am
* not matching lack of space/characters |
According to the help files:
* match any number (even none) of characters or white space
Yet for some reason this won't match a blank line when used in this trigger:
#TRIGGER "testtrig" {Ok.$} {}
#CONDITION {^*$} {} {within|param=1}
#CONDITION {^$} {
#SAY Weave Sucessful
#STATE testtrig 0
} {reparse}
#CONDITION {Your weave begins to warp and crumbles!$} {
#SAY Weave failed!
#STATE testtrig 0
} {reparse}
#CONDITION {^*$} {#SAY Weave Sucessful} {reparse}
I'm using this to test out something for a script I"m writing, but while it works just fine for the failing message, for some reason the first #COND is not matching a blank line directly after the "Ok."
Basically, what I want to do is match the next line after the "Ok.", no matter what it is, and then do my reparse tests. Unfortunately, this above does not seem to want to match a blank line, which I need for some things. Any way to get it to match a blank line AND a line with text in it? And perhaps some explanation why "*" isn't working as the help file suggests it should? Thanks in advance. |
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
 |
DeReP Adept
Joined: 14 Jun 2003 Posts: 222 Location: Chile
|
Posted: Wed Jun 01, 2005 8:43 pm |
My guess is that since theres nothing in the line, no numbers, space or alpha characters, * shouldnt match anything.
Tried:
#CONDITION {*$} {} {within|param=1}
? |
|
|
|
 |
Aarlot Adept

Joined: 30 Dec 2003 Posts: 226
|
Posted: Wed Jun 01, 2005 9:25 pm |
Yeah, I tried that already. It seems like the "^*$" Should trigger the same as "^$", but I guess not. Working on a different way to do it using a couple triggers for now, until/unless someone can think of a way to do make it work.
|
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Jun 02, 2005 12:04 am |
Something like this?
^(*)$
#IF (!%null("%1")) {#SAY not blank} {Blank} |
|
|
|
 |
Aarlot Adept

Joined: 30 Dec 2003 Posts: 226
|
Posted: Thu Jun 02, 2005 9:28 pm |
The problem with it is, a null value is not setting off the trigger, so that #IF would never get evaluated.
|
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Thu Jun 02, 2005 10:04 pm |
This has always been the case. That is why the help didn't state that * matches 0 characters for the longest time. I can't even recall if it states it now. I think this is particualr to some optimization Zugg did, so try changing that state to a regex and see if that bypasses it.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri Jun 03, 2005 4:17 am |
* matches 0 chars but if I remember correctly it doesnt work like it is supposed to in this type of trigger
#TR {^*$}
which again if I remember correctly is why if I need to check a line that COULD be blank I use the %null check or something like that,
Dont forget you also have the %pos function. From your example it looks like this would work as a rewrite instead of using many reparse triggers)
#TRIGGER "testtrig" {Ok.$} {}
#CONDITION {^(*)$} {
#IF (!%pos("Your weave begins to warp and crumbles!", "%1")) {#SAY Weave Sucessful} {#SAY Weave failed}
} {within|param=1}
And lastly
| Quote: |
| Any way to get it to match a blank line AND a line with text in it? |
^(*)$
#IF (%null("%1") or !%null("%1")) |
|
|
|
 |
Aarlot Adept

Joined: 30 Dec 2003 Posts: 226
|
Posted: Fri Jun 03, 2005 4:52 am |
Tried that, Nexala, and it's still not working. It'll trigger on failure messages and on actual sucess messages, but some weaves you only know are sucessful because you got a blank line, and that trigger still won't recognize that :P
This below is using your trigger rewrite of my trigger (testtrig):
Ok.
You drain a tortured spirit of some of its essence! [19]
Weave Sucessful
You feel infused as you drain the essence from your victim!
<576H 525M 252V 1X 79%D 00:48:31 70S 252E>
<576H 533M 252V 1X 00:48:38 70S 252E>
weave 'heal critical' jes
Ok.
<576H 492M 252V 1X 00:48:42 70S 252E> |
|
_________________ Everyone is entitled to their beliefs - until they die. Then only the truth matters. |
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: Fri Jun 03, 2005 9:12 am |
You might as well just use LOOPLINES with a blank pattern to capture any line and then do all your parsing there. I think the reparse states are unnecessarily complex. You have exactly one failure message and everything else is counted as a success. It is much simpler to just do the comparison with an #IF.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sat Jun 04, 2005 2:29 am |
Ok I looked through my triggers and this is how I done it now that I remember :p //no pattern for the COND and use %trigger
#TRIGGER "testtrig" {Ok.$} {}
#CONDITION {} {
#IF (!%pos("Your weave begins to warp and crumbles!", %trigger)) {#SAY Weave Sucessful} {#SAY Weave failed}
} {within|param=1}
as for ^*$ not matchin If I am reading this Perl Regex refrence manual correctly it is because when internaly converted it becomes .* and supposedly ".*" means will capture everything except newlines 0 or more times |
|
|
|
 |
|
|
|