Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: 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
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Wed Nov 14, 2012 6:25 am   
 
try !%null(%line) or %len(%line)=0
_________________
Discord: Shalimarwildcat
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: 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.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4692
Location: Pensacola, FL, USA

PostPosted: Wed Nov 14, 2012 6:57 am   
 
hmm... try just $ for the pattern
_________________
Discord: Shalimarwildcat
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: 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"
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Scirkhan
Apprentice


Joined: 14 Sep 2007
Posts: 167
Location: aztx

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net