Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jul 12, 2003 11:55 pm   

Extract area from mapper into area file
 
Here are a few scripts to extract an area stored in the map database into an area file of a specific format. The area files produced by the script should be compatible with the original area format of the specified codebase.

The only format available right now is for Merc 2.0+/Envy. More will be added soon and by request.

Merc 2.0+/Envy (should also work with other derivatives that use the same area format):
#CLASS {AreaCreator}
#ALIAS makeMerc20Area {
#VARIABLE Conn %comcreate( "ADODB.Connection")
#CALL @Conn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%-1")
#PROMPT zoneName "Enter the name of the zone to extract."
#PROMPT fileName "Enter the name of the area file."
#PROMPT zoneDesc "Enter the zone's description string."
#EXECUTE %concat( "#VARIABLE Rooms @Conn.Execute( ", %char( 34), "SELECT ObjID,ObjectTbl.Name,ObjectTbl.Desc,RefNum,UserStr,UserInt FROM ObjectTbl INNER JOIN ZoneTbl ON ObjectTbl.ZoneID = ZoneTbl.ZoneID WHERE ZoneTbl.Name = '", @zoneName, "'", %char( 34), ")")
#SAY Extracting area...
#FILE 1 @fileName
#GAG
#WRITE 1 %concat( "#AREA ", @zoneDesc, %char( 126))
#WRITE 1 ""
#WRITE 1 "#MOBILES"
#WRITE 1 "#0"
#WRITE 1 ""
#WRITE 1 "#OBJECTS"
#WRITE 1 "#0"
#WRITE 1 ""
#WRITE 1 "#ROOMS"
#CALL @Rooms.MoveFirst
#WHILE (not @Rooms.eof) {
#WRITE 1 %concat( "#", @Rooms("RefNum"))
#WRITE 1 %concat( @Rooms("Name"), %char( 126))
#WRITE 1 %concat( @Rooms("Desc"), %char( 126))
#WRITE 1 %concat( "0 ", %eval( @Rooms("UserStr") + 0), " ", @Rooms("UserInt"))
#EXECUTE %concat( "#VARIABLE Exits @Conn.Execute( ", %char( 34), "SELECT ToID,DirType FROM ExitTbl WHERE ExitTbl.FromID = ", @Rooms("ObjID"), %char( 34), ")")
#CALL @Exits.MoveFirst
#WHILE (not @Exits.eof) {
#WRITE 1 %concat( "D", %item( "0|6|1|6|2|6|3|6|4|5", %eval( @Exits("DirType") + 1)))
#WRITE 1 %char( 126)
#WRITE 1 %char( 126)
#EXECUTE %concat( "#VARIABLE vNUM @Conn.Execute( ", %char( 34), "SELECT RefNum FROM ObjectTbl WHERE ObjID = ", @Exits("ToID"), %char( 34), ")")
#WRITE 1 %concat( "0 0 ", @vNUM("RefNum"))
#CALL @Exits.MoveNext
}
#WRITE 1 "S"
#CALL @Rooms.MoveNext
}
#WRITE 1 "#0"
#WRITE 1 ""
#WRITE 1 "#RESETS"
#WRITE 1 "S"
#WRITE 1 ""
#WRITE 1 "#$"
#CLOSE 1
#GAG
#SAY Area extracted.
}
#CLASS 0

Usage:
makeMerc20Area filename

where filename is the name of the map database file.

Notes:
1. The current working directory for filename will be zMUD's folder
2. 1 is also true for the area file created
3. The room flags are taken from the user defined string for that room (for more information on how to set this by code ask in the General Forum if it has not already been answered)
4. Since the string containing the room flags is evaluated, the flags can be written as a sum such as 1 + 8 + 512
5. The sector type for the room is taken from the user defined integer for that room (for more information on how to set this by code ask in the General Forum if it has not already been answered)
6. For an idea of the script's speed, I extracted 292 rooms in about 16 seconds.

To use the room ID as the vNum of each room change:
#WRITE 1 %concat( "#", @Rooms("RefNum"))

to:
#WRITE 1 %concat( "#", @Rooms("ObjID"))

delete:
#EXECUTE %concat( "#VARIABLE vNUM @Conn.Execute( ", %char( 34), "SELECT RefNum FROM ObjectTbl WHERE ObjID = ", @Exits("ToID"), %char( 34), ")")

and change:
#WRITE 1 %concat( "0 0 ", @vNUM("RefNum"))

to:
#WRITE 1 %concat( "0 0 ", @Exits("ToID"))
Reply with quote
D_Master
Beginner


Joined: 05 Jun 2003
Posts: 17

PostPosted: Sun Jul 13, 2003 4:06 pm   
 
hum...All I seem to get when exporting is this:

#AREA the docks of Freemont~

#MOBILES
#0

#OBJECTS
#0

#ROOMS
#0

#RESETS
S

#$

No rooms. Any ideas what this could be caused by?

Also posted this in the Export script topic. Sorry for the double posting but thought it might be good here too.
Reply with quote
D_Master
Beginner


Joined: 05 Jun 2003
Posts: 17

PostPosted: Mon Jul 14, 2003 3:52 am   
 
ok...got it to work. Looks like I was misspelling one of the zones. But I did notice that it wasn't linking some of the rooms correctly. Not sure why. But everything else was great! Thanks for the awsome script!
Reply with quote
buffy_m_50
Newbie


Joined: 10 Aug 2005
Posts: 8

PostPosted: Wed Aug 10, 2005 10:25 pm   
 
Hi there!
well i got this working but it's posible to a rom2.4 format version of this?
thx


p.d: bad english :P
Reply with quote
Orang
Apprentice


Joined: 22 Jul 2004
Posts: 118
Location: USA

PostPosted: Fri Aug 12, 2005 4:05 pm   
 
whats Merc and Envy and how do i get them?
Reply with quote
Warpnow
Newbie


Joined: 19 Nov 2005
Posts: 5

PostPosted: Sat Nov 19, 2005 7:05 pm   
 
They are mud cores. Many games you will play if you mud alot are Merc/Diku/Rom descendants.
Reply with quote
krohnu
Beginner


Joined: 09 Mar 2003
Posts: 28

PostPosted: Fri Feb 03, 2006 8:34 am   
 
any chance on doing the reverse?
Reply with quote
bjthomps
Newbie


Joined: 14 Apr 2006
Posts: 3

PostPosted: Fri Apr 14, 2006 3:33 pm   Reverse in Rom 2.4 format?
 
Any chance you have the reverse, for reading an area file in and creating a zMud map, from a Rom 2.4 area file??

Very Happy
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net