About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
RobAMacAF
Beginner


Joined: 24 Nov 2005
Posts: 19

PostPosted: Sun Oct 08, 2006 4:52 am   

Need help with a ZMUD -> CMUD Script
 
I would REALLY like to move to CMUD but I have a script for ZMUD that I rely on to help create our MUD. The problem being is I am having trouble converting it to CMUD and have tried for over 3 hours to do it. Usually it just makes an endless loop in CMUD and I have to CTRL+ALT+DELETE.

If anyone can help it would be AWSOME! The scipt gets information from the rooms in the ZMUD map database and exports it as a txt file

#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>", "&lt;IMG /&gt;&lt;BEHAVES /&gt;&lt;AFFECS /&gt;", "</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.
Reply with quote
edb6377
Magician


Joined: 29 Nov 2005
Posts: 482

PostPosted: Sun Oct 08, 2006 5:00 am   
 
well i only see a couple places for your loops.. try commenting/temporarily removing out your whiles and see which one is causing you trouble. I dont have time to test it right now but thats the first thing that comes to mind
_________________
Confucious say "Bugs in Programs need Hammer"
Reply with quote
RobAMacAF
Beginner


Joined: 24 Nov 2005
Posts: 19

PostPosted: Sun Oct 08, 2006 5:44 am   
 
Looking at it, it seems that this...

#VAR Conn %comcreate( "ADODB.Connection")
#CALL @Conn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%-1")

No longer stores the varible Conn right. At least in the variable browser it is blank

Guess that is the first step is fixing it...

this is the output of the script as is right now...


<AREA>
<ACLAS>StdArea</ACLAS>
<ANAME>Axsonia</ANAME>
<ADESC>test</ADESC>
<ACLIM>5</ACLIM>
<ASUBS>Etias</ASUBS>
<ATECH>0</ATECH>
<ADATA><ARCHP /><PARENTS /><CHILDREN /><IMG /><BEHAVES><BHAVE>
<BCLASS></BCLASS><BPARMS /></BHAVE></BEHAVES><AFFECS />
<AUTHOR/></ADATA>
<AROOMS>
<AROOM>
<ROOMID>Axsonia#(RefNum)</ROOMID>
<RAREA>Axsonia</RAREA>
<RCLAS>stoneroom</RCLAS>
<RDISP>(Name)</RDISP>
<RDESC>(Desc)</RDESC>
<RTEXT>&lt;IMG /&gt;&lt;BEHAVES /&gt;&lt;AFFECS /&gt;</RTEXT>
<ROOMEXITS>
<REXIT><XDIRE>0</XDIRE>
<XDOOR>Axsonia#(RefNum)</XDOOR>
<XEXIT><EXID>StdOpenDoorway</EXID><EXDAT /></XEXIT>
</REXIT>
<REXIT><XDIRE>0</XDIRE>
<XDOOR>Axsonia#(RefNum)</XDOOR>
<XEXIT><EXID>StdOpenDoorway</EXID><EXDAT /></XEXIT>
</REXIT>


But then it repeats

<REXIT><XDIRE>0</XDIRE>
<XDOOR>Axsonia#(RefNum)</XDOOR>
<XEXIT><EXID>StdOpenDoorway</EXID><EXDAT /></XEXIT>
</REXIT>

over and over and over again..

Instead of (RefNum) it should return the ref number, Instead of (Name) it should return the name and instead of (Description) it should return the description, etc....

I have the code minimized to this...

#VAR Conn %comcreate( "ADODB.Connection")
#CALL @Conn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\CMud\VeilsOfMist\VeilsOfMist.mdb")
#VARIABLE Rooms @Conn.Execute( "SELECT ObjID,ObjectTbl.Name,ObjectTbl.Desc,RefNum,UserStr,UserInt FROM ObjectTbl INNER JOIN ZoneTbl ON ObjectTbl.ZoneID = ZoneTbl.ZoneID WHERE ZoneTbl.Name = 'Axsonia'")
#CALL @Rooms.MoveFirst
#SAY %concat( "<RDISP>", @Rooms("Name"), "</RDISP>")
#CLOSE 1


It SHOULD open up my map database (veilsofmist.mdb) and bring out some of the information about the zone (Axsonia). Then move to the first room and print out the name of it.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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