Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Pollux on Sun 21/07/2019 11:45:07

Title: Strange hover cursor behaviour
Post by: Pollux on Sun 21/07/2019 11:45:07
Hi there,

First of all - I don't much understand scripting...

But I wanted the cursor to change everytime it hovers over the exit hotspot.

I simply copypasted the code from a different game, because I am really a noob in this :D

the code says:

Code (ags) Select

function Exit_MouseMoveG() { // makes sure cursor changes to warp when hovering on exit hotspot
if (mouse.Mode != eModeUseinv) { // unless it's an inventory cursor, which overrides
Mouse.SaveCursorUntilItLeaves();
mouse.Mode = eModeLeaving;
}
}


Also I have to have this in the header:

Code (ags) Select

import function Exit_MouseMoveG();


and eventually the function is defined in the hotspod code like this:

Code (ags) Select

function hZpetDoVestibulu_MouseMove()
{
Exit_MouseMoveD();
}


And... it works, so there is no problem... BUT it work only sometimes and sometimes the cursor stays changed... as you can see in this video:



sometimes the arrow down is kept and shows even in the inventory.

Any ideas how it could be fixed?

Thanks!
Title: Re: Strange hover cursor behaviour
Post by: Pollux on Sun 28/07/2019 14:26:21
Oh... so no one actually know?

Interesting... :)
Title: Re: Strange hover cursor behaviour
Post by: Khris on Sun 28/07/2019 15:12:39
It seems pretty clear that it's the GUI causing this;  Mouse.SaveCursorUntilItLeaves();  is not an ideal way of implementing custom cursors though anyway.
There are several existing threads about exit arrows, there's should be a relatively recent in this or the Advanced forum.
Title: Re: Strange hover cursor behaviour
Post by: Pollux on Sun 28/07/2019 17:43:03
a-HA!

If I understand correctly, the mouse.SaveCursorUntilItLeaves(); change cursor when hover over the hotspot and change it back to the previous one - however if the previous one is not the default one, but some other, it keeps the other.

Tha's what causes my cursor thing.

I need to find a better solution then!