Cursor mode is stuck after moving fast over two or more hotspots

Started by Deep Dark Fears, Tue 08/05/2018 19:50:42

Previous topic - Next topic

Deep Dark Fears

As the title say, if I move my cursor fast over two hotspots it get stuck in mode define with SaveCursorUntilItLeaves function. The hotspots are very close to each other.
Any tips for solving this?

Code: ags

function hClassroomWindow_MouseMove()
{
  if(cPlayer.ActiveInventory == null && gInventory.Visible == false)
  {
  mouse.SaveCursorUntilItLeaves();
  mouse.Mode=eModeUsermode1;  
  }
  
}

dayowlron

Not sure about the problem it is giving you, but what happens if you add
Code: ags
&& mouse.Mode != eModeUsermode1
to the if condition?

Code: ags

function hClassroomWindow_MouseMove()
{
  if(cPlayer.ActiveInventory == null && gInventory.Visible == false && mouse.Mode != eModeUsermode1)
  {
  mouse.SaveCursorUntilItLeaves();
  mouse.Mode=eModeUsermode1;  
  }
  
}
 
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

Khris

The best way to fix this depends on what you're trying to implement. What is eModeUsermode1? Some kind of exit arrow?
I'm asking because 99% of the time, using _MouseMove() is a bad idea anyway.

Deep Dark Fears

Quote from: dayowlron on Tue 08/05/2018 20:36:47
Not sure about the problem it is giving you, but what happens if you add
Code: ags
&& mouse.Mode != eModeUsermode1

to the if condition?

It works fine. Thank you very much.

I will upload screenshot and I will try to describe my problem for future users.

https://ibb.co/dngUjS

The black line is cursor way.
As you can see is going through two hotspots and if the movement of cursor is very fast (but sometimes it doesn't need to be) the cursor is stuck in a specific cursor mode. In my code is it Usermode1.

!!! I do not own this graphic (room background). It only used for my individual testing. !!!

Deep Dark Fears

Quote from: Khris on Tue 08/05/2018 20:55:00
The best way to fix this depends on what you're trying to implement. What is eModeUsermode1? Some kind of exit arrow?
I'm asking because 99% of the time, using _MouseMove() is a bad idea anyway.

This cursor is to make a exploring the room more comfortable. Like in Kathy Rain game and others (when the cursor move over object that you can do something with him, then the cursor is different).

ManicMatt

Is it just to make the cursor highlight there is something you can click on? Because I think that's a feature AGS has without the need to script anything iirc.

Deep Dark Fears

Quote from: ManicMatt on Tue 08/05/2018 21:06:43
Is it just to make the cursor highlight there is something you can click on? Because I think that's a feature AGS has without the need to script anything iirc.

Yes, exactly. Is only for telling the player that in this place he/she can click on something.
As for feature, I couldn't find it.

ManicMatt

Double click your chosen mouse cursor, in the properties tab, it says "AnimateOnlyOnHotspots", make sure that's set to True. Then under image you select the standard cursor image. Then view you need to create a view for your highlighted mouse cursor.

Deep Dark Fears

Quote from: ManicMatt on Tue 08/05/2018 22:23:57
Double click your chosen mouse cursor, in the properties tab, it says "AnimateOnlyOnHotspots", make sure that's set to True. Then under image you select the standard cursor image. Then view you need to create a view for your highlighted mouse cursor.

Thank you for pointing this option for me. It could be very useful.
For some reasons I can't get this option work for me. I set Animate and AnimateOnlyOnHotspots to true, I also set Image and View but when I move cursor over hotspot, nothing happen.





Did I screw up with the view?

Also I have few question about this option:
1. It applies characters too?
2. Could I set this option on/off using the script?

Khris

When you use AnimateOnlyOnHotspots, the game will animate the cursor but keep the current cursor mode; you need to set those options for the original cursor modes, not eModeUsermode1. Using AnimateOnlyOnHotspots means you no longer need any _MouseMove() code, or additional mouse modes.
It also means you can use hClassroomWindow_Interact to handle the click, as opposed to hClassroomWindow_Usermode1 or whatever.

Quote from: Deep Dark Fears on Tue 08/05/2018 23:39:11
1. It applies characters too?
2. Could I set this option on/off using the script?

1. Yes, depending on the circumstances the word "hotspot" refers not just to painted background hotspots but all interactive areas, namely hotspots, objects and characters.
2. No, if you want to do that you have to script it yourself.

In general: when you want to implement global behavior, you never, ever (NEVER, EVER) do it on a per-hotspot basis. That's also true for other engines or programming languages, btw. Even if AGS didn't have AnimateOnlyOnHotspots, you could easily implement it yourself using variables, GetLocationType() and repeatedly_execute().

ManicMatt

Yeah sorry, when I said chosen mouse cursor, I meant walk, look etc. I assumed you'd done away with your mouse over script and custom mouse cursor after I said it's not needed. I shouldn't assume. :)

Deep Dark Fears

Quote from: ManicMatt on Wed 09/05/2018 08:07:42
Yeah sorry, when I said chosen mouse cursor, I meant walk, look etc. I assumed you'd done away with your mouse over script and custom mouse cursor after I said it's not needed. I shouldn't assume. :)

Don't worry. I should check if such option is available and do little more experimenting by myself.

Quote from: Khris on Wed 09/05/2018 02:30:59
1. Yes, depending on the circumstances the word "hotspot" refers not just to painted background hotspots but all interactive areas, namely hotspots, objects and characters.
2. No, if you want to do that you have to script it yourself.

1. For me is hotspot, object and character
2. Ok. And last thing (I hope). If I add a option for player if they don't want any help (like in a very old games where you need to click everywhere to check if is there something to do) then I just write in script this Mouse.ChangeModeView(eModeWalkTo, -1)?

Khris

1. Like I said, the manual (and people) use the word interchangeably for either Hotspots specifically, or active areas in general. It can mean either, depending on the context. AnimateOnlyOnHotspots refers to all three types.

2. Yes, looks that way.


SMF spam blocked by CleanTalk