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 ➜ CMUD dbm map file and where should it go

CMUD dbm map file and where should it go

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


Pages: 1  2 

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #15 on Tue 21 Oct 2014 12:08 AM (UTC)

Amended on Tue 21 Oct 2014 12:21 AM (UTC) by Nick Gammon

Message
A simple plugin that just shows the current exits is this:


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



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="Realm_Of_Magic_Exits"
   author="Nick Gammon"
   id="b87d958aea751d19db10d734"
   language="Lua"
   purpose="For exits for Realm of Magic"
   date_written="2014-10-21 10:00"
   requires="4.61"
   version="1.0"
   >
<description trim="y">
  Shows the current room name and exits in a miniwindow.
</description>

</plugin>

<!--  Script  -->

<script>
<![CDATA[

-- rname
function handleRoomName (rname)
  roomname = Trim (rname)
  exits_str = ""
end -- handleRoomName

-- rexits
function handleRoomExits (exits)
  exits_str = exits

  win = GetPluginID () .. ":exits"
  font = "f"
  local what_to_show = roomname .. " " .. exits_str
  
  WindowCreate (win, 0, 0, 1, 1, miniwin.pos_top_left, 0, 0)
  WindowFont (win, font, "Lucida Sans Unicode", 10)
  height = WindowFontInfo (win, font, 1)  + 10
  width = WindowTextWidth (win, font, what_to_show) + 10
  WindowCreate (win, 0, 0, width, height, miniwin.pos_top_left, 0, ColourNameToRGB "sienna")
  WindowText (win, font, what_to_show, 5, 5, 0, 0, ColourNameToRGB ("yellow"))
  WindowShow (win, true)
  
end -- handleRoomExits

function OnPluginMXPcloseTag (name)
  local tagname, text = string.match (name, "(%a-),(.*)")
  
  if tagname == "rexits" then
    handleRoomExits (text)
  elseif tagname == "rname" then
    handleRoomName (text)
  end -- if
  
end -- OnPluginMXPcloseTag

]]>
</script>

</muclient>


If you want to make it fancier you can play with that.

BTW if you are on good terms with the MUD admins they could assist you greatly by letting you know the room numbers (or some consistent internal ID).

For example, instead of:


<RName>Town Street</RName>


They could include the room number:


<RName uid=123456>Town Street</RName>


Similarly instead of:


<Ex dir=S>S</Ex>


The could include where the exit goes:


<Ex dir=S uid=7654321>S</Ex>


That means instead of the mapper having to hash names, and deduce where the exits go by what you last typed and where you ended up, it is all provided. Then it would be 100% accurate. :)

The benefit to the MUD is you get - more or less for free - a nice fancy mapper that doesn't get confused.

- Nick Gammon

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

Posted by Crate   (9 posts)  Bio
Date Reply #16 on Tue 21 Oct 2014 03:00 AM (UTC)
Message
Hey Nick,

I spoke to one of the mods recently about including the Room Numbers or something which would assist in room identifications, where he indicated this is something, they're looking at, possibly not the room numbers but something which could identify the rooms.

Actually thinking about it, I could probably recommend using a similar step as currently in the mapper where the room name and description are md5, instead, the server would md5 the rnum and room name and this id could be sent as the UID for the RName.

Regarding the cmud db, I got a zmud one from this link (https://drive.google.com/folderview?id=0BzBwCAxH0OGINzMxMjg0NWEtMGRjZC00MTkwLThlNGMtZjBmNTg2YjY0OWU4&usp=drive_web&ddrp=1#list) and converted to a dbm using zuggsoft zmud to cmud converter.

Dumped the schema for each table and have been trying to correlate how it works, so have been researching and trying to find out. At least right now within that database though, the room names and descriptions are listed, so was considering running them through and md5 to add to the current db, however, I recall one of the mods doing a major update to grammatical errors in alot of the zone files so it may not be consistent with the current.

Regarding the exits miniwindow, much thanks again. I was planning to include the open db function and utilize the get_rooms and relevant exits function to print the hash and relevant settings. Was considering including a button at the beginning, which when clicked would allow you to edit the the location and/or delete if mis mapped.

Did a bit of a sketch, where I want to include checkboxes in the exits miniwindow, to include trainer, shops, Death Traps (which I will scan with my wizards eye, and spy skills and not jump inside, which I have been known to do lol). Also, a checkbox if I want to include notes, which when checked will present a notes section where text can be entered.

Some of the functions used in the plugin, I believe I can also copy some of those and include in the exits window.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #17 on Tue 21 Oct 2014 04:51 AM (UTC)

Amended on Tue 21 Oct 2014 06:28 AM (UTC) by Nick Gammon

Message
I've put the mapper on GitHub now, to avoid spamming this thread with huge slabs of code.

This will always be the current version:

https://github.com/nickgammon/plugins/blob/master/Realm_Of_Magic_Mapper.xml

And the commit history:

https://github.com/nickgammon/plugins/commits/master/Realm_Of_Magic_Mapper.xml

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #18 on Tue 21 Oct 2014 04:58 AM (UTC)
Message
I've fixed a few more oddities. Speedwalking seems better if you change the "walk delay" in the mapper to zero. Click on the asterisk in the bottom LH corner of it to do that.

Now it attempts to detect shops and inns and display a yellow warning line, for you to notice and mark a room as an inn or shop, which helps find them later.

You can look at the "diffs" to see what the changes are. eg.

https://github.com/nickgammon/plugins/commit/1de18ba1910cb9131e

- Nick Gammon

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

Posted by Crate   (9 posts)  Bio
Date Reply #19 on Tue 21 Oct 2014 05:06 AM (UTC)
Message
Again sincerest thanks Nick
Was looking for the initial one though to extract some of the code, but in Git I'm seeing version 1.2.

I should know better, but I replaced the initial code with the newer ones instead of saving em to different versions.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #20 on Tue 21 Oct 2014 05:08 AM (UTC)
Message
Crate said:

I spoke to one of the mods recently about including the Room Numbers or something which would assist in room identifications, where he indicated this is something, they're looking at, possibly not the room numbers but something which could identify the rooms.


The important thing is that they are definitely unique, and not going to change.

Quote:

I recall one of the mods doing a major update to grammatical errors in alot of the zone files so it may not be consistent with the current.


This is the problem, even with my system. One spelling correction and it throws it out.

I don't see what the problem is with room numbers, but if they don't want to give away stuff (eg. gaps in room numbers) then just MD5 the room number (plus area number if necessary) so it doesn't "leak" information about the MUD structure.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #21 on Tue 21 Oct 2014 06:26 AM (UTC)

Amended on Tue 21 Oct 2014 06:27 AM (UTC) by Nick Gammon

Message
Crate said:

Again sincerest thanks Nick
Was looking for the initial one though to extract some of the code, but in Git I'm seeing version 1.2.


I must have been modifying the post in-place. All the more reason to use Git.

I dug up my first post from the forum audit trail. For reference, here it is:

http://gammon.com.au/files/mushclient/Realm_Of_Magic_Mapper_orig.xml

(RH-click to save the file, it will look weird in the web browser).

Note: That is the original one I posted, not the latest.

The latest one is on GitHub.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #22 on Tue 21 Oct 2014 10:32 PM (UTC)
Message
If you already have a database, you need to add a couple more fields with the SQLite3.exe command-line program.

Edit the database like this (your file name might be a bit different):


sqlite3 realmofmagic.org_4000.db


You can check the current schema with:


.schema rooms


Then type:


 alter table rooms add inn integer;
 create index inn_index on rooms (inn);
 alter table rooms add guild integer;
 create index guild_index on rooms (guild);

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #23 on Wed 22 Oct 2014 10:00 PM (UTC)
Message
Just a reminder that I am fixing various bugs and cleaning up code.

This will always be the current version:

https://github.com/nickgammon/plugins/blob/master/Realm_Of_Magic_Mapper.xml

And the commit history:

https://github.com/nickgammon/plugins/commits/master/Realm_Of_Magic_Mapper.xml

Check the commit history for recent changes.

- Nick Gammon

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

Posted by Crate   (9 posts)  Bio
Date Reply #24 on Mon 27 Oct 2014 04:05 AM (UTC)
Message
Hey Nick,

Again much thanks for plugin, you wont believe how awesome and how helpful it has been thus far.
Haven't had much time to play over the last week due to a lot of work, stuff comes up when u dont want it, but paying bills lol.

I did some checking into the code, and saw a column listed as room.area, however, I'm not seeing it in the database, nor in the create table. Was trying to determine what the field actually does. Hoping its a field to show the zone name.

What I've done though is manually update some rooms I've been in to reflect the zone name, by doing adding a column called zone to the room table, then UPDATE the rows. Thus far this is something I've been looking at for placing the zone name under the Room Name in the mapper

Since I haven't been venturing as much due to time wasn't as time consuming to sort through the db.

My thoughts for it as follows
get zonename from room.zone
Store zone name in variable eg currentzone
This will be the default zone unless it is changed.
Rooms will map and add the zone name to the db as well for the UID being stored.
This will be a manual process to change and add zone names but it beats having to write it down.

Still working on developing the code for it.

Another item I was looking at were shops, where after the shop lists the items, I saw the list encapsulated by ------
Have been watching this and thinking to filter and store between the dash link and format the items to another table. Further since the items and the respective fields, gold, level etc are tabbed, possibly filter for that. table will list the shopkeeper name and the items with the uid of the room.

Again probably rambling. But it is pretty awesome seeing your code in action, and opening my eyes to the awesome things I can try and achieve with mush.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #25 on Mon 27 Oct 2014 06:32 AM (UTC)

Amended on Mon 27 Oct 2014 06:33 AM (UTC) by Nick Gammon

Message
Sounds good. One of your admins (Taran) has been asking where the (plugin) code is kept, and I seem to keep missing him on the MUD.

Do you want to let him know, next time he is on, where the GitHub link is? Thanks.

- Nick Gammon

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

Posted by Crate   (9 posts)  Bio
Date Reply #26 on Mon 27 Oct 2014 07:38 PM (UTC)
Message
Definitely will do

Regarding the column area in the plugin
What does it do though since I'm not seeing it in the create tables function
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #27 on Mon 27 Oct 2014 08:44 PM (UTC)
Message
The "area" part of the room table does not exist in the database, hence I was just setting it to the MUD name.

That is the thing that gets displayed at the bottom of the mapper window.

You can, of course, add it to the database (do an ALTER TABLE if you already have lots of stuff there). Then you could populate room.area from the database area. Of course, you need to have a way of working out what area you are in.

- Nick Gammon

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

Posted by Nawaz   (1 post)  Bio
Date Reply #28 on Mon 03 Nov 2014 11:57 AM (UTC)
Message
Hey Nick,

I spoke to one of the mods recently about including the Room Numbers or something which would assist in room identifications, where he indicated this is something, they're looking at, possibly not the room numbers but something which could identify the rooms.

Actually thinking about it, I could probably recommend using a similar step as currently in the mapper where the room name and description are md5, instead, the server would md5 the rnum and room name and this id could be sent as the UID for the RName.

Nawaz
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #29 on Mon 03 Nov 2014 09:58 PM (UTC)
Message
Good idea. Doing an MD5 of the rnum would probably be enough, that allows for them changing the room name because of typos. Maybe they could include some secret "salt" to make it harder to reverse-engineer the rnums from the MD5.

eg.


id = md5 (rnum .. "somerandomphrase");

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


82,731 views.

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

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.