Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: RootBound on Thu 07/03/2024 16:04:15

Title: [SOLVED] on_mouse_click not being called
Post by: RootBound on Thu 07/03/2024 16:04:15
So when I click the mouse, none of the script from the global on_mouse_click runs. I have a message right at the beginning to test if it runs, and the message does not display. I'm using the blank game template. Version 3.6.0.49.

Here's the entirety of the room script:

function room_RepExec()
{
  Region *LeftOrRight = Region.GetAtScreenXY(mouse.x, mouse.y);
  if(LeftOrRight == region[1]){
    if(player.ID != 0){
    cPurpleMort.SetAsPlayer();
    }
    if(mouse.GetModeGraphic(eModePointer) == 45){
      mouse.ChangeModeGraphic(eModePointer, 46);
    }
  }
  else if(LeftOrRight == region[2]){
    if(player.ID != 1){
    cGreenMort.SetAsPlayer();
    }
    if(mouse.GetModeGraphic(eModePointer) == 46){
      mouse.ChangeModeGraphic(eModePointer, 45);
    }
  }
}

function room_Load()
{
  Mouse.Mode = eModePointer;
  cGreenMort.ChangeRoom(3);
  if(cPurpleMort.Room == 3){
    cPurpleMort.x = 80;
    cPurpleMort.y = 145;
  }
  if(cGreenMort.Room == 3){
    cGreenMort.x = 240;
    cGreenMort.y = 145;
  }
}

And here's the Global on_mouse_click:

function on_mouse_click(MouseButton button)
{
  if (button == eMouseLeft)
  {
    Display("This click was processed!");
    if(GetLocationType(mouse.x,  mouse.y) == eLocationNothing){
      Room.ProcessClick(mouse.x, mouse.y, eModeWalkto);
    }
    else{
      Room.ProcessClick(mouse.x, mouse.y, mouse.Mode);
    }
  }
  else if (button == eMouseRight)
  {
  }
}

Any idea what I'm missing?
Title: Re: on_mouse_click not being called
Post by: RootBound on Thu 07/03/2024 17:30:52
UPDATE: Solved on discord. Thanks @Laura Hunt . It was a transparent GUI because I always end up making the controls invisible when I'm trying to hide the parent GUI instead.