How to make "any click with no effect, set mode walkto"?

Started by iamlowlikeyou, Thu 11/11/2010 23:50:05

Previous topic - Next topic

iamlowlikeyou

I want to make it, so that when mouse mode is set to for example look at, whenever mouse clicks anywhere, that doesn't perform a task (i.e. anywhere, that is not a hotspot, a character, an object...),
it changes back to mode walk to.
I take it, that should be fairly easy, but I haven't been able to find the function.

My best guess would be to make a "mouse.IsButtonDown(eMouseLeft)" command and then describe the exceptions, but I don't know how to do that?

Thanks for any help!

Wyz

I've slightly altered the default mouse click handler (denoted by white spaces):
Code: ags

function on_mouse_click(MouseButton button)
{
  if (IsGamePaused() == 1) // Game is paused, so do nothing (ie. don't allow mouse click)
  {
  }
  else if (button == eMouseLeft) 
  {


      Hotspot *hotspot = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
      if (hotspot.ID)
        ProcessClick(mouse.x,mouse.y, mouse.Mode);
      else
        ProcessClick(mouse.x,mouse.y, eModeWalkto);


  }
  else // right-click, so cycle cursor
  {   
    mouse.SelectNextMode();
  }
}
Life is like an adventure without the pixel hunts.

iamlowlikeyou


Khris

This will disable almost all interaction clicks on objects and characters.

What you need is
Code: ags
    if (GetLocationType(mouse.x, mouse.y) == eLocationNothing) ProcessClick(mouse.x,mouse.y, eModeWalkto);
    else ProcessClick(mouse.x,mouse.y, mouse.Mode);

iamlowlikeyou

@Khris: Yeah, I spotted that too, however I tried changing it to fit my needs - but this one is even better for this purpose. Thanks!

SMF spam blocked by CleanTalk