|
Sir1l Wanderer
Joined: 01 Oct 2005 Posts: 54
|
Posted: Thu Dec 29, 2005 12:26 am
Deleting Rooms |
Is there anyway to delete all rooms from a map and just have the zone names left?
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Dec 29, 2005 8:52 am |
The only easy way I can think to do this would be with a database editor. You might be able to set up an SQL query to delete them, but you will have to delete the contents of both the ObjTbl and ExitsTbl.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
Dodgester Wanderer
Joined: 17 Nov 2005 Posts: 65
|
Posted: Wed Jan 04, 2006 5:03 am |
The map file is a MDB file, which is very accessible via MS Access. The easiest way that I would be able to do this is to create code for it, which I have done that, but have not tested it out, so be sure to create a backup copy and then you can apply the following code to it. This code is used within a standard module via the Visual Basic Editor of MS Access, and doesn't matter what version between 97 and 2003 as it's written using Access default language of DAO.
Code: |
Option Compare Database
Sub ClearZone()
Dim strZON As String, drsEXT As Recordset, drsOBJ As Recordset
strZON = InputBox("What is the name of the zone?")
Set drsOBJ = CurrentDb.OpenRecordset("SELECT ObjectTbl.* " & _
"FROM ZoneTbl INNER JOIN ObjectTbl On ZoneTbl.ZoneID = ObjectTbl.ZoneID " & _
"WHERE ZoneTbl.Name = '" & strZON & "';", dbOpenDynaset, dbSeeChanges, dbOptimistic)
If drsOBJ.RecordCount > 0 Then
While drsOBJ.EOF = False
drsOBJ.MoveFirst
Set drsEXT = CurrentDb.OpenRecordset("SELECT ExitTbl.* " & _
"FROM ObjectTbl INNER JOIN ExitTbl On ObjectTbl.ObjID = ExitTbl.FromID " & _
"WHERE ExitTbl.FromID = " & drsOBJ.Fields("ObjID").Value, _
dbOpenDynaset, dbSeeChanges, dbOptimistic)
If drsEXT.RecordCount > 0 Then
drsEXT.MoveFirst
While drsEXT.EOF = False
drsEXT.Delete
drsEXT.MoveNext
Wend
End If
drsEXT.Close
Set drsEXT = CurrentDb.OpenRecordset("SELECT ExitTbl.* " & _
"FROM ObjectTbl INNER JOIN ExitTbl On ObjectTbl.ObjID = ExitTbl.ToID " & _
"WHERE ExitTbl.FromID = " & drsOBJ.Fields("ObjID").Value, _
dbOpenDynaset, dbSeeChanges, dbOptimistic)
If drsEXT.RecordCount > 0 Then
drsEXT.MoveFirst
While drsEXT.EOF = False
drsEXT.Delete
drsEXT.MoveNext
Wend
End If
drsEXT.Close
drsOBJ.Delete
drsOBJ.MoveNext
Wend
Else
MsgBox "Either this zone name doesn't exist, or there are no rooms within this zone.", 48
End If
drsOBJ.Close
End Sub |
|
|
|
|
|
|
|
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
|
|