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
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Sun Nov 11, 2001 5:58 pm   

capturing text from an ansi trigger
 
My apologies if this is the wrong place to post this. I'm running 6.22 BETA but I don't have access to the beta forum.

I created an ansi trigger (by logging with ansi on in order to get the codes since the paste option still seems to not work). I'm just trying to capture any lines from a clan channel. The pattern I used is:

(%e[1;34m[%e[1;33m*)

That would be a blue left bracket, followed by a yellow word (the name of the speaker), followed by other ansi codes.. closing brackets.. and the message. I wanted to capture all of this and send it to another window (or even echo it again at this point).

The command I'm using for now is:

#show Arg1 = %1

The resulting output when the trigger matches (and it does seem to match on the correct lines) is:

Arg1 =

Any suggestions on how to capture text with ansi codes or pointers to what I'm screwing up would be appreciated.

Thanks,
Eupher
Reply with quote
iljhar
GURU


Joined: 10 Oct 2000
Posts: 1116
Location: USA

PostPosted: Mon Nov 12, 2001 5:09 am   
 
Okay, first, here is the url to apply for the Beta Forum: http://www.zuggsoft.com/forum/beta_app.asp. It can be found on the main Forums page. Second, did this trigger work in a previous version and it's just not working now? If so, then this should really be brought up on the Beta Forum. You can email Zugg at support@zuggsoft.com to tell him about the bug. Third, try putting quotes around %1:

#show Arg1 = "%1" or try putting it in a variable to see if it'll store it:

#var Arg1 "%1"
#show Arg1 = @Arg1

Also, try using #say and #echo to see if that comes up. Tell us how it went. :)

Iljhar
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Tue Nov 13, 2001 1:26 am   
 
Ok, I have access to the beta forum now. Thanks.

I don't know if this worked on a previous version of zmud. I just created the trigger after I upgraded to 6.22. Anyone out there using the last public release that wouldn't mind trying this out? I'd like to avoid posting it to the beta forum if it's a pre-existing bug or I'm just doing something wrong.

I tried all your suggestions... putting it in quotes.. saving to a variable... using #say and #echo. I still got the same results.

Thanks again,
Eupher
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Tue Nov 13, 2001 2:11 pm   
 
Okay, this could be a stupid question, but do you have the option "Ansi Trigger" on your trigger's option page marked?

Another thing, in order for something to be saved from a pattern it must be a single pattern type placed between (). Like (%w) or (*). You have 3 types in your pattern between the same (), namely %e, %e, and *. Maybe that is the reason why it's not saving?

I don't have any experience with ansi triggers, so indulge me

Acaila
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Nov 13, 2001 6:48 pm   
 
I think you'd be better off to test this with the actual #CAPTURE command you intend to use instead of trying to test it with the #SHOW command. The advantage is that with #CAPTURE you don't have to use any variables, which means you don't have to figure out the right way to process all those special characters.

LightBulb
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Tue Nov 13, 2001 7:08 pm   
 
Yes, the ansi trigger option is set. I'm pretty sure I have the right pattern because the trigger is firing on the appropriate lines.

I hadn't realized there could only be one wildcard inside each set of (). That seems likely to be my problem. I'll try changing that when I get home (no zmud access atm) and report back on the results.

I'm not using the #capture command because sometimes my mud prompt is inserted at the beginning of lines I receive from the mud. I don't want to log the prompt if it's there, just the message. That possibly present prompt is also the reason I didn't anchor the trigger.

Thanks again,
Eupher
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Wed Nov 14, 2001 2:23 am   
 
Ok, I couldn't find anything in the helpfiles about there being a restriction to one wildcard inside parenthesis in a trigger pattern. Besides that, the %e expressions aren't wildcards... they are specific characters to match exactly. Also, I have current triggers with multiple wildcards inside single parenthesis that seem to work fine.. such as:

(%w tells you '*')$ -> #win Tells %1

Does anyone have a reference to a help document that would address my misuse of wildcards? Or does anyone else have any other ideas about why the original ansi trigger I posted isn't saving a value in %1?

Thanks,
Eupher
Reply with quote
decantor
Apprentice


Joined: 14 Nov 2001
Posts: 100

PostPosted: Wed Nov 14, 2001 5:38 am   
 
It has been my experience that wildcards are an animal best kept cocntained and as simple as possible. Your tells capture trigger, for instance, I would code:

#TR {(%w) tells you '(*)'} {#WIN Tells [%1 tells you '%2']}

As for your ansi trigger, I've never had to code in more than one color before, since muds that use multiple colors dont usually keep me there for long enough to build up a trigger set... but if you keep things simple like the above example, it shouldn't be too terribly hard...
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Wed Nov 14, 2001 8:54 am   
 
Have you ever tried using:

#TRIGGER {(%e)[1;34m[(%e)[1;33m(*)} {PutActionHere}

Or even:

#TRIGGER {%e[1;34m[%e[1;33m*} {#CAPTURE Clan}

Acaila
Reply with quote
eupher
Apprentice


Joined: 18 Jan 2001
Posts: 116
Location: USA

PostPosted: Thu Nov 15, 2001 1:34 am   
 
quote:

#TRIGGER {(%e)[1;34m[(%e)[1;33m(*)} {PutActionHere}



The pattern doesn't even match anymore.

quote:

#TRIGGER {%e[1;34m[%e[1;33m*} {#CAPTURE Clan}



This works, except in the case I mentioned earlier... where it also captures my prompt from time to time.

I also tried several other combinations, such as:

#TRIGGER {(%e[1;34m)[(%e[1;33m)(*)} {#WINDOW Clan "%1" "%2" "%3"}

matches and outputs <ESC>[

#TRIGGER {%e[1;34m[%e[1;33m(*)} {#WINDOW Clan "%1"}

matches and outputs nothing... just changes focus to the Clans window


Is there nobody out there that is using ansi triggers? If people are using them... surely some are capturing text to variables. Is this just a bug people ignore, or is there something I'm doing wrong here? I can't believe nobody has an answer to this one.

Eupher
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Thu Nov 15, 2001 6:05 am   
 
quote:

Another thing, in order for something to be saved from a pattern it must be a single pattern type placed between (). Like (%w) or (*). You have 3 types in your pattern between the same (), namely %e, %e, and *. Maybe that is the reason why it's not saving?



You can have any amount of wildcards and text within the parentheses. It's preferable to follow KISS principles, but the following is perfectly allowable: (%d{st|nd|rd|th}*%w)

The simplicity just makes things easier for you when you're bug-hunting ("goldangit, NOW why isn't the trigger firing? Whoops, shoulda used %d instead of %w").

As far as ansi trigger patterns, do the special characters found in an ansi code or elsewhere need to be quoted? There might be an active [] operator or something which causes the trigger to fire, but which interferes with the capture of the variable info. Lord knows this happened to me often enough with non-ansi triggers when I was learning the ropes. I noticed you didn't have the [ (the one that's supposed to be blue) quoted, and since you probably have a matching ] in your pattern somewhere it's probably looking for and finding one of the characters between them when the pattern matches. I have absolutely no experience or need for ansi triggers, so this might just be wasted space here.


li'l shmoe of Dragon's Gate MUD
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