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
mrdark
Novice


Joined: 25 May 2003
Posts: 37

PostPosted: Sun May 25, 2003 9:56 pm   

how to fire a trigger more than once per line
 
Hi,

I wonder, if it's possible to let a trigger fire more than once per line.
I need to count all words in a line which begin with a capital.
eg. "This Is a Testline" would give 3 capitalized words.

But my trigger just fires once per line and I always get "1".
#TRIGGER {([A-Z][a-z])} {#ADD count 1} "" {case}
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sun May 25, 2003 10:05 pm   
 
No, you can't do it except for some very specific triggers, involving some very specific comamnds. You are going to have to match the entire line and then parse the line to count how many words begin with a capital letter.

Kjata
Reply with quote
mrdark
Novice


Joined: 25 May 2003
Posts: 37

PostPosted: Sun May 25, 2003 10:28 pm   
 
Thank you for your answer, Kjata

I understand .. how do I parse the line then?
I tried the "reparse" option but it fires also once a line only.

#TRIGGER {([A-Z][a-z])} {}
#COND {([A-Z][a-z])} {#ADD count 1} {reparse}

Any Idias?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon May 26, 2003 3:30 am   
 
quote:

Thank you for your answer, Kjata

I understand .. how do I parse the line then?
I tried the "reparse" option but it fires also once a line only.

#TRIGGER {([A-Z][a-z])} {}
#COND {([A-Z][a-z])} {#ADD count 1} {reparse}

Any Idias?



You don't need a multiple-state trigger for this. Just match the entire line and surround the entire thing in (). Then do something like this for the code:

#Forall %replace(%1," ","|") {#if (%i=%proper(%i)) {#add UpperCase 1} {#noop this is not a capitalized word}}

li'l shmoe of Dragon's Gate MUD
Reply with quote
mrdark
Novice


Joined: 25 May 2003
Posts: 37

PostPosted: Mon May 26, 2003 11:11 am   
 
that sounds like a possible solution, gonna try it that way

thank you, MattLofton!!
Reply with quote
mrdark
Novice


Joined: 25 May 2003
Posts: 37

PostPosted: Mon May 26, 2003 6:58 pm   
 
Another Question: this trigger works perfectly if, but it parses only the first line?
Zmud seems to throw lines away if they are coming to fast? right?

#TRIGGER {(*[A-Z][a-z]*)} {#FORALL %replace( %1, " ", "|") {#if (%i=%proper( %i)) { #ADDI SubList %i} {}}} "" {case|notrig}
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue May 27, 2003 12:18 pm   
 
This is already answered in the other thread you made about this just 30 minutes after posting this reply here, but use the #PRIORITY command.

Kjata
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