|
Arcane_of_Discworld Wanderer
Joined: 29 Jan 2002 Posts: 99 Location: UK
|
Posted: Tue Oct 07, 2003 10:27 am
LP mapping problem |
I am trying to remap discword mud as automatcally as possible, to this end I have configured zMud to obtain 'room exits' and 'room name' from brief look mode (mud setting) which works perfectly. The problem I have is in processing the results of the 'look' command which I have zMud send to the mud which are as follows:
NOTE: I have the mud output set up to send 999 characters of text on each line therefore none of the following requires multi-line triggers
look
This is a long, narrow hallway. There is a small table situated in a corner, above which a window overlooks the gardens at the side of the house. A doorway to the east leads into the living room, and another leads into the kitchen to the north. A staircase along the western wall leads upwards. The door to the south takes you back into the front garden.
There are four obvious exits: north, east, up and south.
look
It is night and the waxing half moon is hidden by the clouds.
Farther west the Hubwards Road enters the palace courtyard. You can see the palace buildings on the north side of the road just to the west of here. To the north at this point is a garden, behind which stands a large house. South of here is the wall surrounding Pharaohs' Park.
It is a slightly chilly autumn prime's night with almost no wind and some puffy clouds.
There are three obvious exits: east, west and north.
A scorpion is crouching here.
My idea is to capture all text from the mud until the exit line is output, what I then want zMud to do is extract only the room description which in the top example is the previous line but in the second it is two lines previous. My problem is that I have no idea how to use the exit line to then process the preceeding lines nor how to store the preceeding lines so they can be processed.
Also of not is that the weather line can be distinguished because it is output in a different colour.
Thanks in advance
Arcane |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Oct 07, 2003 12:14 pm |
Since your mapping is going perfectly in brief mode, I would say the best way to do it is to use the room name stored in the mapper to start the capture. This would be done easily by use of a look alias.
#CLASS RoomCap
#VAR DescCap {} {}
#VAR RoomName {} {}
#ALIAS look {DescCap="";RoomName=%roomname();#T+ CapDesc;#T+ ExitDetection;~look}
#TRIGGER "CapDesc" {^{@RoomName}$} {#NOOP Variables already cleared in look alias, do nothing here} "" {disable}
#COND "CapDesc" {*} {DescCap=%line} {disable}
#TRIGGER "ExitDetection" {^There {is|are} %w obvious exit{s|}: *.$} {#STATE CapDesc 0;#T- CapDesc;#T- ExitDetection;#NOOP What other processing do you want to do} "" {disable}
#CLASS 0
That is written off the top of my head and may be buggy. |
|
|
|
Arcane_of_Discworld Wanderer
Joined: 29 Jan 2002 Posts: 99 Location: UK
|
Posted: Wed Oct 08, 2003 12:10 pm |
Thanks for your prompt reply Vijilante
I didn't use your proposed solution as I couldn't work out how it would actually work therefore the chances of me being able to debug it were almost nil [:I]
I have devised my own solution though which is:
I still map entirely in brief mode so that as I traverse the mud I initially see only the room name and obvious exits such as:
The palace entrance [n,e,s,w].
From this zMud's automapper obtains the name and exits, then I have a trigger to determin whether the mapped room has already got a description or not:
Pattern:
(*)~[(*)~].$
Value:
#ALARM +1 {
#IF (%roomdesc( ,)="") {
#ECHO No Description set in this room
~look
} {}
}
The Alarm was necessary as I was recieving text too quickly and the processing trigger (following this) was catching the wrong information, the processing triggewr is as follows:
Pattern:
^There {are|is} %w obvious {exit|exits}:*.$
Value:
#IF (%ismember( "wind", %replace( %line2, " ", "|"))=0) {
#NOOP %roomdesc( ,%line2)
} {
#NOOP %roomdesc( ,%line3)}
I couldn't figure out how to do a colour analysis on the line preceding the trigger pattern but was able to utilise the word wind as the key word because all weather lines include it.
If anyone can tell me how to analyse the line preceding a trigger pattern for its colour properties I would be most appreciative as I could then clean the processing up.
Thanks for you help
Arcane |
|
|
|
|
|
|
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
|
|