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


Joined: 30 Jun 2006
Posts: 3

PostPosted: Fri Jun 30, 2006 12:27 pm   

Help with capturing a variable frm a pattern that may differ
 
Alright, the pattern may be any one of the following:

1. BIG'GUY is here.
2. (A) BIG'GUY is here.
3. (A) (B) BIG'GUY is here.
4. BIG'GUY LASTNAME is here.
5. (A) BIG'GUY LASTNAME is here.
6. (A) (B) BIG'GUY LASTNAME is here.

Is there a way I can make 1 trigger that'll take out BIG'GUY as the variable regardless of which pattern pops out?

Thanks in advance people. =)


Last edited by JerzZzzZ on Fri Jun 30, 2006 2:18 pm; edited 1 time in total
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jun 30, 2006 2:02 pm   
 
You would be wanting to match from the end and use the $ sign. As Big'Guy is contains a ' we'll need to use %x to capture it.

I am also detecting a space after the period so I shall include it in my sample trigger:

#TRIGGER {(%x) is here. $} {#VAR BigGuy %1}
Reply with quote
JerzZzzZ
Newbie


Joined: 30 Jun 2006
Posts: 3

PostPosted: Fri Jun 30, 2006 2:17 pm   
 
Ah shucks, uhm, I missed out another thing. Will be editting my first post, kindly help again. =x
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Jun 30, 2006 4:50 pm   
 
We have to figure out possibilities of (A) so we know to discard %1 is it is a (A). I'll add some color so you know if it is capturing.

#TRIGGER {(%x) (%x) is here. $} {#additem V_Titles %1;#additem V_Titles %2;#PSUB Yellow %x1;#PSUB Orange %x2}

You'll want to run that for a bit to get all the titles because as to distinguish the following two patterns:
(A) BIG'GUY is here. $
BIG'GUY LASTNAME is here. $


Once you think you have gotten all the titles, edit the variable V_Titles and remove all the BIG'GUY and LASTNAME names from it.

Then we use the trigger:

#TRIGGER {(%x) (%x) is here. $} {#IF (!%ismember(%1,@V_Titles)) {#VAR BigGuy %1} {#VAR BigGuy %2};#ECHO Deteremined BigGuy to be @BigGuy}
Reply with quote
JerzZzzZ
Newbie


Joined: 30 Jun 2006
Posts: 3

PostPosted: Sat Jul 01, 2006 1:06 am   
 
M'kay, thanks a bunch! I think I got a good idea now =)
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