What I tried to do is: If I move the cursor to the top of the screen (YPos 13) the Iconbar should appear. When I move the cursor even more to the top (YPos 1) the Statusline should appear. As I move down the cursor again, the guis should disappear.
Since this works already fine for the Iconbar in the template game, I tried to make the specific modifications to the Statusline-Gui. In the controls panel I changed "Visible" to "Mouse YPos" and "Popup YPos" to 1. I also changed the Z-order to 3 for the Statusline overlaying the Iconbar. Since there was a "gui[0].Visible = false" in the game_start() section which leads to not show the gui at all I had to remove this to get the Statusline working.
Now everything works fine until I move the cursor off the guis again: The Iconbar removes as expected. But the Statusline stays on the screen giving me no chance but to finish the game with Alt+F4 because everything is blocked.
How is that? And why is the Statusline switched off by default (I can't remember to edit the game_start() section in the past)?
It looks like to me that there is only one event being generated. So when the mouse moves away only one of the GUI's gets signaled to close. You could set bot of them to normal and then control them yourself, something like this:[/pre]
function repeatedly_execute() {
// Turn on/off IconBar
if (mouse.y<13) gIconBar.Visible = true;
else gIconBar.Visible = false;
// Turn on/off Statusline
if (mouse.y<1) gStatusline.Visible = true;
else gStatusline.Visible = false;
}[/pre]
Just as an addition to that:
I think that to properly recreate the way MouseYPos GUIs work, you might want to add a check for what GUI is currently under the mouse, before turning it off, e.g.:
// Turn on/off Statusline
if (mouse.y<1) gStatusline.Visible = true;
else if (GUI.GetAtScreenXY(mouse.x, mouse.y) != gStatusline) gStatusline.Visible = false;
Will turn
gStatusline on when the mouse is right at the top of the screen, and keep it on until the mouse is lower that the bottom of the GUI (i.e. until mouse.y = 16, if
gStatusline is 15 pixels high). This is probably more usful for the Iconbar GUI, is it's taller than 13 pixels (like the default).
QuoteAnd why is the Statusline switched off by default (I can't remember to edit the game_start() section in the past)?
You must have, unless you're using a template you downloaded from somewhere. The standard templates (default & empty) don't have anything in
game_start.
Hey, thanks, it is always good to have creative people around and I promise to give these attempts a try, BUT:
The Iconbar is having the right behaviour already. And it is clear from the options panel why it appears. What is not clear is why it disappears. This must be coded somewhere. And I guess that there must be a similar section or something where to do it for the statusbar as well.
Thanks again, RickJ and Ashen! your workarounds work very fine (although you had a little trap in it, Ashen. But I quickly found out to write GetAtScreenXY starting with a capital letter ;) )
Though I'm still interested in having my question answered, I decided for the scripting solution to manage the GUIs, since it gives me the flexibility of having the Iconbar at top and the Statusline at the bottom of the screen (with the YPos parameter it seems only possible to open a GUI if the cursor comes above this position).
Great help!
BTW:
Yes, I must have editet the game_start. I remember that I didn't like that static grey bar on the screen in the beginning.