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


Joined: 22 May 2003
Posts: 7

PostPosted: Mon Sep 06, 2004 4:27 am   

Achaea GTS Channel Capture
 
Okay, I've had several working capture triggers for my channels in Achaea. I wrote them myself and they have been working beautifully. I've enjoyed them a lot and have gotten spoiled with them.

For those of you unfamiliar with Achaea, a channel message looks like this:

(City): Peter says, "Yes, I did it."
(Guild): John says, "Can I get some help?"
(Novice): You say, "Where can I get a tattoo?"

etc.

Here are the scripts that I have been using to capture these channels and output them to different windows.

Code:
#CLASS {Triggers|Channels}
#VAR Channel {Guild}
#REGEX "StartCapture" {^\((.*)\): (\w+ says, .*)} {
  Channel = %1
  #sub {~[%time("hh:mm:ss")~] %2}
  #t+ CaptureAll
  #t+ StopCapture
  }
#REGEX "CaptureAll" {.*} {
  #gag
  #capture {@Channel}
  } "" {disable}
#REGEX "StopCapture" {\d+h, \d+m, \d+e, \d+w \w*-} {
  #t- CaptureAll
  #t- CaptureMe
  #t- StopCapture
  #gag -1
  } "" {prompt|disable}
#REGEX "StartCaptureMe" {^\((.*)\): (You say, .*)} {
  Channel = %1
  #sub {~[%time("hh:mm:ss")~] %2}
  #t+ CaptureMe
  #t+ StopCapture
  }
#REGEX "CaptureMe" {.*} {
  #gag
  #capture {@Channel}
  } "" {disable}
#CLASS 0


Recently, I gained class in my guild and gained access to a new channel. This new channel looks different from the previous ones and I've tried to update my triggers to work with it but to no avail. Examples from the new channel:

<<Guild>>: Fred says, "This is the new channel."
<<Guild>>: You say, "Why can't I capture this channel?"

Here are the triggers I attempted to write:

Code:

#REGEX "StartCaptureSecret" {^<<(\w+)>>: (\w+ says, .*)} {
  Channel = %1
  #sub {~[%time("hh:mm:ss")~] %2}
  #t+ CaptureAll
  #t+ StopCapture
  }
#REGEX "StartCaptureMeSecret" {^<<(\w+)>>: (You say, .*)} {
  Channel = %1
  #sub {~[%time("hh:mm:ss")~] %2}
  #t+ CaptureMe
  #t+ StopCapture
  }


However, none of these triggers are acting correctly. The #sub command works, I see the new line on my screen and then when I get the next line from the MUD, the modified channel line disappears. I check all my windows and even look for new ones but the <<Guild>> channels are not captured anywhere.

Any ideas?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Sep 06, 2004 3:48 pm   
 
<>
Special characters. Treat them the same way you did the ().
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
SterShep
Newbie


Joined: 22 May 2003
Posts: 7

PostPosted: Mon Sep 06, 2004 4:19 pm   
 
LightBulb wrote:
<>
Special characters. Treat them the same way you did the ().


Hmm, I thought I've tried that without any effect. I'll give it another shot. Out of curosity, what do < and > do in regular expressions?

Edit: Tried it again and didn't work. The line <<Guild>>: Peter says, "Hello." still gets turned into [10:08:23] Peter says, "Hello." but it is not captured into the window. All my other captures work fine though. It's just the << >> thing that's throwing it off. Any other ideas?


Last edited by SterShep on Mon Sep 06, 2004 5:20 pm; edited 1 time in total
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Sep 06, 2004 5:20 pm   
 
It's not what they do in regular expressions, it's what they do in zMUD. zMUD interprets <> as grouping characters used to force expansion, so it strips at least one set and expands any variables or expressions inside them. You'll need to use the zMUD quote character, ~, to get them ignored (however this will put the ~ in your pattern).

Actually, you'll probably have to make your patterns in the Settings Editor to get them right with #REGEX. With #TRIGGER, this will work:
Code:
#TR "StartCaptureSecret" {^~<~<(%a)~>~>: (%a says, *)} {
  Channel = %1
  #SUB {~[%time("hh:mm:ss")~] %2}
  #T+ CaptureAll
  #T+ StopCapture
  }
#TR "StartCaptureMeSecret" {^~<~<(%a)~>~>: (You say, *)} {
  Channel = %1
  #SUB {~[%time("hh:mm:ss")~] %2}
  #T+ CaptureMe
  #T+ StopCapture
  }
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
SterShep
Newbie


Joined: 22 May 2003
Posts: 7

PostPosted: Tue Sep 07, 2004 1:13 am   
 
I am still not able to get this to work. I have tried everything that you have suggested and have also tried switching off the <> characters in the parsing settings as well as in the special characters. I have included other things in my trigger like echos to test to see if the trigger runs on a <<Guild>>: Peter says, "HELP!" and the trigger is running.

It just refuses to capture.

Thanks for the help so far!
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Tue Sep 07, 2004 7:32 am   
 
Sorry to chime in since I'm at work and can't test this, but I noticed your original pattern was:

#REGEX "StartCapture" {^\((.*)\): (\w+ says, .*)}

and then you switched to:

#REGEX "StartCaptureSecret" {^<<(\w+)>>: (\w+ says, .*)}

Since quoting the special characters and using .* in the first pattern worked, did you try that for your second pattern also? Such as:

#REGEX "StartCaptureSecret" {^\<\<(.*)\>\>: (\w+ says, .*)}
_________________
zMUD 7.05a
Reply with quote
SterShep
Newbie


Joined: 22 May 2003
Posts: 7

PostPosted: Tue Sep 07, 2004 2:08 pm   
 
I did Falan. Thanks for the suggestion though.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Sep 07, 2004 6:01 pm   
 
Since there should only be one channel with this pattern, you don't need a wildcard to match the guild. Try it this way (leave out the things which mess you up)!
#TR "StartCaptureSecret" {^~<~<Guild~>~>: (%a says, *)} {
Channel = Secret
#SUB {~[%time("hh:mm:ss")~] %1}
#T+ CaptureAll
#T+ StopCapture
}
#TR "StartCaptureMeSecret" {^~<~<Guild~>~>: (You say, *)} {
Channel = Secret
#SUB {~[%time("hh:mm:ss")~] %1}
#T+ CaptureMe
#T+ StopCapture
}

Oh, and of course change "Guild" to the actual name of your guild.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
SterShep
Newbie


Joined: 22 May 2003
Posts: 7

PostPosted: Thu Sep 09, 2004 6:46 pm   
 
Still no luck. Thanks guys for trying but I think, I'll just have to get used to not capturing my GTS Channel. Nothing's worked so far and I think it might be a bug in ZMud or something.
Reply with quote
dkotas
Beginner


Joined: 03 Sep 2004
Posts: 23

PostPosted: Thu Sep 09, 2004 8:54 pm   
 
^\<\<&channel\>\>\:
#gag
#cap @channel

I think everyone missed the : (it's small, needs to take vitamins)
I am just used to quoting anything that is not 0 \- 9 a \- Z, it's safer
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Sep 09, 2004 11:26 pm   
 
Triggers are evaluated in a particular order, usually the order of creation. If you have one trigger (StartCaptureMe) which depends on another trigger (CaptureMe) coming after it, you either have to make the triggers in that order or move them to that order. This can be done in the Settings Editor. Use the 'All Classes' button if necessary to get all the triggers showing, make sure you have 'Sort by None' selected on the View menu, then use the Arrow buttons to move the triggers to the required order.

The CaptureAll and CaptureMe triggers are identical, you don't need both of them. However, they both CAPTURE to Guild and it seems that you intended them to CAPTURE to @Channel.

If you aren't sure the channels will always start at the beginning of the line, remove the ^ at the beginning of the pattern. This means if there's any chance the channels might be on the same line as the prompt, the ^ will need to be removed.

I've tested my triggers, they work.
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
SterShep
Newbie


Joined: 22 May 2003
Posts: 7

PostPosted: Fri Sep 10, 2004 12:25 am   
 
The order was the problem after all! Thanks LighBulb. I wasn't aware of that. Sorry for all the hard thinking I made everyone do over such a simple issue.

As for my triggers and the oddities in them, I actually just posted simply versions of them and the real ones have differences.

Again thanks for all the help! I can't do without my capture scripts.
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