|
Eleri at'Xalien Newbie
Joined: 19 Mar 2008 Posts: 5
|
Posted: Fri Jan 16, 2009 4:35 am
[2.37] Federation 2 MUD Mapper Configuration |
To preface, I am not the most accomplished scripter, but this problem is driving me crazy. The automapper wizard when used on this MUD only detects the prompt line. It doesn't detect either a name or description, there isn't an exit line. However, the name and description are in a semi-distinctive pattern. Some sample room descriptions:
Code: |
>west
Mars Interplanetary Hotel
This is Mars' only hotel, but despite the lack of competition, it's a very classy joint, and it charges accordingly. Only the super-stellar-rich can afford to stay here, so there's no chance of you affording a room.
The walls are covered with real wood paneling, and an impressive crystal chandelier hangs from the high ceiling.
The exit is east, and the hotel's lounge is north.
|
Code: |
>e
City street
This is the west end of an east/west road. The entrance to 'The Duff Modem' pub is to the south. West is a large door, made of real terrestrial mahogany - the entrance to a hotel.
|
As you can see, as far as I can tell each room starts with a capitalized phrase for the name, and then has a multi-line or single line description. The description lines all have three spaces before they start. Any objects in the room, begin on a line after the description without the spaces before them. As far as I can tell, the descriptions never change. I should note that each description line appears to be one whole line, it's just auto-wrapped.
The code I have so far:
Code: |
<trigger priority="3970" id="397">
<pattern>^>%</pattern>
<value>#TAG prompt</value>
<trigger>
<pattern>^([A-Z]*)</pattern>
<value>#TAG name %1
#VAR descript ''</value>
</trigger>
<trigger type="Loop Expression" param="10">
<pattern>^ ([A-Z]*)</pattern>
<value>descript = @descript + (%1)
#SHOW %1
#SHOW descript</value>
</trigger>
<trigger type="Wait" param="50">
<value>#TAG descpara @descript</value>
</trigger>
</trigger>
|
I know it's inelegant, but it detects the room name just fine. The problem is that it fails to detect the description, and as far as I can tell, does absolutely nothing with the descript variable and never runs that trigger, I just can't figure out why...or if there's a much better way to do this. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jan 16, 2009 3:05 pm |
First, does this mud have a way to turn off internal line wrapping? If it does, you might turn off the internal line wrapping. Cmud can wrap the lines itself, to fit the screen size as you display it. That might make the entire description appear on a single line from the mud, which makes it easier to trigger off it. It looks like you are trying to manually combine the multiple lines, which can be tricky.
|
|
|
|
Eleri at'Xalien Newbie
Joined: 19 Mar 2008 Posts: 5
|
Posted: Fri Jan 16, 2009 3:40 pm |
I was a bit unclear. The MUD line wrapping is already turned off. Cmud was doing the auto-wrapping.
And, yep, that's exactly what I'm trying to do with the multiple lines, or single lines...and so far it's frustrated me. |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jan 16, 2009 5:52 pm |
Oh, I see. The room description contains multiple paragraphs, and thus multiple lines, even with line wrapping turned off. hm.
Oh, I see the problem. You don't want "Loop Expression", you probably want "Loop Lines". Also, I don't think you need the "Wait 50 ms" on the last state. If it reaches that state, it should be able to tag it immediately.
Loop Expression requires an expression to evaluate instead of a pattern to match. But Loop lines has a problem here too--it won't tag the description until the trigger tests 10 lines, which puts a potentially nasty delay on it. Another option would be to change it to "Within 1 lines" or "Within 2 lines", and cause it to repeat by adding "#state 2" at the end of the script for that state. That way, every time it matches a line, it will test the next line. Once it finds a line it doesn't match, it goes to the next state. |
|
|
|
Eleri at'Xalien Newbie
Joined: 19 Mar 2008 Posts: 5
|
Posted: Fri Jan 23, 2009 4:11 pm |
Thanks, Rahab for your suggestions. The only problem I have now is implementing them, and one other unforeseen problem. The MUD doesn't send another line after the description. It either sends a line without spaces to denote items within a room, or it just allows entry on the Command line. I'm not sure how to modify my script to repeat a certain multiple number of lines for a description and then end on either a line that begins without spaces or the next command prompt.
Code: |
0.0006 | c Federati | [1] FederationII Comline : start :
0.0013 | a Federati |w
0.0004 | h Federati |<ESC>[2Sw<ESC>[0m
0.0040 | j Federati >w
0.0009 | d Federati | [1] FederationII Comline : stopped
0.0743 | a Federati |>w
0.0001 | h Federati |>w
0.2681 | a Federati |Mars Interplanetary Hotel
0.0002 | a Federati | This is Mars' only hotel, but despite the lack of competition, it's a very classy joint, and it charges accordingly. Only the super-stellar-rich can afford to stay here, so there's no chance of you affording a room.
0.0002 | a Federati | The walls are covered with real wood paneling, and an impressive crystal chandelier hangs from the high ceiling.
0.0002 | a Federati | The exit is east, and the hotel's lounge is north.
0.7024 | ---
0.0001 | c Federati | [1] FederationII Comline : start :
0.0005 | a Federati |e
0.0001 | h Federati |<ESC>[2Se<ESC>[0m
0.0024 | j Federati >e
0.0005 | d Federati | [1] FederationII Comline : stopped
0.0744 | a Federati |>e
0.0000 | h Federati |>e
0.2635 | a Federati |City street
0.0004 | a Federati | This is the west end of an east/west road. The entrance to 'The Duff Modem' pub is to the south. West is a large door, made of real terrestrial mahogany - the entrance to a hotel.
0.6784 | ---
|
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Fri Jan 23, 2009 7:41 pm |
Hm. I haven't tested it, but something like this might work:
Code: |
<trigger priority="3970" id="156">
<pattern>^>%</pattern>
<value>#TAG prompt</value>
<trigger>
<pattern>^([A-Z]*)</pattern>
<value>#TAG name %1
#VAR descript ''</value>
</trigger>
<trigger param="10" trigontrig="false" newline="false" prompt="true">
<pattern>*</pattern>
<value>#if (%left(%trigger,3) = " ") {
descript = @descript + (%1)
#SHOW %1
#SHOW descript
#state 2
} {
#TAG descpara @descript
}</value>
</trigger>
</trigger>
|
Hm. Actually, that might have problems if a packet break happens in the middle of the description. I don't have a lot of experience with prompt triggers since I've never needed them. Is ">%" your prompt? Perhaps doing it in 2 triggers. In the following, a regular line starting without spaces will make it fall into state 3, and a prompt captured in another trigger will also set it to state 3:
Code: |
<trigger name="roomcapture" priority="3970" repeat="true" id="156">
<pattern>^>%</pattern>
<value>#TAG prompt</value>
<trigger>
<pattern>^([A-Z]*)</pattern>
<value>#TAG name %1
#VAR descript ''
#t+ prompttrigger</value>
</trigger>
<trigger param="10">
<pattern>*</pattern>
<value>#if (%left(%trigger,3) = " ") {
descript = @descript + (%1)
#SHOW %1
#SHOW descript
#state 2
}</value>
</trigger>
<trigger type="Expression" trigontrig="false" newline="false" prompt="true">
<pattern>1=1</pattern>
<value> #TAG descpara @descript
#state 2
</value>
</trigger>
</trigger>
<trigger name="prompttrigger" priority="1600" trigontrig="false" newline="false" prompt="true" enabled="false" id="160">
<pattern>^>%</pattern>
<value>#state roomcapture 3
#t- promptrigger</value>
</trigger>
|
|
|
|
|
|
|
|
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
|
|