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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Michael Nelson
Novice


Joined: 03 Oct 2005
Posts: 36

PostPosted: Wed Dec 20, 2006 7:56 am   

Help porting a zmud script
 
Ok the script kind of works it finds the right ammount of rooms but doesn't return any data.

here it is

I didn't write the script so I am not 100% but I think I know what is going on. I tried making rs an adodb.recordset using %comcreate but I got the same results.

Thanx

#VARIABLE conn %comcreate( "ADODB.Connection")
#CALL @Conn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\CMUD\mud\mud.mdb")
#IF (@conn.ConnectionString ="") {
#SHOW "could not open connection to database"
#ABORT
}
#VARIABLE rs @conn.Execute( %concat( "SELECT * FROM ObjectTbl o, ZoneTbl z WHERE INSTR(1,o.name,'" ,%replace(%-1,"'","''"), "',0)=1 and o.zoneid = z.zoneid ORDER BY z.name ASC"))
#SHOW ------------------------------------------------------------
#SHOW {%ansi( white)Finding:%ansi( default) %-1}
#SHOW ------------------------------------------------------------
#SHOW {}
#IF (not @rs.BOF or not @rs.EOF) {
#CALL @rs.MoveFirst
Num_Records = 0
#WHILE (not @rs.eof) {
#MATH Num_Records @Num_Records+1
#SHOW %ansi( white)Area:%ansi( default) @rs("z.name") %ansi( white)Room:%ansi( default) @rs("o.name") %ansi( white)Speedwalk:%ansi( default) @rs("ObjID")
#CALL @rs.MoveNext
}
} {
#SHOW {" "%ansi( white)No Matches%ansi( default)}
Num_Records = 0
}
#CALL @rs.Close
#CALL @conn.Close
conn = ""
rs = ""
#SHOW {}
#SHOW ------------------------------------------------------------
#SHOW {%ansi( white)Rooms found:%ansi( default) @num_records}
#SHOW ------------------------------------------------------------
Reply with quote
Michael Nelson
Novice


Joined: 03 Oct 2005
Posts: 36

PostPosted: Wed Dec 20, 2006 11:55 am   
 
it seems I am having a similar problem as the pronub COMADO/SQL post. I tried changing to rs.fields("fieldname") syntax to no avail. I think there is a problem with the comobjects, I often do not hit an eof on them as well and get thrown into an infinite loop with this code
Reply with quote
Michael Nelson
Novice


Joined: 03 Oct 2005
Posts: 36

PostPosted: Wed Dec 20, 2006 12:38 pm   
 
I resolved this issue with a workaround although it does not fix the underlying problem. It seems that you can not access more than one field of rs on the same line. Therefore I put each value in a variable and then output the variables like so:
#VAR COMROOMNAME @rs.fields("o.name").value
#VAR COMAREANAME @rs.fields("z.name").value
#VAR COMROOMNUM @rs.fields("ObjID").value
#SHOW <COLOR WHITE>Room:</COLOR> @COMROOMNAME<COLOR WHITE> Area:</COLOR> @COMAREANAME<COLOR WHITE> Speedwalk:</COLOR> @COMROOMNUM
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion 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