|
Hawkstarr Beginner
Joined: 16 Aug 2005 Posts: 10
|
Posted: Tue Aug 16, 2005 8:18 pm
Exporting a color from the mapper. |
ok. I just posted this script in the completed scripts section for the CoffeeMud Codebase, the base was written a looong time ago for me (by Kjata), and I have since converted it for the current system I am working with.
Code: |
#CLASS {AreaCreator}
#ALIAS makecmArea {
#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."
#PROMPT SYSOPPS "Sysopp's name for this area?"
#Prompt Dlocal "What is the default locale?"
#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 "<AREA>"
#WRITE 1 "<ACLAS>StdArea</ACLAS>"
#WRITE 1 %concat( "<ANAME>", @zoneNAME, "</ANAME>")
#Write 1 %concat( "<ADESC>", @zoneDesc, "</ADESC>")
#WRITE 1 "<ACLIM>5</ACLIM>"
#WRITE 1 %concat( "<ASUBS>", @SYSOPPS, "</ASUBS>")
#WRITE 1 "<ATECH>0</ATECH>"
#WRITE 1 "<ADATA><ARCHP /><PARENTS /><CHILDREN /><IMG /><BEHAVES><BHAVE>"
#WRITE 1 "<BCLASS></BCLASS><BPARMS /></BHAVE></BEHAVES><AFFECS />"
#WRITE 1 "<AUTHOR/></ADATA>"
#WRITE 1 "<AROOMS>"
#CALL @Rooms.MoveFirst
#WHILE (not @Rooms.eof) {
#WRITE 1 "<AROOM>"
#WRITE 1 %concat( "<ROOMID>", @zonename, "#", @Rooms("RefNum"), "</ROOMID>")
#WRITE 1 %concat( "<RAREA>", @zonename, "</RAREA>")
#WRITE 1 %concat( "<RCLAS>", @dlocal, "</RCLAS>")
#WRITE 1 %concat( "<RDISP>", @Rooms("Name"), "</RDISP>")
#WRITE 1 %concat( "<RDESC>", @Rooms("Desc"), "</RDESC>")
#WRITE 1 %concat( "<RTEXT>", "<IMG />", "<BEHAVES />", "<AFFECS />", "</RTEXT>")
#WRITE 1 "<ROOMEXITS>"
#CALL @Exits.MoveFirst
#EXECUTE %concat( "#VARIABLE Exits @Conn.Execute( ", %char( 34), "SELECT ToID,DirType FROM ExitTbl WHERE ExitTbl.FromID = ", @Rooms("ObjID"), %char( 34), ")")
#WHILE (not @Exits.eof) {
#WRITE 1 %concat( "<REXIT>", "<XDIRE>", %item( "0|7|2|9|1|10|3|8|4|5", %eval( @Exits("DirType") + 1)), "</XDIRE>")
#EXECUTE %concat( "#VARIABLE vNUM @Conn.Execute( ", %char( 34), "SELECT RefNum FROM ObjectTbl WHERE ObjID = ", @Exits("ToID"), %char( 34), ")")
#WRITE 1 %concat( "<XDOOR>", @zonename, "#", @vNUM("RefNum"), "</XDOOR>")
#WRITE 1 %concat( "<XEXIT>", "<EXID>", "StdOpenDoorway", "</EXID>", "<EXDAT />", "</XEXIT>")
#WRITE 1 "</REXIT>"
#CALL @Exits.MoveNext
}
#WRITE 1 %concat( "</ROOMEXITS>", "<ROOMCONTENT>", "<ROOMMOBS />", "<ROOMITEMS />", "</ROOMCONTENT>")
#CALL @Rooms.MoveNext
#WRITE 1 "</AROOM>"
}
#WRITE 1 "</AROOMS>"
#WRITE 1 "</AREA>"
#CLOSE 1
#GAG
#SAY Area extracted.
To call it:
makeCMarea [i]pathtomapfile[/i] |
What I would like to do now is also grab the room's color so that I can translate it to a room type. (ex. green=forest etc.) Now the problem that I see is that looking at the Access database file, I can't make any sense of how Zmud translates a RGB color code to the COLOR field in access.
For example, the default gray color on the room in the mapper shows up as 536870911 in Access. Any thoughts on how I could do this? Or is there a totally easier way that I am overlooking?
edit:
Quick thing that I did forget to mention. People that would be using this would have some custom colors from the default that would be exported. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Aug 16, 2005 9:28 pm |
The colors are stored in the decimal equivalents for a 24bit RGB code. If I recall the format is actually BGR for faster display with windows. Since I have no idea what sort of colors you have used with the mapper I would suggest making a conversion table from the %colorname function, as it will produce the same numbers used for storing the colors. A name of "default" is valid for the default coloring, if you have changed the default color of map rooms then only the display of the rooms is affected and not the value assigned to the rooms.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Hawkstarr Beginner
Joined: 16 Aug 2005 Posts: 10
|
Posted: Wed Aug 17, 2005 1:41 am |
Ouch... I was afraid someone was going to say that. That was my orgional plan and I was hoping there was going to be an easier way. But thank you for the information!
|
|
|
|
|
|
|
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
|
|