Page 1 of 1

undefined rooms??

Posted: Fri Feb 04, 2011 7:18 am
by Omit
I tried something this evening and at first it appeared to be a huge success....

I have been using a room to act as a placeholder in my mapping script (addRoom(1)) all rooms and exits that have not been used go here. this room has no position and has not been assigned to an area. (script catches this and updates it)
I noticed that one of the exits being mapped displayed a "room" where the exit was (the same as where map changes areas in 3d mode). I decided to exploit this behavior by using 13 rooms(1 for each std dir and 1 for all spec) with no position and no area... the effect was great,,, as you mapped a room green rooms would appear with the exits mapped. When you entered a room the script recognized it was one of the 13 rooms and created a new room in the right location and mapped the exits.(using the same 13 rooms) This all worked very very well but.....

Once the map was saved and restored.... whenever you entered 1 of the 13 (undefined rooms, no area, no location, no exits defined for those 13 rooms) the map went haywire! Goofy! I mean that connections were made between these 13 rooms and other rooms all over the map... I wouldn't have thought that what I had done would cause such chaos in the map(and makes me reconsider even using 1)....

I guess I don't fully understand what mudlet does when you assign an exit to a room and what changes when the map is restored??!??

(I almost posted this in whatever... )

Omit

Re: undefined rooms??

Posted: Fri Feb 04, 2011 11:12 pm
by Omit
Thought I would post a couple screen shots of this... (not sure I explained it well)

before logging out my map looks something like this....
before
before
before_restore.png (94.67 KiB) Viewed 6062 times
and after I restart mudlet and log back in, and enter an unmapped room, it looks like this....
after
after

(the green rooms with the red dots are the undefined rooms)

(I still have not completely ruled out an error in my scripting and will look at that tonight.... the behavior would be awfully cool, if I can get the map to restore correctly)

Re: undefined rooms??

Posted: Sat Feb 05, 2011 12:45 am
by Omit
The error appears to be mine... the count that tells me the next room ID that can be created is does not restore correctly... this is where it would be nice to have a function to return the MAX value of all room ID's. (so you can add one and create a new room without fear of a problem like this)

Re: undefined rooms??

Posted: Sat Feb 05, 2011 10:26 am
by Heiko
Mudlet creates appropriate room IDs for you with id = createRoomID()

Re: undefined rooms??

Posted: Thu Mar 03, 2011 4:43 pm
by kakku
how does that work?

createRoomID() just returns 1 for m everytime..
maybe i'm doing it wrong..

Re: undefined rooms??

Posted: Thu Mar 03, 2011 4:58 pm
by Vadi
Then you probably aren't using the roomID 1?

Re: undefined rooms??

Posted: Thu Mar 03, 2011 9:00 pm
by Omit
Would be my guess too...
createRoomID() just returns the lowest unused room ID number

so....

local id = createRoomID()
createRoom(id)


..... if you create a room with that id.... and call createRoomID() again... it will give you a new id you can use