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
Heph
Newbie


Joined: 26 Oct 2002
Posts: 9

PostPosted: Tue Feb 11, 2003 11:59 pm   

Multiple trigger beginnings with forced start/end
 
1000h, 1000m ex-
Such and such happens.
1000h, 1000m ex-
1000h, 1000m ex-Such and such happens.
1000h, 1000m ex-
-
-Such and such happens.
-
1000h, 1000m ex-

I need it to force the pattern to match starting at the beginning of the line (^) and the end of the line. ($) So far I'm able to setup triggers like this for "Such and such happens." by using multiple triggers:

^Such and such happens.$
^(%d)h, (%d)m (%w)-Such and such happens.$
^-Such and such happens.$

I've tried various combinations of {val1|val2} but I'm running into problems including (%d)'s inside of them and with the way {^string} is normaly intended to ignore a match. At best, I'd like a way to be able to paste some expression, that takes care of the above, into the start of each of my current triggers without having to setup 3 triggers or include "Such and such happens." more than once in the trigger line.

This is what I had expected to work: ^{|-|(%d)h, (%d)m (%w)-}Such and such happens.$

Thanks for your time, Heph
P.S. Version 6.51+
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Wed Feb 12, 2003 12:36 am   
 
The only time you need to anchor a trigger to the start and end of a line is if you are, worried about or have problems with, someone spoofing the trigger. If that is not the case then I would say only anchor at the end of line. If that is the case then you can use a trigger anchored at the end of line and put the following in the trigger:

#IF ((%begins(%trigger,"-")) or (%trigger=~"^%dh, %dm ex-")) {do nomral stuff} {emote pulls out his spoofer beating stick.}
Reply with quote
Heph
Newbie


Joined: 26 Oct 2002
Posts: 9

PostPosted: Wed Feb 12, 2003 12:43 am   
 
Vijilante:

Yes, I'm worried :)

I'll try what you suggested if nobody has another way. But on the scale of 100+ triggers, it is going to be a major headache to implement and will effect the readability. Thanks
Reply with quote
Heph
Newbie


Joined: 26 Oct 2002
Posts: 9

PostPosted: Wed Feb 12, 2003 8:02 am   
 
LightBulb: Have any ideas on this? *hope* :)
Reply with quote
quigbrew
Novice


Joined: 04 Jun 2002
Posts: 31

PostPosted: Wed Feb 12, 2003 8:51 am   
 
heh, I'm not sure if this helps or not but I was trying to do basically the same thing, and figured this out....If you inclose the options inside of brackets it only sets off the trigger if the beginning matches...so it'd look like this:
[^|^(%d)h, (%d)m (%w)-|^-]Such and such happens.

Worked for me, hopefully it'll work for you.
Reply with quote
Heph
Newbie


Joined: 26 Oct 2002
Posts: 9

PostPosted: Wed Feb 12, 2003 9:21 am   
 
I tried it and thought so too, but behaves the same as a trigger that is just: "Such and such happens."

[^|^(%d)h, (%d)m (%w)-|^-]Such and such happens.
->works with:
ANYTHINGxSuch and such happens.
[ ]'s denotes a range....

{^|^(%d)h, (%d)m (%w)-|^-}Such and such happens.
->Works with:
ANYTHINGxSuch and such happens.
->Does not work with:
Such and such happens.

{|^(%d)h, (%d)m (%w)-|^-}Such and such happens.
->Works with:
ANYTHINGxSuch and such happens.

^{|^(%d)h, (%d)m (%w)-|^-}Such and such happens.
->Works with:
Such and such happens.
->Does not work with:
-Such and such happens.
1000h, 1000m ex-Such and such happens.
Reply with quote
quigbrew
Novice


Joined: 04 Jun 2002
Posts: 31

PostPosted: Wed Feb 12, 2003 10:06 am   
 
Okay, I've been testing with every possible arrangement. I don't have anyway to test the third possibility, the dash. But so far it looks like I got the first two to work by leaving out the ^. I don't know why, but it's not tripping the trigger with says, or if anything other then the prompt or the fresh line is at the beginning of the trigger.
So it looks like this:
{|(%d)h, (%d)m (%w)-}Such and such happens.$

Anyway, try it out. your prompt looks like Achaea, so if you are on Achaea, I'm Procellan, so send me a tell, if it does or doesn't work.
Reply with quote
quigbrew
Novice


Joined: 04 Jun 2002
Posts: 31

PostPosted: Wed Feb 12, 2003 11:51 am   
 
Okay, I concede, I can't get it to work either. A couple seemed like they were working until I tested them a bit more...Anyway, I would be real interested in the solution, if there is one.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Feb 12, 2003 12:43 pm   
 
Create a trigger to move the message away from the prompt when it comes in like that:
#TRIGGER {^(%d)h, (%d)m, ex-([a-zA-Z1-9 .,"'()])$} {#GAG;#SH {%1h, %2m, ex-};#SH %3}

Make sure this trigger is the very first one you have since it must fire before any other trigger. Just select View|Sort by...|None and drag & drop the trigger to the first place in the list.

Now, all you need in your triggers is to account for the possibility that the line might start with -:
#TRIGGER {^{-|}Such and such happens.$} {do stuff}

Note: The first trigger uses a range since it seems that * matches 0 or more characters. I don't remember seeing this before, but the range works fine. Just be sure to add to it any other character that you may need to match. Also, right now (at least in 6.53), when the line comes on a prompt, the second trigger double-fires. I believe this to be a bug, and I'll report it to Zugg, but besides that, this should work.

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Feb 12, 2003 7:35 pm   
 
quote:
LightBulb: Have any ideas on this?

Yes. First decide which prompt you are going to use (with numbers or without). Second, test to see if there's actually any problem with anchored triggers not matching when the pattern occurs on the same line as a prompt. If there's not, then this is all a waste of time.

If there is a problem, it's because you've used the ^ anchor. Give serious consideration to doing without it.

Finally, something like this should work (if anything will)
#TR {(%d)h, (%d)m} {#SAY {}} {} {nocr|prompt}

LightBulb
Advanced Member
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