[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Materia Magica mapper plugin

Materia Magica mapper plugin

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


Pages: 1 2  

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Tue 12 Oct 2010 04:25 AM (UTC)

Amended on Tue 12 Oct 2010 09:06 PM (UTC) by Nick Gammon

Message
Below is a preliminary attempt at a mapper for Materia Magica. The tricky bit, as usual, with MUDs is trying to detect when you are in a new room, and work out a room number.

In this case I looked for a yellow line (the room name) followed by a blue line with hyphens in it (the compass) followed by some gray lines (the description). Put all that together and you should have something reasonably reliable.

The exit detection is simply done by noticing you are in another room, and working out which way you came from the previous room.

When you first go to a new room it will appear disconnected, until you walk back the way you came. Then it realises that if east from A is B, and west from B is A, then A and B are connected.

Example:



The plugin is now available on GitHub.

Go to this page:

http://github.com/nickgammon/plugins/blob/master/Materia_Magica_Mapper.xml

You will see the plugin in pretty-printed XML format.


  • To get a raw copy suitable for installing, look a little way down the page to where it says:

     ... edit | raw | blame | history


  • RH-click on the "raw" hyperlink and then "Save link as" to get a local copy. (You can click on "history" to see what recent changes have been made)

  • Put the copy in your worlds / plugins folder.

  • Name it: Materia_Magica_Mapper.xml

  • Go to the MUSHclient File menu -> Plugins

  • Click "Add"

  • Choose the file Materia_Magica_Mapper.xml (which you just downloaded) as a plugin

  • Click "Close"


For exit detection you should turn on the Visible Exits line by typing into the MUD:


set show-exits


Then as you walk around you should see something like:


  Visible Exits: N E S W Nw Ne 


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 12 Oct 2010 09:05 PM (UTC)
Message
The mapper plugin has been improved today to detect exits from the Visible Exits line which you can turn on (see above post). I have removed the plugin from the post and moved it to GitHub. That way you can always get the latest one.

The "history" link shows what has changed recently, when and why. Well, hopefully.

Because of the exit detection you will now see "stub" lines which show rooms that it knows exist (because there is an exit leading there) but it doesn't yet know what room is there.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ruthgul   (18 posts)  [Biography] bio
Date Reply #2 on Tue 12 Oct 2010 11:45 PM (UTC)
Message
Awesome!

Big thank you :)
[Go to top] top

Posted by forral   USA  (79 posts)  [Biography] bio
Date Reply #3 on Wed 13 Oct 2010 12:15 AM (UTC)
Message
I know it sounds terrible, but I got a chubby as soon as I read this. My MUSHClient dreams have come true, ty Nick!

The only other question, and I don't know if I asked this in another thread last night, is how will it handle dizzy rooms, looping rooms, teleporting rooms, etc?
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Wed 13 Oct 2010 01:47 AM (UTC)
Message
Basically it draws "normal" exits - teleports and funny rooms might make it either not draw them, or draw inconsistently. I haven't really addressed that sort of thing.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Wed 13 Oct 2010 04:47 AM (UTC)

Amended on Wed 13 Oct 2010 04:49 AM (UTC) by Nick Gammon

Message
I have been enhancing the mapper somewhat.



One major change is to use a SQLite database, rather than saving the map in the plugin state file.

What this does is let you share the maps much more readily - for example, if you have multiple characters they will all use the same database, so you don't have to remap every time you switch characters. Also you could conceivably dump the database into a text file (see "Backing up your database" on http://www.gammon.com.au/db) and then email that to someone else to incorporate into theirs (effectively, merging your database with theirs).

Some other improvements:


  • Shops are marked in darker brown (see example above) so you can more easily find them

  • Trainers are marked in yellow

  • You can RH-click to add bookmarks (eg. "quest")

  • You can search for shops, trainers or for any word in the room name or room description, eg:

    
    mapper shops
    
    Devon's Herbs (BBDF9F09FD) - 8 rooms away
    Tolin's Weapons (E5DFB9CC5F) - 8 rooms away
    Telgan's Tavern (3DACF5215A) - 9 rooms away
    Shrine of St. Wisehart (0B0408C190) - 12 rooms away
    Savonty's Barbershop (76E5347C13) - 13 rooms away
    Galbo's Armor (D9ADD4A960) - 14 rooms away
    The Hungry Goat Inn (7307E97D8E) - 15 rooms away
    The Bank of Rune, Lasler Branch (CED07B0B8B) - 16 rooms away
    General Store (43AA57A385) - 16 rooms away
    
    
    mapper train
    
    
    Hall of Training (79F3C09702) - 11 rooms away
    Hall of Training (B7FD218B1D) - 12 rooms away
    There were 2 matches which I could not find a path to within 30 rooms.
    
    
    
    mapper find irvin
    
    
    Bedroom (FA2A468D8C) - 1 room away
    Living Room (068C303A14) - 2 rooms away
    Cramped Closet is the room you are in
    Master Irvin's Office (5C862533CB) - 3 rooms away
    
    


  • Shops and trainers are auto-detected as you walk around

  • It detects lines like "The door is closed." and then automatically opens the door.


You could do more, but this should give you something to play with.

The new version is available from GitHub, link given above.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by forral   USA  (79 posts)  [Biography] bio
Date Reply #6 on Thu 14 Oct 2010 02:58 PM (UTC)
Message
Hey Nick,

I installed this updated plugin but I got a few errors. Upon initial loading:

Run-time error
Plugin: Materia_Magica_Mapper (called from world: Materia Magica - Forral)
Function/Sub: Other_Line called by trigger
Reason: processing trigger "Other_Line"
[string "Plugin"]:658: table rooms has no column named desc
stack traceback:
[C]: in function 'error'
[string "Plugin"]:593: in function 'dbcheck'
[string "Plugin"]:658: in function 'save_room_to_database'
[string "Plugin"]:179: in function <[string "Plugin"]:103>
Error context in script:
654 : function save_room_to_database (uid, title, desc)
655 :
656 : assert (uid, "No UID supplied to save_room_to_database")
657 :
658*: dbcheck (db:execute (string.format (
659 : "INSERT INTO rooms (uid, name, desc, date_added) VALUES (%s, %s, %s, DATETIME('NOW'));",
660 : fixsql (uid),
661 : fixsql (title),
662 : fixsql (desc)
You have entered "The Separatists Clan Hall".
Trigger function "Other_Line" not found or had a previous error.
[*][SAFE]<3087hp 2500sp 1692st> [ 0 * 0 * 22 ]
Trigger function "Other_Line" not found or had a previous error.
l


And that line "Trigger function "Other_Line" not found or had a previous error" repeats itself after every single line.

Thanks,
Forral
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Thu 14 Oct 2010 07:55 PM (UTC)
Message
For a minute I thought I must have forgotten to create that column "desc" but it gets created with everything else. I don't really understand that. What version of MUSHclient are you using?

Can you please:


  • Remove the plugin (so the database isn't in use)

  • Delete the database (materiamagica.com_23.db) from your MUSHclient directory (the number 23 might be different depending on what port you connect on).

  • Re-install the plugin


Let me know of any other error messages (like, when first starting).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Thu 14 Oct 2010 08:14 PM (UTC)

Amended on Fri 15 Oct 2010 02:21 AM (UTC) by Nick Gammon

Message
I can see one potential problem. Maybe "desc" is a reserved word, although it works for me.

[EDIT] The word "DESC" is indeed an SQL word (short for descending) so I am puzzled why it ever worked. I am guessing your version of the SQLite engine was earlier and does not allow "desc" in that way. If you had a version of MUSHclient which is 4.60 or earlier this might be the case.

I've updated the plugin to use "description" instead. Try grabbing the latest plugin (it should be version 1.2) and then follow my instructions above to delete the database and start again (it needs to make a new database with "description" rather than "desc").

Because of this change, anyone else who is using the plugin will need to delete the database and start again. Sorry.

As an alternative (if you have already mapped a lot of rooms - this won't be you Forral) you can do this:


  • Close MUSHclient so the database is not in use.

  • Grab the "command line tool" from the SQLite3 web site, eg.

    http://www.sqlite.org/sqlite-3_7_3.zip

  • Unzip that and put sqlite3.exe into your MUSHclient directory.

  • Open a command window (Run -> Cmd), change directory to the MUSHclient directory, and type:

    
    sqlite3 materiamagica.com_23.db .dump > materiamagica.sql
    


    (The number 23 might be 4000 - it is whatever port you use to connect).

  • Use a text editor like Crimson Editor to open up the resulting file materiamagica.sql.

  • A few lines down change "desc" to "description":

    
    CREATE TABLE rooms (
          roomid        INTEGER PRIMARY KEY AUTOINCREMENT,
          uid           TEXT NOT NULL,   -- vnum or how the MUD identifies the room
          name          TEXT,            -- name of room
          description   TEXT,            -- description
          building      TEXT,            -- which building it is in
          shop          INTEGER,         -- 1 = shop here
          train         INTEGER,         -- 1 = trainer here
          notes         TEXT,            -- player notes
          date_added    DATE,            -- date added to database
          UNIQUE (uid)
        );
    


  • Further down find these lines and change "desc" to "description" in two places:

    
    INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)
    VALUES('table','rooms_lookup','rooms_lookup',0,
    'CREATE VIRTUAL TABLE rooms_lookup USING FTS3(uid, name, description)');
    CREATE TABLE 'rooms_lookup_content'(docid INTEGER PRIMARY KEY, 'c0uid', 'c1name', 'c2description');
    


  • Save your changes to materiamagica.sql.

  • Rename the original database:

    
    ren materiamagica.com_23.db materiamagica.com_23.db.old
    


  • Recreate the database from the SQL:

    
    sqlite3 materiamagica.com_23.db < materiamagica.sql
    


  • Download and install the amended plugin.

  • Start MUSHclient again and try the mapper.


That should fix up the name of the "desc" column to work with the amended plugin.

Of course, only do all this work if you have mapped hundreds of rooms - otherwise it would be quicker just to start again.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by forral   USA  (79 posts)  [Biography] bio
Date Reply #9 on Fri 15 Oct 2010 02:57 AM (UTC)
Message
Thanks for the fix Nick. Oddly though, its not mapping the rooms. I no longer get the error messages and I do see the message of each room being added to the database with a unique ID, but its not drawing it.

In response to your previous post I am still the latest MUSHClient, 4.64.
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Fri 15 Oct 2010 03:04 AM (UTC)
Message
As I mentioned earlier, you need to backtrack a bit. That is, when visiting a new room you are likely to just see one square. But if you backtrack it should join them. So for example, in a town, walk all the way east (you will just see single squares). Then walk west, and they will start to be connected. It doesn't assume that going east from a room means you can go west to get back there.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Fri 15 Oct 2010 03:07 AM (UTC)
Message
Also make sure you can see the exits:


set show-exits


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by forral   USA  (79 posts)  [Biography] bio
Date Reply #12 on Fri 15 Oct 2010 03:22 AM (UTC)
Message
Nick Gammon said:

Also make sure you can see the exits:


set show-exits




That did the trick, I forgot to re-enable it after reinstalling the plugin.

Thanks alot Nick, this really makes the game more enjoyable to play, and will help with alot of the tricky dungeons.
[Go to top] top

Posted by Nick Gammon   Australia  (23,016 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Fri 15 Oct 2010 05:52 AM (UTC)
Message
Yes I see that it doesn't link rooms without seeing the exits. I've amended the plugin to warn you to turn that on, if it doesn't get the exits line.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Mudder   (7 posts)  [Biography] bio
Date Reply #14 on Sat 16 Oct 2010 04:32 PM (UTC)
Message
Nick, you're an animal!

This is cool stuff.
[Go to top] 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.


100,533 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]