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

Post new topic  Reply to topic     Home » Forums » zMapper Discussion
pteppic
Novice


Joined: 23 Oct 2000
Posts: 39
Location: United Kingdom

PostPosted: Sat Feb 22, 2003 3:37 am   

vnum to objid
 
Hi.

Because of the way I made my map all the rooms vnum's are useless, many rooms even have the same vnum due to importing from different maps.

What I would like to do is automaticly convert them all to be the same as the unique id number assigned to each room, that way I know they are all unique and I can use them for locations in an object database and various location teleport functions.

I guess this can be done with access macros, but I've never used them before so no idea how. Can anyone help?

Thanks
Pteppic
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sat Feb 22, 2003 7:50 am   
 
Have a read on Charbal's notes on his idea:
quote:

#loop 1,%numrooms() {#noop %roomnum(%mapvnum(%i),%i)}



I think that will solve your issue.


Ton Diening
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Feb 22, 2003 1:53 pm   
 
Well, there is a problem with that method. Suppose that you have gone through the first 100 rooms and they all have been asigned the numbers 1 through 100 in order. The loop will continue and will now try to change the vNum of room number 101. But suppose that the vNum of this room is currently 98. So, when %mapvnum(101) executes, it returns 98, and now the mapper doesn't know if it should change the vNum for room 98 or 101. My guess is that it most likely chooses the room with that comes first in the list, so it would change room 98's vNum to 101. In the end, depending on the current vNum's of the rooms, the script could do anything from putting the vNums in order to shuffling them around completely.

However, if we change the room mode to use IDs and set the vNums to the room's ID instead of the room's index (I call index its position in the database starting from 1 up to %numrooms), then we are assured that this will not happen:
#NOOP %roommode(1)
#LOOP 1,%numrooms() {#NOOP %roomnum(%mapvnum(%i), %mapvnum(%i))}
#NOOP %roommode(0)

Also, be sure to execute this script while the map is in Map mode, not in Follow mode.

Kjata
Reply with quote
pteppic
Novice


Joined: 23 Oct 2000
Posts: 39
Location: United Kingdom

PostPosted: Sat Feb 22, 2003 4:56 pm   
 
Thanks TonDiening and Kjata.

The second script is working exactly as I wanted. The first one didn't seem to do anything, but maybe I had the map in the wrong mode.

Pteppic
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMapper 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 on Wolfpaw.net