Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: FanOfHumor on Thu 31/03/2022 04:47:31

Title: (Solved)Cursor gets stuck as a certain mode after leaving hotspot.
Post by: FanOfHumor on Thu 31/03/2022 04:47:31
When the mouse moves over a hotspot it should change it's cursor mode and then change back when it leaves.Sometimes this works but whenever the mouse moves to click on a gui and then is no longer over the hotspot it gets stuck in the cursor mode.
I just have a quit button(hotspot) and the basic Quitgame gui but if I click on one of the buttons the cursor is stuck in a mode after the gui closes.
Code (ags) Select

function hHotspot1_AnyClick()
{
QuitGame(1);
}

function hHotspot1_MouseMove()
{
mouse.SaveCursorUntilItLeaves();
mouse.Mode=eModeCleave;
}
 
Title: Re: Cursor gets stuck as a certain mode after leaving hotspot.
Post by: eri0o on Thu 31/03/2022 12:44:46
Hum, I think maybe redo this but using repeatedly execute always would help this to not happen. In this way you would use Hotspot.GetAtScreenXY(mouse.x, mouse.y) to get you which hotspot the mouse happens to be over at that frame.

If it's a room script, then use the room RepExcute - you need to create this event from the room editor, by going in the room Editor and using the ⚡icon.

https://adventuregamestudio.github.io/ags-manual/Hotspot.html#hotspotgetatscreenxy
Title: Re: Cursor gets stuck as a certain mode after leaving hotspot.
Post by: FanOfHumor on Thu 31/03/2022 17:36:40
I did forget about hotspot.Getatscreenxy.This not only solves my problem with the hotspot but also with a script that I was doing in an attempt to check if the mouse hovers over an objects graphic. Thanks for reminding me.