[Solved] Mouse cursor change over interactive areas/items (BASS template)

Started by Lewis, Thu 16/08/2018 10:45:52

Previous topic - Next topic

Lewis

EDIT: Insta-solved this myself. Literally had something set to 'false' instead of 'true' and am now lamenting the lack of a 'delete thread' option... :grin:

I'm playing around with something using the BASS template, and I'm trying to create a simple system where the mouse cursor changes when over anything interactive. Previously I've done this with the 'animate over hotspot' default setting but the BASS template seems to stop that working, as far as I can tell, so I tried to do something by hand.

So I have this in repeatedly_execute_always in the global script, pilfered from an old forum post then tweaked to suit:

Code: ags

  Hotspot *hat = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
  if (!IsInterfaceEnabled()) // user interface is disabled, a blocking event is running, OR mouse not over hotspot
  {
    mouse.UseModeGraphic(eModeWait);
  }
  else if (hat == hotspot[0])
  {
    mouse.UseModeGraphic(eModeWalkto);
  }
  else if (hat != hotspot[0])
  {
    mouse.UseModeGraphic(eModeInteract);
  }


Problem is, as I quickly realised, twofold:

1) This only works for hotspots specifically. For interactive characters and objects, the cursor doesn't change.

2) It stops the inventory working. When I hover over inventory items, not only does the cursor not change, but clicking the inventory item fails to select it. (It's definitely this code that's breaking it as when I comment it out, it works fine.)

This is almost certainly a case of my intermittent AGS use meaning I've forgotten how to do something super simple, so any help appreciated. Thanks!
Returning to AGS after a hiatus. Co-director of Richard & Alice and The Charnel House Trilogy.

SMF spam blocked by CleanTalk