Rooms pointing to a room

Share your scripts and packages with other Mudlet users.
Post Reply
Swal
Posts: 14
Joined: Mon Mar 17, 2014 12:16 am

Rooms pointing to a room

Post by Swal »

Hi!

I am interested in finding what rooms have exit to a certain room.

I know that I can always just loop through all the rooms, check if any of their exit points to the room, but that is very inefficient, and my map is over 30.000 room (and growing), this search freezes up the UI (noticably, not for a long period, 1-1.5 sec). I want to get rid of this freeze.

My attempt to make the resolution more efficient is by overwriting exit, stub, specialexit functions and update the target room's "pointshere" userdata anytime these functions are called.

I was really happy to see it do exactly what I wanted... except mapper UI windows don't make use of any of these functions, they must use something internal. Meaning if I deleted/added an exit through the ui, my "pointshere" userdata did not update.

Wondering if I am just over complicating things and there is an existing function that does this for me. Maybe I've missed it.

Silvine
Posts: 142
Joined: Sat Oct 23, 2010 2:36 pm

Re: Rooms pointing to a room

Post by Silvine »

Maybe make a table of room -> entrances, then lookup this table, that should be a lot faster I think.
Mapper of Bedlam

Swal
Posts: 14
Joined: Mon Mar 17, 2014 12:16 am

Re: Rooms pointing to a room

Post by Swal »

Hi Silvine,

Problem is the UI doesn't make use of the public functions so I can not be sure my table is up to date at a given time.
My attempt to make the resolution more efficient is by overwriting exit, stub, specialexit functions and update the target room's "pointshere" userdata anytime these functions are called.

I was really happy to see it do exactly what I wanted... except mapper UI windows don't make use of any of these functions, they must use something internal. Meaning if I deleted/added an exit through the ui, my "pointshere" userdata did not update.
Some things are simply easier with a graphical interface.. like deleting an exit, overwriting one. Anything what my automatic map scanner shouldn't/can't do.

User avatar
Vadi
Posts: 5041
Joined: Sat Mar 14, 2009 3:13 pm

Re: Rooms pointing to a room

Post by Vadi »

I'd do your room location in batches, then you wouldn't have a UI freeze. Think that is about the only way to go about it unless we add this in as a function.

The UI doesn't make use of those functions, that would be non-sensical from a design POV. They are just for users scripting purposes.

Swal
Posts: 14
Joined: Mon Mar 17, 2014 12:16 am

Re: Rooms pointing to a room

Post by Swal »

Vadi wrote:I'd do your room location in batches, then you wouldn't have a UI freeze. Think that is about the only way to go about it unless we add this in as a function.
Alright, thanks for the answer Vadi. The UI freeze is not a deal breaker, just something I wanted to get rid of if possible.
Vadi wrote:The UI doesn't make use of those functions, that would be non-sensical from a design POV. They are just for users scripting purposes.
Yeah, I can see why. I was hoping there would be still some undocumented hookup I could use.

Will think of something :)

Post Reply