Centerview non-existent room?

All and any discussion and development of the Mudlet Mapper.
Post Reply
Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Centerview non-existent room?

Post by Nyyrazzilyss » Thu Jul 30, 2015 12:14 am

Centerview seems to require a room to exist to center the map on it.

centerview(nil) just throws an error: <centerview: need a valid room ID>

If someone moves into a room that hasn't been mapped, it would be nice to have an option to clear/blank out the map (area most likely, they've moved into a different area) that's currently showing (they're lost!). Is there another way to do so?

User avatar
demonnic
Posts: 559
Joined: Sat Dec 05, 2009 3:19 pm

Re: Centerview non-existent room?

Post by demonnic » Thu Jul 30, 2015 2:50 pm

I think the easiest way would be to create an area, "You're LOST!" with a single room in it, named "YOU ARE LOST" and centerview on that. Though I haven't tried to implement such a thing myself.

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: Centerview non-existent room?

Post by Nyyrazzilyss » Thu Jul 30, 2015 6:30 pm

Thanks, that could work.

I'm including a pre-mapped map of most of the mud, with everything held in area -1/locked from speedwalk until the room is actually entered, at which point I move it to the correct area and show it. Eventually i'm going to need to write something to allow for easy mapping by the player on 'unmapped' areas, but for now if someone moves into it i'll move the map display to that (great unknown/you are lost/etc) area (until the player moves back into a recognized room)

User avatar
SlySven
Posts: 919
Joined: Mon Mar 04, 2013 3:40 pm
Location: Deepest Wiltshire, UK
Discord: SlySven#2703

Re: Centerview non-existent room?

Post by SlySven » Wed Aug 05, 2015 7:52 pm

There isn't a way currently to clear the mapper window - but that idea with the empty (except for one room) might work - especially if you put a label on the map in that area with that message in it.

Detecting if a room Id exists without throwing a lua error if it does not looks a bit tricky - however I think you might get some joy with using "seachRoom( <roomId> )" if given a numeric argument it returns EITHER the room's name {or an empty string if it is does not have a name} if the room exists OR the string "searchRoom ERROR: no such room" if it does not - without throwing an error.

With regard to centerview() I think it throws that lua error if the room does not exist - if the room does exist (and is in the -1 area) I think centerview() still shows it - but the area name is not/is wrong/is left as the last valid area (I found a breakage in recent code that detects and fixes duplicate area names such that it didn't properly detect "Area name_001" de-duplications which might also affect how the "default" -1 area is handled...)

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests