I am making a Dig/Sam & Max style GUI and can't for the life of me figure out how to disable all and any hotspots in any room while my Inventory GUI is visible.
It is set up so that you click a little button in the bottom left corner of the screen and an inventory GUI pops up.
My problem is this: With the Inventory GUI activated, the underlying hotspots behind this GUI are still active when the mouse moves over them.
Ideally once the player has chosen an inventory item for use with the hotspots in the room, he/she moves the mouse off to the side and the hotspots are active again with the inventory item as the cursor.
Any ideas?
Cheers.
If you set the GUI's Visible property to "Popup Modal", the game will be blocked while it is displayed, no interactions on the room background are processed.
If you want the GUI not to pause the game, you could make it as big as the screen so it covers the hotspots. Use a graphic that's transparent on the outer areas so you can still see the room background beneath.
Quote from: strazer on Sun 08/04/2007 18:28:37
If you set the GUI's Visible property to "Popup Modal", the game will be blocked while it is displayed, no interactions on the room background are processed.
You know what that doesnt work. The background hotspots are still processed. What I set up for when I move the mouse over hotspots is a loom style graphic representation fades into the bottom right corner.
I'm using the FadingThingsNonBlocking Module t fade objects in and out including the inventory.
Quote from: strazer on Sun 08/04/2007 18:28:37
If you want the GUI not to pause the game, you could make it as big as the screen so it covers the hotspots. Use a graphic that's transparent on the outer areas so you can still see the room background beneath.
Good idea. And this code will still work:
if (IsGUIOn(1)==true) {
if (mouse.x > 280) {
FadeGuiOut_NoBlock(gInventory,100,-15);
}
if (mouse.x < 40) {
if (mouse.y < 140) {
FadeGuiOut_NoBlock(gInventory,100,-15);
}
}
if (mouse.y < 25) {
FadeGuiOut_NoBlock(gInventory,100,-15);
}
else {
}
}
}
I'll try and solve the above first.
Thanks Strazer.
Quote from: subspark on Mon 09/04/2007 00:51:35
Quote from: strazer on Sun 08/04/2007 18:28:37
If you set the GUI's Visible property to "Popup Modal", the game will be blocked while it is displayed, no interactions on the room background are processed.
You know what that doesnt work. The background hotspots are still processed. What I set up for when I move the mouse over hotspots is a loom style graphic representation fades into the bottom right corner.
Generally, clicking hotspots (objects/characters) triggers the on_mouse_click() function which by default first checks if the game is paused and if it is not, calls the ProcessClick() function and thereby processes a hotspot interaction event; but if the game is paused because a Popup Modal GUI is being displayed, the interaction won't run, as Strazer says.
But I noticed you were talking about moving the mouse cursor over them. As I understand, you probably use the Hotspot.GetAtScreenXY() function or something similar within repeatedly_execute() to get a hotspot to work with. If so, your codes will run regardless of presence of any GUIs behind the mouse cursor.
To stop the code from being triggered, add an extra check for a GUI at the current mouse position, or a check for if game paused. The latter will disable the code for all hotspots on the screen until the game is unpaused (every Popup Modal GUI is off, for instance).
repeatedly_execute
if ( GUI.GetAtScreenXY( mouse.x, mouse.y ) == null )
{
Hotspot *theHotspot = Hotspot.GetAtScreenXY( mouse.x, mouse.y );
// processing further with the hotspot...
}
Worked Great!
Thankyou.