|
Scirkhan Apprentice
Joined: 14 Sep 2007 Posts: 167 Location: aztx
|
Posted: Wed Nov 14, 2012 4:17 am
Match [fire off of] any and all lines. Including blank lines. |
How? reparse? I'm trying to make a conditional trigger.
This is a cmud example:
Code: |
#trigger "tNameHighlight" {^The following players are near you:$} {}
#condition {(*)} {
#if (%1 != "") {
//this is not a blank line
#cw [b]color to highlight[/b]
} {
//this is a blank line
#state tNameHighlight 0
}
} {manual} |
http://forums.zuggsoft.com/forums/viewtopic.php?t=34848
Currently using another trigger (fires on blank) to reset the #state of this condition trigger. I had wanted to use loopexp %line!=%null, in short. |
|
Last edited by Scirkhan on Wed Nov 14, 2012 10:01 am; edited 3 times in total |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Wed Nov 14, 2012 6:25 am |
try !%null(%line) or %len(%line)=0
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
Scirkhan Apprentice
Joined: 14 Sep 2007 Posts: 167 Location: aztx
|
Posted: Wed Nov 14, 2012 6:55 am |
Hmm. I think I worded this wrong. My problem is I can't find a pattern that matches any and blank lines... at the same time.
Thanks for the suggestion. I will try those if I can get a pattern to fire. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: Wed Nov 14, 2012 6:57 am |
hmm... try just $ for the pattern
|
|
_________________ Discord: Shalimarwildcat |
|
|
|
Scirkhan Apprentice
Joined: 14 Sep 2007 Posts: 167 Location: aztx
|
Posted: Wed Nov 14, 2012 7:01 am |
$ fires only on blank lines (for me anyway). Also, IIRC, conditions have to use ^$ to fire off blank lines.
Code: |
#TRIGGER {$} {#echo .%line} "Test" |
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Nov 14, 2012 7:43 am |
The fundamental issue is that * translates into two different regex patterns, depending on how exactly you're using zscript *. I forget in which cases this occurs, but one case translates to 1 or more characters of any type while the other translates to 0 or more.
If we had an example, you potentially could have a solution that doesn't need to worry about the blank line or even of any prompt/non-blank line that comes after. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Scirkhan Apprentice
Joined: 14 Sep 2007 Posts: 167 Location: aztx
|
Posted: Wed Nov 14, 2012 8:18 am |
Anyway I can use the 0 or more characters wildcard?
Anyway..
Code: |
#CLASS {Skills}
#ALIAS help {#if (%-1 = "classes") {#state skills_cond 0;#t+ "skills_cond";~help %-1}}
#VAR skillsLine {}
#VAR class {}
#VAR classes {}
#TRIGGER "Skills_blankline" {$} {#STATE skills_cond 1;#t- "Skills_blankline"} "" {notrig|disable}
#TRIGGER "skills_cond" {^CLASSES$} {#var Skills/classes {}} "" {disable}
#COND {^({Warrior|Cleric|Mage|Druid|Thief})-$} {#var Skills/class {%1};#t+ "Skills_blankline";#state skills_cond 2} {disable}
#COND {^(%w)} {#var Skills/skillsLine {%replace( %replace( %line, ", ", |), ",", "")};#DELI Skills/skillsLine %null;#pri {#class Skills};#pri {#FORALL @Skills/skillsLine {#addkey classes {%i} {@class}}};#pri {#class 0}} {manual|disable}
#CLASS 0 |
Still working on other parts of it.
Quote: |
Thief-
Sneak, Pick, Hide, Spy, Backstab, Palm, Steal, Sweep, Parry, Spin, Evade
Mage-
|
How do you simply and concisely capture a 'block of text'?
And perhaps someone can explain to me why %crlf doesn't match a blank line? Thanks.
*Well, I've tried a bunch of regex stuff. Would be nice to match any line, tho not necessary. I'm keeping an eye on this thread. I personally think zmud cannot do it. |
|
|
|
|
|