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
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Tue Mar 04, 2003 7:38 am   

mapper zones
 
Is there a way to find what zone a room is in using the room ID or VNUM?

-Serentus-
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Mar 04, 2003 12:51 pm   
 
#VAR temp %roomnum()
#TELEPORT desiredRoom
#SH This room is in %zonename()
#TELEPORT @temp

There is a method that does not need to teleport, but it does involve querying the database directly by using ADO. So, if you don't like this one, let us know.

Kjata
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Wed Mar 05, 2003 6:05 am   
 
If there's a ADO way of doiong this, then that would probably be better for what I'm trying to do. (which i probably should have explained in the intial post).

Here is what I'm doing:
I am trying to set up a database on rooms with a specific 'portal' exit. Im using the IDs of the two rooms as the Source and Destination of that 'portal'. In order to make this truely useful I need to have a the Zone name in it so i can set up a view to limit only the ones with the source in a specific Zone.

I can enter it manually, but It would be much easier to keep up to date if I could do it via a 'fomula' for the Zone Name 'key'.

Your suggestion on the teleport did help with another problem, and worse case I should be able to find a way to fill the Zone Name using an alias and looping through the map. Even if the ADO way wouldn't do what I wanted I still love to know how it would be done, or at least a point in the direction so I can figure it out myself.

-Serentus-
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Mar 05, 2003 1:46 pm   
 
For the ADO method, you need to make an SQL query that will return the name of the zone of a specific room. It's not too hard, but you need to join ObjectTbl and ZoneTbl since ObjectTbl only contains the zone's ID and not the name. Example:
#ALIAS getzone {#VAR Conn %comcreate( "ADODB.Connection");#CALL @Conn.Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mapDB path here");#VAR rs @Conn.Execute( "SELECT ZoneTbl.Name FROM ObjectTbl INNER JOIN ZoneTbl ON ObjectTbl.ZoneID = ZoneTbl.ZoneID WHERE ObjectTbl.ObjID = %1");#SHOW @rs.GetString;#VAR rs "";#CALL @Conn.Close;#VAR Conn ""}

To use it, just pass to the getzone alias the ID of the room you want.

Kjata
Reply with quote
Serentus
Apprentice


Joined: 28 Sep 2001
Posts: 103
Location: USA

PostPosted: Fri Mar 07, 2003 6:33 am   
 
Oh wow. I didn't realize what all was really possable here. (I just looked through all the COM and ADO stuff in the ZMUD Support library.)

Looks looks I'm gonna have to get my old Databases text book out, and brush up on some COM programing.

Thanks Kjata

-Serentus-
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