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
dracx
Beginner


Joined: 14 Oct 2000
Posts: 26
Location: USA

PostPosted: Sat Mar 23, 2002 6:27 pm   

Problem with pattern matching
 
This is probably harder than you think it should be. Gonna need a sample output from the MUD to see.

Dracx
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Sat Mar 23, 2002 6:42 pm   
 
As Dracx said, we're gonna need to see raw MUD output, especially what precedes and follows the list of names.

Things to think about until then are the %replace function which can take a whole line of names and put them in a list:

#VAR theList %replace("Bob, Jill, Lisa, Sam, Mark", ", ", "|") would result in @theList being {Bob|Jill|Lisa|Sam|Mark}.

For your second problem, you can specify a string variable as part of a pattern, and zMUD will attempt to match any of the items in the list, and capture the individual item if you so desire.

#TR {({@theList})} {#VAR tname %1}

Troubadour
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Fri Mar 29, 2002 12:42 am   
 
quote:

The raw mud output is simply that...a list of names separated by commas which wrap at the end of the line so that it continues on the next. It is the "Quick who" list. I want to capture all the names on that list and add it to an additem list.



You obviously need a command to get that list, but are there any lines (like "Currently in the realms:") either before the quick-who and/or after it? If there's nothing trailing it, do you ALWAYS get a prompt following the list or can other things happen before the prompt appears?

li'l shmoe of Dragon's Gate MUD
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Mar 29, 2002 12:45 am   
 
Could make an alias that matches
his quick who command and ~quick who the mud
and toggle the catcher.

Then turn off come the blank line or prompt.

I'd suggest a good capture of before the
quick who, the quick who and some things
after the quick who so we don't waste our
time guessing what the output looks like.

Ton Diening
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Fri Mar 29, 2002 6:45 pm   
 
I think this is another Achaea question (since grahamsccs commented on Achaea's bot policy in another recent thread).

No leading text on a quick who, no trailing text. Simple comma separated list, with a period at the end. (Some other who commands do give you leading text).

Example, including a leading and trailing prompt:

2500h, 2500m ex-
Ayla, Ilana, Fezzig, Orem, Amicus, Tavish, Archidal, Ellisande, Jadis, Naiad,
Drazik, Kolieer, Noreaga, Razoor, Remeer, Khalid, Armelia, Caleth, Gelphend,
Beowulf, Vorleth, Sunrise, Avather, Navi, Shollyan, Clemlee, Grellek, Rystrel,
Xuzuthor, Edramon, Trusan, Miramar, Sardin, Kaisar, Amitation, Kahless, Aneila,
Thakren, August, Rivalyn, Valamort, Silverlock, Serge, Mercury, Exalus, Ravenna
, Arecee, Mistral, Changewinds, Lemon, Morlana, Tammar, Mesmer, Distance,
Klavin, Twinklefoot, Nyxx, Kei, Ishiva, Morbius, Scarthran, Shyria, Artos, Dave
, Ngo, Duo, Quintina, Tidal, Fwiffo, Caled, Crius, Angelfire, Mulkerrin,
Khejian, Decan, Dracon, Cree, Acadia, Kevin, Cynne, Scavenger, Ankah, Dalamar,
Dracnor, Elara, Andelas, Kerish, Maran, Voran, Magus, Xhalman, Faunus, Dilan,
Xanthier, Loki, Jenna, Ren, Orina, Feliss, Edian, Jack, Picillo, Silverwisp,
Myrkul, Tristar, Shazir, Romeo, Keerlin, Thorne, Airmid, Rejlii, Nocturne,
Jerle, Darktalon, Aldair, Xowni, Chameleon, Ithan, Firefox, Linus, Calamandor,
Aslani, Jem, Zyox, Corrupter, Oberon, Vasser, Richard.
2500h, 2500m ex-

No real wrinkles here, except the bizarre inclusion of commas on the beginning of new lines sometimes. There shouldn't be a problem with the list being broken up into sections, because Achaea lags to a crawl well before you'd get a screenful of people in the qwho list. (who, guildwho, citywho, etc are a different matter).

-Tarn
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Mar 30, 2002 10:23 pm   
 
No zMud nearby but rough concept:

#ALIAS who {~who short_whatever_command;#T+ whocap;#VAR wholist ""}

#CLASS whocap
#TRIGGER {^(*).$} {#IF (%copy(%1,1,1) != ",") {#VAR wholist %concat(@wholist,%replace(%1,", ","|"))} {#VAR wholist %concat(@wholist,%replace(%copy(%1,3,%len(%1)),", ","|"))};#T- whocap}
#TRIGGER {^(*)(%w)$} {#IF (%copy(%1,1,1) != ",") {#VAR wholist %concat(@wholist,%replace(%1,", ","|"),%2,"|")} {#VAR wholist %concat(@wholist,%replace(%copy(%1,3,%len(%1)),", ","|"),%2,"|")}}
#TRIGGER {^(*),$} {#IF (%copy(%1,1,1) != ",") {#VAR wholist %concat(@wholist,%replace(%1,", ","|"),"|")} {#VAR wholist %concat(@wholist,%replace(%copy(%1,1,%len(%1)),", ","|"),"|")}
#CLASS 0

I think I got everything separated by a |
with those triggers.

Ton Diening
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Apr 03, 2002 1:00 am   
 
Guess I will take a quick crack at this:

#ALIAS qwho {#T+ QWhoCapture;TempQWho="NotYet";~qwho}
#VAR QWhoList {}
#CLASS QWhoCapture
#VAR TempQWho {NotYet}
#TR {^(*)$} {#IF (%isnumber(%copy("%1",1,%eval(%pos("h, ","%1")-1)))) {#IF (@TempQWho="NotYet") {TempQWho=""} {QWhoList=%remove(".",%replace(%replace(@TempQWho,", ","|"),",",""));#T- QWhoCapture}} {TempQWho=%concat(@TempQWho,"%1")}}
#CLASS 0

As for the second problem, prepare for a minor performance drop...
#TR {({@QWhoList})} {TName="%1"}
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