Catch "Walk" mouseclick in 4-verb Sierra Interface?

Started by SilverSpook, Sun 24/01/2016 09:26:25

Previous topic - Next topic

SilverSpook

Hi, I'm trying to intercept clicks on certain hotspots / objects if the player attempts to click with the "walk" verb on it.  I see in the events pane for hotspots and objects you can change the "interact" "talk" "use inventory" and other interactions, but not "walk". 

Is there a way to make a custom action happen when a player clicks "walk" on a hotspot, rather than the player just walking there?

Thanks!

monkey0506

AGS affords some special privileges to eModeWalkto, but there's currently no way of "catching" this as an event on a per-object (hotspot, etc.) basis. What you can do instead is simply intercept it sooner, in your on_mouse_click function:

Code: ags
function on_mouse_click(MouseButton button)
{
  if (button == eMouseLeft)
  {
    // ...blah blah...
    LocationType locType = GetLocationType(mouse.x, mouse.y);
    if (((locType == eLocationHotspot) || (locType == eLocationObject)) && (mouse.Mode == eModeWalkto))
    {
      mouse.Mode = eModeInteract; // force interaction with hotspots and objects, rather than walking to them
    }
    ProcessClick(mouse.x, mouse.y, mouse.Mode); // newer versions use Room.ProcessClick
  }
  // ....
}


SMF spam blocked by CleanTalk