cMud Map Importer

Share your scripts and packages with other Mudlet users.
Post Reply
User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

cMud Map Importer

Post by chris »

This will import your map into Mudlet (it only works on the newer files, which are dbm or sqlite3. There is a tool however on zuggsoft website to convert maps to this format)

This script will only import your map, it will not provide you with a functional mapper.

To run it:
Note
You no longer need to have the sql database for this script, all information is stored in RoomUserData.

For brand new users
1)Import the map - run cmud importmap. A file dialog will open up where you can select the map.
2) To localize yourself, you need to find assign your location via the centerview(id) command. You can find room ids via getRooms(), or use getAreaTable() followed by getAreaRooms(zone #) to get a list of rooms.

For prior users
If you've used this script already, I added a few commands that will update your map, allowing you to keep your mapping additions since you first imported the map.
cmud colorRooms -- This will color your rooms, but you must have the lua package 'bit' to use it. Lua doesn't support bitwise operations natively.
cmud addFavs -- This will import the name of your favorites into your map under the UserData "Favorites". Note you need to set up your own nesting scheme if you want to have cmud-like functionality with nested labels. If enough people want this, I can provide my script and nesting structure.
cmud labelZones -- Labels your zones (useful for those who are stuck with the labels who don't respect the Z axis)

You can purge the map should you screw up with this alias, note areanames aren't redone because in the import they'll be the same anyways: cmud purgedb.

Edit:
August 28, 2019:
Minor bugfix - fixed LuaSQL include and gave map labels a reasonable size
May 21, 2018:
Minor bugfix - fixed to work with Mudlet 3.0+
May 30, 2012:
Minor bugfix -- sometimes zone was imported as nil
Jan 3:
Cmud colors imported now.
July 17:
Updated so room scripts are imported and rooms exiting to zones can be labelled. Note the labels don't respect the z axis at the moment (mudlet doesn't support it), so a label in the first floor will appear on the 3rd.
Older edits:
Updated a bug in the room script and forgot to add in the room weight code.
Attachments
cMud Map Importer.xml
(13.63 KiB) Downloaded 1209 times
Last edited by chris on Sun Sep 11, 2011 5:40 pm, edited 9 times in total.

killergate
Posts: 4
Joined: Tue Feb 01, 2011 7:09 am

Re: cMud Map Importer

Post by killergate »

Hi,

Great, gonna try this. Any chance you're posting your mudlet/3k-mapper script too?

/kg

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: cMud Map Importer

Post by chris »

That'll be up in a day or 2. I want to use it a bit more first

User avatar
Vadi
Posts: 5048
Joined: Sat Mar 14, 2009 3:13 pm

Re: cMud Map Importer

Post by Vadi »

Do you need both the .sqlite3 and dbm files fo this? (initSql() is auto-run but you mention createmap() is necessary)

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: cMud Map Importer

Post by chris »

You only need your cmud map. The file ending is .dbm, however it is just a sqlite3 database. A new sqlite database is made to store the room descriptions and room scripts. makeSqlDB() should make the database, I think I left out that step

User avatar
Vadi
Posts: 5048
Joined: Sat Mar 14, 2009 3:13 pm

Re: cMud Map Importer

Post by Vadi »

I'd like to update this script so it'll ask the user with the file picker dialog if it doens't know where the map is, and otherwise auto-load it. Mind listing the steps it should do after the filepath is obtained?

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: cMud Map Importer

Post by chris »

All the steps are in createmap(). The two steps that need to be done to make it accessible from a file picker:
line 94, local file = getMudletHomeDir().."/3kingdoms.dbm"
basically have that variable redirect to the database the user chooses

There user also needs to create a sqlite databse to store room descriptions and room scripts. The function which inserts this information is found here:
line 36 in initSql(), local file = getMudletHomeDir().."/3kingdoms.sqlite3"
Have that prompt the user interface to set the variable.

Then whenl makeSqlDB() is called, that prompt will be brought up. If you give me the syntax to prompt a file dialog I'll just do it and resubmit.

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: cMud Map Importer

Post by chris »

I figured it out, just need to do
local file = invokeFileDialog(true, "Select your cMud Map")

Is there a way to get the user's profile? For the desc/roomdesc file that needs to be constant, something the user will not have to redefine. I figure the user profiler's name would serve well.

User avatar
Vadi
Posts: 5048
Joined: Sat Mar 14, 2009 3:13 pm

Re: cMud Map Importer

Post by Vadi »

can cut it off getMudletHomeDir()

User avatar
chris
Posts: 493
Joined: Fri Jun 17, 2011 5:39 am

Re: cMud Map Importer

Post by chris »

Updated it, it now does pretty much autopilot. Updated information/script in my post

Post Reply