|
Hawkstarr Beginner
Joined: 16 Aug 2005 Posts: 10
|
Posted: Thu Jan 08, 2009 2:07 pm
Correct way to access map database (.dbm)? |
Good morning folks!
Been looking around the forums this morning and last night, trying to figure out what the correct way is to access the map database now. I understand that the COM functions have gone away as of 3.0, (using 3.03a myself). and the new %mapquery function has been added.
My dilemma is that I need to export all the rooms in an area into a specific XML format, but I'm thinking that a %mapfilter loop with something like:
Code: |
#CALL %mapfilter(%concat("ZoneID = ",@ZoneName))
#LOOP %numrooms {
#WRITE 1 "<AROOM>"
#WRITE 1 %concat( "<ROOMID>", @zonename, "#", %roomnum(%mapvnum(%i)), "</ROOMID>")
#WRITE 1 %concat( "<RAREA>", @zonename, "</RAREA>")
#WRITE 1 %concat( "<RDISP>", %roomname(%mapvnum(%i)), "</RDISP>")
#WRITE 1 %concat( "<RDESC>", %roomdesc(%mapvnum(%i)), "</RDESC>")
etc....
} |
This looks to me like the correct way to do it, but I thought that I would ask before running around in circles for a few days. Second question would be is this the BEST way to do it? I'll post the old script if someone would like to take a peek, just ask. Thanks! |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Jan 08, 2009 5:09 pm |
%mapquery is not new, it existed even under zmud.
The general method you propose looks fine, but I have not examined the exact logic to see whether there are bugs in it. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Thu Jan 08, 2009 5:44 pm |
Quote: |
I understand that the COM functions have gone away as of 3.0 |
Not sure what you mean by that. COM functions haven't gone away. You just can't use MDAC/ADO database stuff to access it anymore since the database is SQLite now.
But if you have CMUDPro or zMapper, you can still use the various %map COM functions to loop through rooms and get their various properties.
However, your above code looks fine and will work on both the old 2.x mapper as well as the new mapper, so it's probably better code to use. Doing low-level raw database access isn't really recommended.
Future 3.x versions will have some SQLite database functions that will let you get to the low-level database details. But I think you are better off continuing with the example that you showed using the higher-level CMUD %roomXXX functions. |
|
|
|
Hawkstarr Beginner
Joined: 16 Aug 2005 Posts: 10
|
Posted: Thu Jan 08, 2009 7:24 pm |
Ahh. I was under the impression from reading a few of the treads that the COM functions were going away. If that's not the case no biggie, just was more wondering what the best method should be.
I can work out the exact logic with some time, but wanted to more or less make sure I was on the right track.
Thank you! |
|
|
|
|
|
|
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
|
|