How to Not Show Hotspots with Cursor When Inventory Box is Open

Started by Ghostlady, Sun 06/04/2025 00:28:33

Previous topic - Next topic

Ghostlady

Hi, currently when the inventory box is open and it's sitting in the middle of the screen but on some hotspots, if I move the mouse around within the inventory box, and it rolls over a hotspot, it changes the cursor to the Interact graphic.  Here is the code I use in my global script.  How this works is that the Inventory box opens and there should be an "arrow" cursor.  When the mouse rolls over an inventory item, the cursor graphic changes to the interact pointer. I shouldn't be seeing hotspots within the inventory box.


Code: ags
  // ** CUSTOM INVENTORY WINDOW
  gInventory.Visible = true;
  // switch to the Use cursor (to select items with)
  mouse.Mode = eModeInteract;
  // But, override the appearance to look like the arrow
  mouse.UseModeGraphic(eModePointer);
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Ghostlady

Can anyone help me with this?  This room has multiple directional hotspots.  When a gui is open, in this case the inventory gui or the interface gui, if the mouse rolls over one of the hotspots while the gui is open, it picks up hotspot and changes the mouse cursor, disregarding the mouse for the gui.  How can I stop this from happening.  See video for an example.

https://youtu.be/R_aq8aiVV4M
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Khris

One easy way to fix this is to make the GUI as big as the screen and use a background image with a transparent border. A clickable GUI will prevent the cursor from reacting to hotspots even if the background is completely transparent.

Another way is to check if the GUI is open before changing the cursor. Is this done in repeatedly_execute code? Or are you using the built-in way (AnimateOnlyOnHotspots)?
If it's the former, you can just wrap the code in
Code: ags
  if (!gInventory.Visible && !gInterface.Visible) {
and
Code: ags
  }

Ghostlady

Interesting about the background with a transparent border.  I am going to try that.
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Ghostlady

How do I make a transparent border? I created a screensize background and layered my inventory window on top of the transparent background and then saved as a .png. It's not working though. 
My Games:

Hauntings Of Mystery Manor
Intrigue At Oakhaven Plantation
Haunting at Cliffhouse

Crimson Wizard

Make a fullscreen GUI, and set its background and border color to 0, which will make it fully transparent.
Keep it Clickable = true.
Set its ZOrder to be lower than the inventory gui.
Make it show along with the inventory gui and hide when you hide inventory.

Khris

Can you describe how it's not working?

I did a test with the Sierra template.

(This template has the inv GUI set to "pause game when shown", which will prevent rep_exe code from running, so this might actually be a much easier way to solve this.)

Anyway, I added a transparent border to the background image png, changed the position and size of the GUI accordingly and moved all the controls to their proper spots.
Then I used this code to display the hotspot's name in the status bar:

Code: ags
// called on every game cycle, except when the game is blocked
function repeatedly_execute()
{
  String name = Game.GetLocationName(mouse.x, mouse.y);
  lblOverHotspot.Text = name;
}

The transparent background prevented this mechanism from displaying the hotspot's name while the GUI was open, so it worked as expected. I.e. a transparent but clickable GUI catches room clicks and GetLocationType / Game.GetLocationName.

SMF spam blocked by CleanTalk