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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Tue Mar 16, 2004 11:31 am   

howto Clear all room descriptions from map db?
 
How would I go about Clearing all room descriptions from my entire map db easily... my db has over 5,000 rooms. I have been searching and found delkey, i didnt really see how to use it effectivly in the help though :(

Thanks for any help I can get :)

Smok
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Tue Mar 16, 2004 3:30 pm   
 
Ok Lets try something like this *warning untested and without zmud in front of me so make a backup first* my commands might be backwards

#call %mapmode(1)
#call %maplocked(0)
#loop %numrooms {#call %roomdesc(%i, "")}
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Wed Mar 17, 2004 12:32 am   
 
This should also work, connecting to the map database via ADO to do its work. Make sure you change the MapDatabase variable to reflect where and what the name of your map database is before entering it into zMUD. This has the advantage of being very, very fast. Compacting the database (File, Compact map database) afterwards should make it much smaller than it was originally and remove any trace of the descriptions that might still be stored in the file.

#VARIABLE MapDatabase "C:zMUDmap.mdb"
#VARIABLE Connection %comcreate( "ADODB.Connection")
#CALL @Connection.Open(%concat("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=", @MapDatabase))
#VARIABLE Recordset @Connection.Execute("UPDATE ObjectTbl SET [Desc] = ''")
#CALL @Recordset.Close
#VARIABLE Recordset %null
#VARIABLE Connection %null
#SAY Done.
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Thu Mar 18, 2004 7:54 pm   
 
Charbal I like the way yours looks BUT, it gives me an error:

Error parsing command:
Operation is not allowed when the object is closed

Does anyone know how to fix this problemo??

Thanks for the helps zMUD mASTERS
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Thu Mar 18, 2004 9:19 pm   
 
Ah... okay, I shuld have removed the #CALL @Recordset.Close line from it. Here it is without that:

#VARIABLE MapDatabase "C:zMUDmap.mdb"
#VARIABLE Connection %comcreate( "ADODB.Connection")
#CALL @Connection.Open(%concat("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=", @MapDatabase))
#VARIABLE Recordset @Connection.Execute("UPDATE ObjectTbl SET [Desc] = ''")
#VARIABLE Recordset %null
#VARIABLE Connection %null
#SAY Done.
Reply with quote
Smokabul
Novice


Joined: 27 Sep 2002
Posts: 37
Location: USA

PostPosted: Thu Mar 18, 2004 9:31 pm   
 
Man that worked good and quickly.

You da man Charbal.

Thanx
Reply with quote
xekon
Apprentice


Joined: 11 Oct 2007
Posts: 154

PostPosted: Sun Jun 07, 2009 9:25 pm   
 
I should be able to modify this to Clear all: Notes, Room Script, Walk Script, Contents, User defined string, Script Parameters

I am not sure what the field names are internally in the map database though, could anyone help me here? I would like to clean up my map file.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Jul 09, 2009 1:25 am   
 
Got this about a year ago or so when i asked for it
Code:
#ALIAS clearrooms {#VAR rs %comcreate( "ADODB.Recordset");#var cs "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\zMUD\realmap.mdb";#var sql "UPDATE ObjectTbl SET ObjectTbl.Desc = ''";#CALL @rs.Open( @sql, @cs)} "MapWipe"
#VAR cs {Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\zMUD\realmap.mdb} {_nodef} "MapWipe"
#VAR rs {<OLE object: ADODB.Recordset>} {_nodef} "MapWipe"
#VAR sql {UPDATE ObjectTbl SET ObjectTbl.Desc = ''} {_nodef} "MapWipe"

Putting BOOOOOYAH in the note, room/walk script sections, User String and Script Parameters and opening up the Map in Access and searching, I can only guess that:

Notes = NoteTbl.Note

Room Script & Walk Script = ObjectTbl.Script (one thing, all of the lines in that column say All (with that square that won't display on here) I don't know if that causes a problem if removed. I opened the map and checked the room and i didn't see anything different. Why the are listed together rather than in thier own sections i also don't know)

Contents = ObjectTbl.Content (Content comes from a database from what I could tell, so I don't know if this will work or not. I actually typed BOOOOYAH in the field itself in Access, and when i opened the map in Zmud the word was there, so maybe it will work)

User defined string = ObjectTbl.UserStr

Script Parameters = ObjectTbl.Param

And if you're really anal

Mouseover Hint = ObjectTbl.Hint

Short Name = ObjectTbl.IDName

Can I say this script will work?
Code:
#ALIAS clearrooms {
#VAR rs %comcreate( "ADODB.Recordset")
#var cs "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\zMUD\realmap.mdb"
#var sql "UPDATE ObjectTbl SET ObjectTbl.Desc = ''"
#CALL @rs.Open( @sql, @cs)
#var sql "UPDATE ObjectTbl SET NoteTbl.Note = ''"
#CALL @rs.Open( @sql, @cs)
#var sql "UPDATE ObjectTbl SET ObjectTbl.Script = ''"
#CALL @rs.Open( @sql, @cs)
#var sql "UPDATE ObjectTbl SET ObjectTbl.UserStr = ''"
#CALL @rs.Open( @sql, @cs)
#var sql "UPDATE ObjectTbl SET ObjectTbl.Content = ''"
#CALL @rs.Open( @sql, @cs)
#var sql "UPDATE ObjectTbl SET ObjectTbl.Param = ''"
#CALL @rs.Open( @sql, @cs)
#var sql "UPDATE ObjectTbl SET ObjectTbl.Hint = ''"
#CALL @rs.Open( @sql, @cs)
#var sql "UPDATE ObjectTbl SET ObjectTbl.IDName = ''"
#CALL @rs.Open( @sql, @cs)
} "MapWipe"
#VAR cs {Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\zMUD\realmap.mdb} {_nodef} "MapWipe"
#VAR rs {<OLE object: ADODB.Recordset>} {_nodef} "MapWipe"
#VAR sql {UPDATE ObjectTbl SET ObjectTbl.Desc = ''} {_nodef} "MapWipe"

Nope, dunno. Might need to make seperate aliases for each of them. I know that it takes about a minute just to clear the room descs when i get an updated map for Aardwolf. of course it makes the file about 15MB smaller so i can't complain
But make a backup of your map file, give it a shot, and pray smoke don't come out of the CPU[/code] Wink Wink
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Jul 09, 2009 1:46 am   
 
ok, tested it, and it throws an error pop up box saying:
Error parsing command:
No value given for one or more required parameters
clearrooms2

Not sure why, but prolly cause it's trying to do to much at once.
Separate alias for each might be the way to go.
_________________
http://www.Aardwolf.com
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Jul 09, 2009 1:51 am   
 
WHOOPS

#var sql "UPDATE ObjectTbl SET NoteTbl.Note = ''"

SHOULD BE

#var sql "UPDATE NoteTbl SET NoteTbl.Note = ''"
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Jul 09, 2009 1:57 am   
 
Ok, it works :-)
ODDLY deleting ALL of that info actually INCREASED my file size by 300KB
Compacting did nothing.

I had a load of notes but the other stuff was sprinkled around.
Not sure why the file size got bigger, but i compressed it with the map compression and compressed it in Access as well.
But went from 19,780KB to 20,008KB
_________________
http://www.Aardwolf.com
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Thu Jul 09, 2009 3:59 am   
 
I'd guess because your indices are still saved to prevent corruption, the allocations are still there but they're just working as placeholders now.
Reply with quote
Vitae
Enchanter


Joined: 17 Jun 2005
Posts: 673
Location: New York

PostPosted: Thu Jul 09, 2009 4:50 am   
 
But given that i lose 15MB when removing the room descs, why would i gain when removing Notes?
either way, the gain is minor Mr. Green
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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