Matching on undefinable text

Posted by Karl_Newbie on Thu 13 May 2004 07:49 AM — 4 posts, 16,347 views.

USA #0
Hi, I've been fooling around with Mushclient now and have written this alias below.
Question:
I want to capture room titles as I explore the world just for my own reference.

Room titles are important and being able to group them by the region they are found in would make my experience that much easier.

Basically, I want to walk into a new room and capture the first line of text that reaches my world's output after I enter the walk command. Because the first line of output from the mud after a directional command is usually the room title

Sending it to notepad would be fine.

Sort of like this:


[e (these direction commands are just the Mushclient echo of my input)]
The School
Room description would be here
[w]
Road
[s]
Road
[s]
Grassy Patch
[e]
Wooded Patch

I would want The School, Road, Road, Grassy Patch, Wooded Patch all sent to notepad.


Problem: If the room title was in ansi colour I would know how to capture it, but unfortunately it couldn't be that simple. The Mud does not distinguish the room title from the rest of the description except by placing the room title alone on the first line of the room description.

The School
This is the training area for the mud. Many things to do here. Looking around you see lots of stuff.

I see how this alias without the "send e" captures and sends the last line to notepad. I was hoping I could do something similar here. I don't want to have to clear the output buffer of all but the first line every time I move either :)

<aliases>
<alias
match="e"
enabled="y"
send_to="12"
sequence="100"
>
<send>send &quot;east&quot;

world.AppendToNotepad &quot;roomtitles&quot;, GetLineInfo (line, 1) &amp; vbcrlf


</send>
</alias>
</aliases>
Australia Forum Administrator #1
The problem will be if the next thing isn't the room name, but if it usually is, this should be easy enough.

Make an alias for the direction commands (eg. a regular expression that matches "n|s|e|w" etc.) and have that alias enable a trigger matching anything ("*").

eg.

EnableTrigger "room_name", 1

When that trigger fires (ie. on the next line that arrives) it can send it to notepad or whatever, and then disable itself.

eg.

EnableTrigger "room_name", 0
USA #2
Hmm. I was pondering some other ways of getting the room name.

Thinking about Adjectives, Nouns, Verbs, and other grammar stuff. Important thing would be verbs.
From that, I started thinking about lengths, but that doesnt work well either.

However, capitalization might. Room names will be proper nouns. So, MOST LIKELY theyll be capitalized with the exception of prepositions.

That could be used as a secondary check, if you wanted better accuracy, and felt like taking on a bit of coding. The capitalization thing is easy enough with regexps, its just the prepositions, and then the fuzzy logic to determine if it is indeed a title.
USA #3
Thanks Nick and Flannel. Nick's works great. Flannel, maybe next year :)
Even when I get an extra line of text after walking
(entering a dark room while holding a light source displays
Light illuminiates the surroundings.
Room name
Room desc


A trigger for that "Light illuminates the surroundings." enabling the room_names "*" trigger with a higher priority sequence # still catches the room title.
Thanks again.