Map Button

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

Map Button

Post by Nyyrazzilyss »

I'm curious about the map button in the icon bar.

My mapper is created as

mudlet = mudlet or {}; mudlet.mapper_script = true
mapwindow = Geyser.Mapper:new({name="mapper",x="33%",y=0,width="33%",height="50%"})

I show or hide the map by using either

mapwindow:hide()
mapwindow:show()

Clicking on the map button does nothing if I have the mapwindow hidden, but if I have the mapwindow showing it flashes it off, then back on again.

Am I doing something incorrectly?

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

Re: Map Button

Post by SlySven »

If you do not have a mapper scripted to be built into the console, the button generates a dockable widget with the same map inside - which can be expanded and floated up onto another monitor/screen should you be so blessed! (I'm only running a twin display as I found my fancy 4-head Matrox card is not well supported by Matrox - the latest driver is several years old and the binary only linux-drivers have not been updated for anything past 3.10 kernels, and only support OpenGL 1.2 which seems to be a bit of a problem with Qt :( ).

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

Re: Map Button

Post by Nyyrazzilyss »

I am a bit confused about this one, so i'll re-read the documentation.

From a quick look, non-geyser looks to only have a single command to create the mapper window (createMapper)

createMapper(x, y, width, height)
Creates a miniconsole window for the mapper to render in, the with the given dimensions. You can only create one mapper at a time.

How is a different mapper type created? I included a fragment from my code where I was creating the window: Which of the two types am I creating? How do I switch between them?

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

Re: Map Button

Post by SlySven »

If you DON'T create a mapper in your scripts then the first time you press that button for a particular profile the dockable mapper widget is created instead - the button then toggles showing and hiding THAT widget...

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

Re: Map Button

Post by Nyyrazzilyss »

OK I just commented out my call to create the mapper, and used the button to create it rather then the script -

It did create, was draggable/manually resizable (which is nice), however:

How do I script showing/hiding, not forcing use of the button? In particular: On initial startup, I want the mapper created/visible. It could then be turned off, and on future starts I will remember which choice was selected, and either display it or keep it hidden dependent on users previous choice.

If I manually resize the window, and move it close/ within about half an inch of an edge, it tried to resize itself into a narrow vertical/horizontal bar. How do I script movement of the map to a default x/y/xs/xs positioning? If the user manually changes that information, i'm going to want to know so I can use that in the future. Is there a matching get command for that information?

I commented out my command to geyser to create my mapper window when I tested, however, I didn't comment out all my mapper related code. After creating the first floating mapper, it then subsequently created a 2nd built-in mapper. I haven't really taken a look, but any reason why it would have created both?

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

Re: Map Button

Post by SlySven »

Nyyrazzilyss wrote:How do I script showing/hiding, not forcing use of the button...
I'm not sure you can script showing/hiding that mapper at least without the initial creation by pressing the button.
Nyyrazzilyss wrote:If I manually resize the window, and move it close/ within about half an inch of an edge, it tried to resize itself into a narrow vertical/horizontal bar...
That is why it is called a dock-able widget - you get it close to the docking area - it tries hard to dock! ;) {You can resize it (change the width in a left or right dock, or the height with a vertical dock), and if the dock area is shared with (floating, but dock-able) toolbars or dock-able consoles you can adjust the division of the space between them when they are docked BTW}
Nyyrazzilyss wrote:I commented out my command to geyser to create my mapper window when I tested, however, I didn't comment out all my mapper related code...
That is naughty - it should not do that and I'd be careful then! There ARE still some bugs in the dock-able widget stuff - particularly if you are multi-playing and close one profile: some of the dock-able widgets do not get correctly destroyed and persist after the profile they are attached to goes away. That is okay - sort of - until they try to access data from their no-longer existent parent profile (by, say, you clicking on them) and then you get segment violations or some other fatal (to the application) situations {and possibly your MUD character as well, if others note that you are, not so much: "away-from-keyboard" as: "had keyboard and screen ripped out of your hands and thrown in the bin"}...

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

Re: Map Button

Post by Nyyrazzilyss »

SlySven wrote: I'm not sure you can script showing/hiding that mapper at least without the initial creation by pressing the button.

..You can resize it (change the width in a left or right dock, or the height with a vertical dock)..

..it should not do that and I'd be careful then!..
In regards to resizing: Only by dragging, or is their get/sets to script it? Right now I have everything working 100% with the geyser mapper, I just happened to click the map button the other day and had been a bit confused about what it was supposed to do / how to get it to work. It it doesn't currently allow scripting on/off however, or sizing/positioning I expect i'll stay away from the floatable and stick with using the geyser mapper, and maybe look at it again sometime in the future.

Post Reply