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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Mon Sep 27, 2010 7:56 pm   

General vNum and Roomkey question
 
I've had a question in the back of my mind about the %roomkey function.

Say I have 2 rooms with the following roomkey and vNums all in the same zone:

Roomkey (db #), vNum
1, 5
2, 5

So in effect I create 2 rooms and set their vNums to be '5'.

If I use the function %roomkey(5) to return the roomkey for the room with the vNum of 5, how does it decide which room to return? The reason why I'm curious about this is that by default the vNums get set to the roomkey upon room creation (if the actual vNum wasn't available). As I go through my map and now add the correct vNum to the rooms I'm going to have instances where there will be two rooms set with the same vNum. How does %roomkey sort out which to return? Does it look at the flags indicating whether the vNum came from the server? Or does it look first at the current zone before searching other zones? I guess ideally it would return the one with the vNum from server flag marked, but I know that was a recent addition by Zugg.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Sep 27, 2010 8:17 pm   
 
You cannot have two rooms with the same vNum in the same zone. vNum must be unique within a zone. The only exception to this is when using the "Real vNum" flag. You can have two rooms with the same vNum is one has the "Real vNum" flag enabled and the other one has the flag disabled. In this case, CMUD will use the room with the "Real" flag enabled and will ignore the other room, assuming that the vNum is not really valid yet.

When looking for a vNum, CMUD looks in the current zone first, and if nothing is found, then it looks in any other zone. First it does this looking for rooms with the "Real vNum" flag enabled. Only if nothing is found does it repeat the procedure for rooms without this flag set.
Reply with quote
ReedN
Wizard


Joined: 04 Jan 2006
Posts: 1279
Location: Portland, Oregon

PostPosted: Mon Sep 27, 2010 8:41 pm   
 
Thanks for the explanation.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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