|
jsmith Newbie
Joined: 03 Aug 2006 Posts: 7
|
Posted: Thu Aug 03, 2006 7:48 am
Help with Find Room |
I have maps stored in the automapper and am using the 'find room' feature fairly often, but pressing CTRL-m takes quite a while to bring up the automapper on my system.
I am looking for a script that would allow me to search for rooms from the command prompt and have the zone it is located in outputed to my mud window.
Also does anyone know how to export the room and zone names together in a text file. I have zmapper, but am only able to export 'zone id' and 'room names' together, not 'zone names' and 'room names'.
I have tried searching the forums, but have not had any luck.
thanks in advance
JS |
|
|
|
jsmith Newbie
Joined: 03 Aug 2006 Posts: 7
|
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Thu Aug 03, 2006 3:04 pm |
Why don't you leave the automapper open, but either dock it or hide it behind your MUD window?
|
|
_________________ Kjata |
|
|
|
saet Apprentice
Joined: 12 Jun 2006 Posts: 106
|
Posted: Thu Aug 03, 2006 5:51 pm |
What are you trying to do exactly? Are you trying to do a #FIND that works with the mapper closed or are you trying to search through some fields(if so which ones)?
Example usage: findroom blue house
and then return all rooms that have blue house in their description? |
|
|
|
jsmith Newbie
Joined: 03 Aug 2006 Posts: 7
|
Posted: Thu Aug 03, 2006 11:12 pm |
Saet, I am trying to search through the descriptions, just like in your example.
Kjata, I didn't realize the mapper was dockable, I'm going to try this, thanks.
JS |
|
|
|
saet Apprentice
Joined: 12 Jun 2006 Posts: 106
|
Posted: Thu Aug 03, 2006 11:35 pm |
#ALIAS findroom {
#VAR ConnRS %comcreate( "ADODB.Recordset")
#VAR strCommand %concat( "SELECT * FROM ObjectTbl WHERE [Desc] LIKE '%", %0, "%'")
#CALL @ConnRS.Open(@strCommand, "MapDB")
#IF (@ConnRS.eof) {#SHOW No matches found} {
#CALL @ConnRS.MoveFirst
#WHILE (not @ConnRS.eof) {
#SHOW %format( "&-45s", @ConnRS("Name").value) %format( "&5.n", @ConnRS("ZoneID").value)
#CALL @ConnRS.MoveNext
}
}
#CALL @ConnRS.Close
#VAR ConnRS ""
}
edit: The MapDB needs to be replace with your data source name(DSN) or you need to provide the whole string. The link you posted earlier has the text you can replace it with. Starts off Provider=blahblahblah or something.
This will display the room name and its zone number. Add a @ConnRS("columnname").value in the #SHOW for anything else you would want.
ObjID is the room number.
Desc is the description.
Don't know any others off the top of my head, you can just open up the database in another program to see.
I never realized you could dock the mapper either. If you haven't found it, it's the arrow next to the Help on the menu bar. Was really hoping I could dock room properties onto the mapper, but sadly no. |
|
|
|
jsmith Newbie
Joined: 03 Aug 2006 Posts: 7
|
Posted: Sun Aug 06, 2006 9:56 am |
Saet,
Thank you. This is exactly what I was looking for. I do have one request though.
How do I change the script so that instead of providing the 'zone id' I get the 'zone name'? Changing the "ZoneID" in the script to "Name" does note seem to work.
The zone names are in the "Name" column of the "ZoneTbl" Table.
Thanks in advance,
JS |
|
|
|
saet Apprentice
Joined: 12 Jun 2006 Posts: 106
|
Posted: Sun Aug 06, 2006 5:30 pm |
Create a regular connection that will query ZoneTbl for the zone name using the ZoneID in the recordset.
#ALIAS findroom {
#VAR ObjRS %comcreate( "ADODB.Recordset")
#VAR strCommand %concat( "SELECT * FROM ObjectTbl WHERE [Desc] LIKE '%", %0, "%'")
#CALL @ObjRS.Open(@strCommand, "MapDB")
#VAR ZoneConn %comcreate( "ADODB.Connection")
#CALL @ZoneConn.Open("MapDB")
#IF (@ObjRS.eof) {#SHOW No matches found} {
#CALL @ObjRS.MoveFirst
#WHILE (not @ObjRS.eof) {
strCommand = %concat( "SELECT Name from ZoneTbl WHERE ZoneID = ", @ObjRS("ZoneID").value)
#SHOW %format( "&-45s", @ObjRS("Name").value) @ZoneConn.Execute(@strCommand).GetString
#CALL @ObjRS.MoveNext
}
}
#CALL @ObjRS.Close
#CALL @ZoneConn.Close
#VAR ObjRS ""
#VAR ZoneConn ""
} |
|
|
|
jsmith Newbie
Joined: 03 Aug 2006 Posts: 7
|
Posted: Mon Aug 07, 2006 5:38 am |
Saet,
Your script works amazingly. Thanks
JS |
|
|
|
|
|