|
Aidan88 Beginner
Joined: 18 May 2009 Posts: 11
|
Posted: Mon May 18, 2009 10:57 pm
Mapper ADO Query |
Hi Guys,
This is my first post here! Thought I've been stalking around for years
I have a Medium Sized map (Around 1500 rooms or so) which I use various scripts to aid me in mapping. Since I use a custom scale and grid I also have to use a script for creating rooms instead of simply using #makeroom. Since I'm not willing to risk losing any settings yet and I'm not au fait with Lua (though I'd be willing to use VB/Jscript) I'm currently using the lovely ADO interface to connect directly to my mapper database and edit the map there. The problems are many:
1) The map doesn't update after editing the rooms. I can force this by #teleporting or doing something similar but this causes problem 2)
2) If I don't leave enough time after calling @rs.Update (around 5000ms, far too long) by using a #wait directly after calling the command then for some reason the new changes don't get implemented. I suspect that the script and CmudPro are fighting over the database or because the call is so slow it gets cancelled if I call anything else.
Anyway I was wondering if anybody had any sensible solutions that don't involve not using ADO unless there is a much better, simpler way to do it (LuaSQL maybe?)
here is the code in question:
#LOCAL $xyvalues; #LOCAL $room_x; #LOCAL $room_y
$room_x=@room_x; $room_y=@room_y
#SWITCH ($direction="north") {$room_y=($room_y-440)}
...($direction=”northeast“) {$room_y=$room_y-440;$room_x=$room_x+440}
...($direction=”east“) {$room_x=$room_x+440}
...($direction=”southeast“) {$room_y=$room_y+440;$room_x=$room_x+440}
...($direction=”south“) {$room_y=$room_y+440}
...($direction=”southwest“) {$room_y=$room_y+440;$room_x=$room_x-440}
...($direction=”west“) {$room_x=$room_x-440}
...($direction=”northwest“) {$room_y=$room_y-440;$room_x=$room_x-440}
{#SAY ”ERROR“;#EXIT}
current_room_vnum=%roomvnum()
#MAKEROOM $direction
#WAIT 100
new_room_vnum=%roomvnum()
query = %concat(”SELECT * FROM ObjectTbl WHERE ([ObjId] = “,@new_room_vnum,”)“)
//STANDARD CONNECTION
#VAR rs %comcreate( ”ADODB.Recordset“)
#CALL @rs.Open( @query, ”mapper“, 2, 2)
#VAR Fields @rs.Fields
//STANDARD CONNECTION
#VAR rs(”LabelDir“).Value 4
#VAR rs(”X“).Value $room_x
#VAR rs(”Y“).Value $room_y
#VAR rs(”Dx“).Value 264
#VAR rs(”Dy“).Value 264
#CALL @rs.Update
#WAIT 5000 <---------------IF THIS VALUE < ~5000 THE SCRIPT DOES NOT WORK
#ECHO @checkupdate()
//STANDARD CONNECTION CLOSE
#CALL @rs.close
#VAR rs ”“
#VAR Fields ”“
//STANDARD CONNECTION CLOSE
A snippet online: http://snippets.symfony-project.org/snippet/338 |
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Tue May 19, 2009 12:24 am |
hmm well, unfortunately that won't work for very long. The Cmud Beta has converted from the ado database format to the SQLITE format.
Secondly Directly editing the map file could be considered dangerous.
If you end the map file and then the mapper edits it with out checking to see that you've changed some value, could lead to corruption.
I think you'ld be best served by using cmud pro with the additional mapping functions. That way should be able to edit the map without directly editing the map file. |
|
_________________ "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
|
|