Add MouseOver delay to prevent info bubbles

Ask gaming related questions (AHK v1.1 and older)
User avatar
yz1981
Posts: 3
Joined: 28 Nov 2022, 14:54

Add MouseOver delay to prevent info bubbles

Post by yz1981 » 28 Nov 2022, 16:02

Hi,

I am trying to create a script that will simply add a 200ms delay to each MouseOver event in the game Anno 1800.

I love this game (it is a city building/economic sim) but what drives me bonkers is that every UI element (and there are dozens) will pop up an info bubble every time your mouse cursor moves over them.
Even when you just want to move your mouse to another part of the screen, every element the mouse cursor touches will briefly pop up.

The result is that the screen flashes with all this unasked for pop ups constantly.

Why there is no slight delay to prevent unintentional info dialog from appearing is beyond me.
Even more so since the previous game, Anno 1404, had a "Tooltip delay" as a slider in the settings!

I have now asked the official channels literally a dozen times for this feature, even had an official response, but it does not look like this is ever going to happen.

So, time to take things into my own hands.
Reading AHK's docs and forum I hope it can do this, but wanted to check here first if this is even feasible.

The game uses its own proprietary engine, but does support "windowed" and "borderless window" modes.

Can someone point me in the right direction about which command or module would work in this situation?
An example would be greatly appreciated.

Cheers,

Ysbrand

User avatar
mikeyww
Posts: 27061
Joined: 09 Sep 2014, 18:38

Re: Add MouseOver delay to prevent info bubbles

Post by mikeyww » 28 Nov 2022, 18:14

Welcome to this AutoHotkey forum!

You're in luck! That's because I am unaware of a way to use AutoHotkey to prevent a window from appearing. I say "luck" because someone usually proves me wrong at this point! :)

User avatar
yz1981
Posts: 3
Joined: 28 Nov 2022, 14:54

Re: Add MouseOver delay to prevent info bubbles

Post by yz1981 » 28 Nov 2022, 19:21

mikeyww wrote:
28 Nov 2022, 18:14
Welcome to this AutoHotkey forum!

You're in luck! That's because I am unaware of a way to use AutoHotkey to prevent a window from appearing. I say "luck" because someone usually proves me wrong at this point! :)
Thank you. It's like your doctor congratulating you because they are going to name a new disease after you... ;)

I understand what you're saying. I was thinking along the lines of
- continuesly capture mouse coordinates
- disabling all mouse input (movement and clicks)
- capturing the left and right click and somehow making them execute on the coordinates recorded.

I would actually be fine with mouseover to not fire at all. As in: the mouse position is never communicated to the app. Of course I'd still need to see the cursor (replace?) and be able to click and scroll.

Oh, and ideally, keep the functionality where the screen pans left and right when your cursor hits the edge of the screen. But that's optional and could be worked around with using keyboard arrows.

Cheers.

User avatar
mikeyww
Posts: 27061
Joined: 09 Sep 2014, 18:38

Re: Add MouseOver delay to prevent info bubbles

Post by mikeyww » 28 Nov 2022, 19:54

:)
You have some interesting ideas.

You may want to check this.

viewtopic.php?f=19&t=26137

Here is some proof of concept, a demonstration with Notepad, just showing a disabling of the window based on a condition that you define.

Code: Select all

#SingleInstance Force
wTitle = ahk_exe notepad.exe
Loop {
 WinWaitActive, %wTitle%
 SetTimer, Go, 30
 SoundBeep, 1500
 WinWaitNotActive
 SetTimer, Go, Off
 SoundBeep, 1000
}
Go:
last := zone
MouseGetPos,, y
If (last = zone := y < 74)
 Return
If zone {
 WinSet, Disable,, %wTitle%
 ToolTip, Disabled
} Else {
 WinSet, Enable,, %wTitle%
 ToolTip
}
Return
Maybe a bit better:

Code: Select all

#SingleInstance Force
Global wTitle := "ahk_exe notepad.exe"
OnExit("done")
Loop {
 WinWait, %wTitle%
 SetTimer, Go, 30
 SoundBeep, 1500
 WinWaitClose
 SetTimer, Go, Off
 SoundBeep, 1000
}
Go:
CoordMode, Mouse
WinGetPos,, y,,, %wTitle%
MouseGetPos,, my, hWnd
If WinExist(wTitle " ahk_id" hWnd) && my >= y && my < y + 74 {
 WinSet , Disable
 ToolTip, Disabled
} Else done()
Return

done(exitReason := "", exitCode := "") {
 WinSet, Enable,, %wTitle%
 ToolTip
}
Now about that disease....

8-)

User avatar
yz1981
Posts: 3
Joined: 28 Nov 2022, 14:54

Re: Add MouseOver delay to prevent info bubbles

Post by yz1981 » 28 Nov 2022, 21:19

mikeyww wrote:
28 Nov 2022, 19:54

Now about that disease....

Getting there... keep going, (I'm way out of my depth here)

You're doing great (can I say that I am impressed by your helpfulness and effort on this forum)

For encouragement, let me give you some fun facts about swearing in the Dutch language:

Did you know.... that, besides the universal blasphemous and scatological themes, the Dutch delight in wishing all manner of diseases on to each other?

Many or so old that the disease itself has been eradicated for over 60 years, but lives on on the lips of dock workers, fish wives, accountants and royalty alike.

Since this is a civilized forum I will not provide any example here, merely refer anyone who likes a good laugh to search for "Dutch profanity" on Wikipedia.

User avatar
mikeyww
Posts: 27061
Joined: 09 Sep 2014, 18:38

Re: Add MouseOver delay to prevent info bubbles

Post by mikeyww » 29 Nov 2022, 06:32

Interesting cultural phenomenon! I will check up on that, and may you never have smallpox! :) Perhaps we would call this a meme today.

It's your turn to take over the coding! If you determine how to identify the target UI elements, you can code it so that AHK knows when to disable and re-enable the window (in advance, of course).

Good luck! :thumbup:

Post Reply

Return to “Gaming Help (v1)”