Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Plugins ➜ Mapper Help for RoT MUD with no Room Numbers

Mapper Help for RoT MUD with no Room Numbers

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by xxRezinxx   USA  (7 posts)  Bio
Date Tue 05 May 2015 04:47 PM (UTC)

Amended on Sun 10 May 2015 01:27 PM (UTC) by xxRezinxx

Message
This is a long post but I wanted to provide as much information as possible.
I am trying to get a mapper working for a RoT MUD that does not show room numbers.
I have searched the forums and I found this:


roomname = "Market Street"
roomdesc = [[
The cobbled road is buzzing with activity.  Eager shouts from numerous tents
and pavilions encourage potential customers to come inspect a shopkeeper's
wares.  To the north is the Food Market, while the tent to the south is
dedicated to repairing items.  Market Street stretches to the east and west.]]


uid = utils.tohex (utils.md5 (roomname .. roomdesc))
uid = uid:sub (1, 10)    -- more manageable length

print (uid)  --> 2780473A26

in post http://mushclient.com/forum/?id=12635
How to use MUSHclient mapper on your own mud, but I'm not sure where to put that sort of thing at. Does it go in the mapper.xml or the mapper.lua?

I am using the mapper.xml from the post above, and mapper.lua from here: https://github.com/nickgammon/mushclient/blob/master/lua/mapper.lua

Here is some example text from the MUD I play:
Quote:


Market Square  **THIS ROOM NAME IS RED & GREY ON BLACK**
  
                  T   ________ 
  _____/----/-\ .' './========\ This spot is the center of everything.  All
 |.-.-.|===| _ |-----| u    u | journeys start here and strangely enough
 || | ||===||||| |T| |   ||   | end here, too.  The name of Market Square is
 :::::::::::::::::::::::::::::: a misnomer since this area is more like a
 ''''''''::::::::::::::'''''''' small park with two crossing cobbled streets, 
           '::::::::'           blooming flowerbeds, and small trees.
     A smelly vial is here.
     A small fountain covered in vines rests here gushing water from between the leaves.

<60718hp 35719mn 28725mv 83 Crane NESWUD> 
s
Common Square **THIS ROOM NAME IS RED ON BLACK**
  A small square is formed by the intersection of cobblestone streets.  To
the north, the Main Temple of Midgaard can be seen.  A dark alley leads off
to the east.  A poor alley leads off to the west.  A cobblestone street
leads south into Southern Midgaard.  

<60718hp 35719mn 28725mv 83 Crane NESW> 
s
a cobblestone road **THIS ROOM NAME IS BLUE ON BLACK**
  South of here you see the river and to the north is the common square.  A
rickety old bridge leads south to the promenade.  

<60718hp 35719mn 28724mv 83 Crane NS> 



I'm not interested in reinventing the wheel, so please, if someone knows how to do this or knows of a forum where this is already explained please help point me in that direction.

Thank you in advance
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 05 May 2015 07:52 PM (UTC)
Message
Check out this for an example of using the mapper:

http://www.gammon.com.au/forum/?id=10667

Quote:

Does it go in the mapper.xml ... ?


It goes in mapper.xml - the plugin.


Common Square **THIS ROOM NAME IS RED ON BLACK**
  A small square is formed by the intersection of cobblestone streets.  To
the north, the Main Temple of Midgaard can be seen.  A dark alley leads off
to the east.  A poor alley leads off to the west.  A cobblestone street
leads south into Southern Midgaard.  



OK, so we have a known way of identifying rooms. The red on black line can be used to start collecting room information. That line itself will be the room name (useful to know) and then you turn on (enable) a trigger that collects following lines until a blank line. Those lines are the description. Once you get the blank line you can hash the description to give a "room number".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by xxRezinxx   USA  (7 posts)  Bio
Date Reply #2 on Tue 05 May 2015 09:12 PM (UTC)

Amended on Sun 10 May 2015 01:29 PM (UTC) by xxRezinxx

Message
Okay, so I'm going through the triggers in his XML file

<trigger
   back_colour="8"
   bold="y"
   enabled="y"
   match="*"
   match_back_colour="y"
   match_bold="y"
   match_inverse="y"
   match_italic="y"
   match_text_colour="y"
   name="Name_Line"
   script="Name_Line"
   sequence="100"
   text_colour="11"
   keep_evaluating="y"
   
  >
  </trigger>
  
 <trigger
   back_colour="8"
   bold="y"
   enabled="n"
   match="(-------------------------------------------------)*"
   match_back_colour="y"
   match_bold="y"
   match_inverse="y"
   match_italic="y"
   match_text_colour="y"
   name="Hyphen_Line"
   script="Hyphen_Line"
   sequence="100"
   text_colour="12"
   
  >
  </trigger>
    
   
  <trigger
   back_colour="8"
   enabled="n"
   match="*"
   match_back_colour="y"
   match_bold="y"
   match_inverse="y"
   match_italic="y"
   match_text_colour="y"
   name="Map_Line"
   script="Map_Line"
   sequence="100"
   text_colour="15"
  >
  </trigger>  
 
  <trigger
   enabled="n"
   match="*"
   name="Other_Line"
   script="Other_Line"
   sequence="110"
   keep_evaluating="y"
  >
  </trigger>
    
  <trigger
   enabled="n"
   match="  Visible Exits: *"
   name="Exits_Line"
   script="Exits_Line"
   sequence="100"
  >
  </trigger>

The room name colors change for every room. I'm trying to find a way to identify them uniquely, but so far the only thing I can think of is they will always come after a direction command, as long as I don't get a hit a wall message.
Okay, so copy and paste of a few rooms with new prompt.
Quote:


Outside the West Gate of New Thalos
You stand outside the city walls, the iron gate to the east. The city lies
in that direction and the road to Midgaard lies west.
[..............] A nomad merchant looks you over.
[..............] An Elite Royal Guard stands here smiling happily.

<60776hp 35719mn 21308mv 83 Crane>
Room Name: Outside the West Gate of New Thalos
Visible Exits: W
e
Inside the West Gate of New Thalos
Two large stone towers embedded in the wall loom over you. The massive
iron gate, emblazoned with the crest of New Thalos, swings easily on
four ornately crafted hinges. It is obvious the makers of this city
spared no expense to protect their home. Main street heads towards
the market eastward and the eastern road passes through the Sands of
Sorrow to your west. To the south lies the entrance of the warrior's guild.
<5spaces>A scimitar lies here.
<5spaces>A suit of splintmail armor lies here.
<5spaces>A splinted shield lies here.
[..............] A guard stands here, watching the gate.
[..............] A small grey-haired man walks around spouting gospel.
[..............] A guard stands here, watching the gate.
[..............] A guard stands here, watching the gate.
[..............] A guard stands here, watching the gate.
[..............] A guard stands here, watching the gate.

<60776hp 35719mn 21307mv 83 Crane>
Room Name: Inside the West Gate of New Thalos
Visible Exits: ES



The prompt does show up with every tick. I don't know ow to get around that unless the mapper only maps immediately after a direction key is entered
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 06 May 2015 05:17 AM (UTC)
Message
Quote:

The prompt does show up with every tick. I don't know ow to get around that unless the mapper only maps immediately after a direction key is entered


The mapper maps when you tell it to. Normally this would be when you have changed rooms.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 06 May 2015 05:24 AM (UTC)
Message
Basically the mapper is very simple. You tell it to draw one room, the current room, presumably. Say you are in room 100. You tell it to draw room 100:


mapper.draw (100) 


That's it!

However the mapper then "calls back" into your code, to find information about room 100, such as its name, and the exits leading from it.

For each exit, the mapper then automatically draws those rooms as well. So, if room 100 leads to 101, 102, 103 etc. then those rooms get drawn too. Ditto for room 101, and so on, until it runs out of rooms that haven't been drawn, or space to put them.

For each additional room it also "calls back" into your code to find the information about those other rooms.

So your basic job is to populate a "rooms table" with this information, as best you can.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by xxRezinxx   USA  (7 posts)  Bio
Date Reply #5 on Wed 06 May 2015 12:39 PM (UTC)

Amended on Sun 10 May 2015 01:29 PM (UTC) by xxRezinxx

Message
Tracing through the code I feel like I understand what the theory of operation is, just not sure how to populate the rooms table in a meaningful manner.

Room Names & Descs are frequently in different colors. In some rooms there is a blank line between the room name and the beginning of the desc.

When I put it that way the game sounds chaotic...
If anyone is interested in taking a look,
hostname: landsofredemption.com
port: 1234
Top

Posted by xxRezinxx   USA  (7 posts)  Bio
Date Reply #6 on Fri 08 May 2015 02:51 AM (UTC)
Message
Is it possible to do something like this?

valid_direction:
n
s
e
w
u
d
N
S
E
W
U
D

fail_string:
Alas
THUD
WHAM

If KeyPress == valid_direction
If (!fail_string)
Get room_name //one single line, no color matching - similar to ^(.*?)$//
If (Get Room_name == true)
Get room_desc //room desc continues until it hits a blank line, or something indicating an item, mob, in the room, no color matching here as well//
Throw out lines for items, mobs, and players
Get visible_exits from line "Visible Exits: NSEW"


hash room_name .. room_desc = uid



Does any of that make sense?
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #7 on Sat 09 May 2015 02:10 AM (UTC)

Amended on Sat 09 May 2015 02:42 AM (UTC) by Nick Gammon

Message
I've made a stab at it for your MUD:

Template:saveplugin=Lands_Of_Redemption_Mapper To save and install the Lands_Of_Redemption_Mapper plugin do this:
  1. Go to the GitHub page: Lands_Of_Redemption_Mapper.xml
  2. Select all the page and copy it to the Clipboard
  3. Open a text editor (such as Notepad) and paste the plugin into it
  4. Save to disk on your PC, preferably in your plugins directory, as: Lands_Of_Redemption_Mapper.xml
  5. Go to the MUSHclient File menu -> Plugins
  6. Click "Add"
  7. Choose the file Lands_Of_Redemption_Mapper.xml (which you just saved in step 4) as a plugin
  8. Click "Close"

The main GitHub page for this plugin is at: https://github.com/nickgammon/plugins/blob/master/Lands_Of_Redemption_Mapper.xml.

There you will find the commit history and other information.



Example:



Important! You need to have autoexits on for it to work. Type:


autoexits


It isn't perfect, but at least you can muddle your way around a bit.

The big challenge is extracting room names from somewhat bland MUD output. I think I have done a reasonable job. It won't always be perfect, particularly if you get blocked from going somewhere.

Once you have explored a bit you can do a "find", eg.


mapper find weapon



The Weapon Shop - 5 rooms away
Entrance to Warriors' Guild - 5 rooms away
The Bar of Warriors - 6 rooms away
The Practice Yard - 7 rooms away
Grebe's Tavern - 8 rooms away


That involves a text search of the room name and description.

The rooms are saved in the plugin "state" file. That is easy to implement but means that they won't carry over from one character to another. A better solution is to use a database (SQLite3) but I don't have the energy for that right now. There are examples in the mappers for some of the other MUDs I did.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #8 on Sat 09 May 2015 10:20 PM (UTC)
Message
Design notes in the original thread here: http://www.gammon.com.au/forum/?id=12635

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by xxRezinxx   USA  (7 posts)  Bio
Date Reply #9 on Mon 11 May 2015 01:29 AM (UTC)
Message
I finally had a chance to check this thing out today. Thank you so so so much! Your help is sincerely appreciated! Your client rocks too! Keep up the hard work. Again, thank you.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


27,780 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.