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
ogretooth
Newbie


Joined: 16 Jun 2003
Posts: 6

PostPosted: Tue Jun 17, 2003 3:07 am   

Adding Mapper Zones Programatically....
 
I can add rooms to a zone that exists in the mapper, but am I missing something? How do you add a new Zone to your master map? Is this possible?

Sorry if this has been answered before Google yielded unusable answers and the Forum search seems to time out on me if I search more than 1 year ago.

Thanks,
OgreTooth
Reply with quote
tbone235
Apprentice


Joined: 02 Nov 2002
Posts: 107
Location: Australia

PostPosted: Wed Jun 18, 2003 2:06 pm   
 
on your mapper, choose the zone menu, then choose new zone.
:)
Have fun
Reply with quote
Daagar
Magician


Joined: 25 Oct 2000
Posts: 461
Location: USA

PostPosted: Wed Jun 18, 2003 6:19 pm   
 
He wants to do it programatically though... I know you can use the #MENU command to programatically send Zone->New Zone, but I'm not sure how you pass a value for the name of the zone.
Reply with quote
ogretooth
Newbie


Joined: 16 Jun 2003
Posts: 6

PostPosted: Thu Jun 19, 2003 2:40 am   
 
That's correct. I can use the #MENU command to bring up the Add Zone dialog box, but I can't figure out a way to put an Area Title recieved from the mud into the dialog box. The closest thing I can think of is to send the title to an external program, maybe like Winbatch or something, and have the external program enter the value for me. Anyone have a better way?

Thanks,
Ogretooth
Reply with quote
ogretooth
Newbie


Joined: 16 Jun 2003
Posts: 6

PostPosted: Thu Jun 19, 2003 6:27 am   
 
Maybe COM or ADO programming? Any examples?

Ogretooth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jun 19, 2003 2:56 pm   
 
Yes, you can use ADO. There are some examples concerning the MUD list here, but they can easily be adapted to the map database. Also, try reading a bit on SQL, specifically about the INSERT statement.

What you want to do is to insert a new record into the ZoneTbl table. The only problem is that you have to specify the ZoneId too since it is by default -1. I think that in the past this field was AutoNumber. This is not the case now, and if indeed it was changed, I don't know why. Anyway, for this you may probably need to do a SELECT statement before the INSERT, using the MAX aggregate function so that you may find out what is the biggest number in the ZoneID field and then create your new record with an ID that is one bigger than that number.

My knowledge of SQL is not that big, so there may be an easier way of accomplishing all of this. If there is, then probably someone that knows more about SQL would mention it.

Kjata
Reply with quote
ogretooth
Newbie


Joined: 16 Jun 2003
Posts: 6

PostPosted: Fri Jun 20, 2003 8:40 am   
 
Thanks Kjata....

I'll see if my crappy programming can get this idea working. :]

Peace


OgreTooth
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Fri Jun 20, 2003 9:11 am   
 
The next ZoneID is taken from the record (there should be only one) in VersTbl.

So, if you manipulate the database directly, you need to get this number, use it when adding the new zone and then increment it in VersTbl (actually, to maintain database integrity at all times if your changes are being committed as you make them, you'd reverse these last two steps).

Otherwise, zMUD will use this number the next time it creates a zone and create a conflict with your zone.

Incidentally, this way of obtaining the next number applies to most types of records in the database. As far as I can tell, it's planning ahead for multiple users being able to use databases of this format in zExplorer. By specifying different numbers for them to start inserting records at, you can reduce greatly the chances of a collision when you merge.

Collisions make things much more complicated when the goal is to have two databases in sync. Heck, even copying zones from one database to another is non-trivial and takes a significant amount of code.

As for other ways of doing this programmatically, VBScript can be used for the part where you send text to the zone name prompt. Search the forums (either General or Beta, I think I've posted this in both) for SendKeys.


 - Charbal
Reply with quote
ogretooth
Newbie


Joined: 16 Jun 2003
Posts: 6

PostPosted: Fri Jun 20, 2003 10:40 am   
 
Thanks for the catch and additional insight, Charbal!


OgreTooth
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jun 20, 2003 11:26 am   
 
Good catch Charbal. I doubted that zMUD would look through all the records in the table first to find out which one has the highest ID, but since VersTbl was mostly unused before, I didn't look at it again.

Kjata
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