|
tciecka Newbie
Joined: 03 Dec 2008 Posts: 1
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Wed Oct 19, 2011 5:39 pm |
You are correct that there is no built-in export function currently in Cmud. This is an anticipated feature for future development.
In the meantime, it should be possible to develop a script to do the equivalent, but it will be difficult without CmudPro. I have not heard of anyone who has done it yet. The script I concieve would make a list (probably using %mapquery) of room numbers to be exported. The script would then loop through the list using %roomname, %roomdesc, %roomflag, etc. to grab the information you want to export. From this, it generates Cmud commands to re-create the rooms, using the same functions plus #MAKEROOM. It would append each command to an external file as it generates the command. The script would then loop through the room list again, using %roomlink to generate commands to recreate the exits. This part gets trickier; if the linked room is not in the list of exported rooms, the script must change the link to -2 (unknown link). You may also need some code to ensure that you don't get duplicate exits. If you have non-standard exits, you will also have to generate %roomportal commands. When completed, the end-user can import and execute the script to generate the rooms (it will probably take a while!).
One problem is that there is no way to use a script to create new zones. If you have multiple zones, or want the new rooms placed in a different zone than an already existing zone when imported, you will have to create the new zone(s) manually before importing the script. The import script could include %roomzone functions to set the zone numbers for the new rooms.
Another problem is setting X, Y, and Z coordinates for the new rooms. There is currently no Cmud function to get or set that data on the map db (I have requested this as a new feature). If you have CmudPro, you can get and set these values using the COM interface. If you don't have CmudPro but do have Zmapper, you can also use the COM interface. If you or your end-user don't have either CmudPro or Zmapper, then you will have some difficulty making the new map look like the original. You could probably make an approximation by systematically making each room (with #MAKEROOM) next to one which has already been made, guessing the direction based on the direction of the exit connecting them. With non-standard directions or connected rooms which are not next to each other on the map, the new map will start diverging in appearance, but should still retain the connectivity of the original. There are also other map fields besides X, Y, and Z which cannot be accessed without the COM interface, such as room borders and shapes, but most maps won't make use of those map features. |
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Wed Oct 19, 2011 6:09 pm |
At one point probably 2 or 3 years ago, I created a lua script using luasqlite to open 2 map files and copy a zone from one file to the other, it generated new room numbers, link numbers, checked for valid zone names ect. If I recall correctly the only problems I had was I had to use the script in a separate session where NEITHER map was open, as well as some problems with the metadata that is used for certain custom rooms, bent links among other things. If i were to try this now I'ld use #sql which has sqlite compatability cmud/cmudpro and export the information in a json datarecord, then that record, which would be rather large, but a simple text file could be emailed and re-imported to someone elses map.
Rahab's method is a MUCH safer method, but will not do a perfect copy, there are several values in the database which do not have functions to retrieve the information. The approach I took requires a more advanced knowledge of SQL, data manipulation, and a near perfect understanding of the database format. |
|
_________________ "To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle |
|
|
|
|
|
|
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
|
|