You know the problem: there is no hotkey in the game to press a button, for example close a frequently used dialog. With AutoHotkey you can easily have ESC close your dialog: you find out if the dialog is open with PixelGetColor or ImageSearch. If not you just send ESC. But if you find it then you send a click to the close button on your dialog. To do that you use the coordinates you find with ImageSearch or you simply use hardcoded coodinates because the dialog is always in the same position.
This usually works as a charm but now I'm playing this game Inquisitor and despite my efforts I AM COMPLETY LOST!.
I cannot get a grip on the position of the Mouse in this game!
This is a fullscreen game and I play this game at 1280x720 (A_ScreenWidth / A_ScreenHeight) on a 1920x1080 monitor. My second monitor (to the left) is also 1920x1080.
Testcase 1: Mouse Coordinates
Let's get the mouse coordinates with a simple hotkey
Code: Select all
f1:: MouseGetPos x,y SetTooltip(x . "," . y,3000) return
We Alt-Tab to the game and see the cursor in the center of the screen.
Press F1 -> 640,360 This looks good!
Move the mouse to the left a little -> 613,360 still good
Move the mouse up a little -> 613,340 still good
Move the mouse down a little -> 611,430 still good
Move the mouse to the right -> 834,363 still good
No problems here, right!?
Move the mouse to the left edge -> 36,340 still good
Now we bump the edge with the mouse -> -50,340 BANG! What's this? There you see my problem...
The cursor is stuck at the left but we move the mouse further left -> -130,340 The x decreases
Further left -> -530,340
The cursor is still at the left edge, we move the mouse to the right so the cursor is not touching the edge -> -350,340 Still negative!
We Alt-Tab out of the game and then into the game again. The cursor is in the center again and the x,y values are good.
This time we test the right side but we cannot get the x to exceed 1079. We also test the top and the bottom but y is always between 0 and 719. But it's not perfect because when we move the mouse to the bottom, reaching 719 and then all the way up again just a few pixels before the top edge, the y reads 63 instead of 2 or 3.
There is one thing left to test. How far can we move the mouse to the left? How negative can we get the number? Well, that's -1920. That's interesting so apparantly the game is moving the mouse into the secondary monitor!
Testcase 2: MouseMove
Let's try moving the mouse:
Code: Select all
F2::MouseMove, 640, 360, 0
Move the mouse to the left and press F1 -> 613,360
We press F2 -> Nothing happens!
We press F1 again -> 640,360
Let's try relative moving, 1 pixel to the right:
Code: Select all
F3::MouseMove, 1, 0, 0, R
We press F1 -> 640,360
We press F3 -> Nothing happens!
We press F1 -> 641,360
We press F3 -> The mouse moves! But it's not one pixel, it moved appx. 210 pixels to the right
We press F1 -> 642,360
We press F3 -> The mouse moves 210 pixels to the right again
We press F1 -> 643,360
I can show more testcases that show weird behavior but let's stop for now.
Does anyone knows what is going on with this game? Any ideas? A very low level way of moving the mouse? A tool to hook into the coordinate system of a game? Poke/cheat for the x,y values in memory? Anything...