Hello!
I'm new here, so forgive me if this is a stupid question.
I want to have the mouse cursor's graphic change depending on what it's hovering over.
I have tried this:
function hHotspot1_MouseMove()
{
mouse.ChangeModeGraphic(eModeCanClick, 2);
}
Which does of course change the cursor graphic when the mouse moves over the hotspot. However, it doesn't change the graphic back when the cursor moves back off of the hotspot.
I have tried accessing the hHotspot1_MouseMove()
function as a boolean, to see if I could check when the mouse was still on the hotspot or not, but the code does't appear to work like that.
The only other thing I can think of is having the rest of the screen a different hotspot that when moused over will change the cursor graphic to the default. I'd rather not fill up the entire screen with a hotspot, though.
Is there some simpler way to achieve this? ??? Thanks!
You can poll the mouse.x and mouse.y position on repeatedly execute to check which Hotspot it's on top and act upon on changes.
You don't need script commands at all. Create a new view and set the highlight cursor as first frame of the first loop.
Next, open the cursor mode and set
-AnimateOnlyOnHotspots to true
and
-View to the number of the view
(in general, implementing global behavior by adding a function to each and every hotspot is a very bad idea; the script way is to look at GetLocationType(...) and Hotspot.GetAtScreenXY(...) in the repeatedly_execute function
I never liked the MouseMove event but it's supposed to be used for special hotspots like exits and there's Mouse.SaveCursorUntilItLeaves() so I guess it can be useful)
Awesome, thanks for the info!
Okay, well now I'm getting a runtime error.
"Error: prepare_script: error -18 (no such function in script) trying to run 'room_RepExec' (Room 1)"
The room's script is blank, I'm not sure what the deal here is. Why would it be trying to call the room_RepExec function?
If you link a function under Events in the Editor, this function needs to exist. At the same time, if you just wrote room_RepExec, without linking to the specific Repeatedly Execute event, this function would not execute.
So to solve your problem, in the Editor, load Room 1, go in the properties for the Room, click in the lightning bolt icon for Events, and remove the assigned function in Repeatedly Execute.