AHK Veteran Puzzled by Mouse in Inquisitor Game

Ask gaming related questions
Maxol
Posts: 6
Joined: 25 Apr 2019, 05:36

AHK Veteran Puzzled by Mouse in Inquisitor Game

23 Aug 2019, 05:54

Yes, I'm an AutoHotkey veteran and I love to use it to improve playbility of games! Remapping keys of course, autosaves, taking screenshots and showing these directly on the 2nd monitor, finding images, scanning pixels, better scrolling through shop items, move items from one character to another, and then there's clicking, a lot of clicking, on frequently used buttons that I map with a hotkey to avoid using the mouse...

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 :D 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
Note: The SetTooltip function shows the result on the second monitor while the game is running fullscreen

We Alt-Tab to the game and see the cursor in the center of the screen.
Press F1 -> 640,360 This looks good! :P
Move the mouse to the left a little -> 613,360 still good :P
Move the mouse up a little -> 613,340 still good :P
Move the mouse down a little -> 611,430 still good :P
Move the mouse to the right -> 834,363 still good :P

No problems here, right!? :P

Let's continue:
Move the mouse to the left edge -> 36,340 still good :P
Now we bump the edge with the mouse -> -50,340 BANG! What's this? :crazy: 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. :idea: 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
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.

Move the mouse to the left and press F1 -> 613,360
We press F2 -> Nothing happens! :!:
We press F1 again -> 640,360 :?:

That's weird....

Let's try relative moving, 1 pixel to the right:

Code: Select all

F3::MouseMove, 1, 0, 0, R
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.

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... :(
John
Posts: 75
Joined: 10 Apr 2014, 08:59

Re: AHK Veteran Puzzled by Mouse in Inquisitor Game

23 Aug 2019, 07:40

Is it possible that the game writes to what AHK's mousegetpos get's it's info from? I.e., for some inexplicable reason, the game overwrites the memory address that holds the cursor location? I think it could be worth trying to get the position with this https://rosettacode.org/wiki/Mouse_position#AutoHotkey will give you different results.
If that doesn't work then you could detect when the mouse is in a position where it's panning and offset the location of received position by however much was panned.
As for the tabbing behavior, perhaps the game 'rehooks' whenever the game get's focus? You could test that by having your script restart with each alt-tab and if it responds as it did prior to tabbing.
Just some ideas :thumbup:
Maxol
Posts: 6
Joined: 25 Apr 2019, 05:36

Re: AHK Veteran Puzzled by Mouse in Inquisitor Game

23 Aug 2019, 08:09

Thanks for the help, appreciate any help! :P
John wrote:
23 Aug 2019, 07:40
As for the tabbing behavior, perhaps the game 'rehooks' whenever the game get's focus? You could test that by having your script restart with each alt-tab and if it responds as it did prior to tabbing.
The game definitely rehooks/resets after focus gain/lost. Doesn't bother me, if anything, it helps me get a fresh starting point for testing this issue... ;)
John wrote:
23 Aug 2019, 07:40
Is it possible that the game writes to what AHK's mousegetpos get's it's info from? I.e., for some inexplicable reason, the game overwrites the memory address that holds the cursor location?
That's what I suspect too, this game is doing something on a very low level, obscuring memory locations
John wrote:
23 Aug 2019, 07:40
I think it could be worth trying to get the position with this https rosettacode.org /wiki/Mouse_position#AutoHotkey Broken Link for safety will give you different results.
I tried them but no.... :thumbdown: I was hopefull when I noticed the GetPhysicalCursorPos function but the result is exactly the same as the basic AHK version and the GetCursorPos() function
John wrote:
23 Aug 2019, 07:40
If that doesn't work then you could detect when the mouse is in a position where it's panning and offset the location of received position by however much was panned.
Thought about that too but the behavior is much more erratic then the testcases I presented. If I move the cursor one pixel with mousemove, the cursor frequently jumps into a corner and it is very, very unpredictable
John
Posts: 75
Joined: 10 Apr 2014, 08:59

Re: AHK Veteran Puzzled by Mouse in Inquisitor Game

27 Aug 2019, 02:49

Given the cursor doesn't go berserk in the game itself then it's keeping track of the position properly within the game's memory so, I'd suggest giving a go at it with Cheat Engine or if VAC goes bananas from it then there's quite a few new CE alternatives that have been released that don't get you instabanned. Still if that works then everything else becomes progressively more trivial.
Maxol
Posts: 6
Joined: 25 Apr 2019, 05:36

Re: AHK Veteran Puzzled by Mouse in Inquisitor Game

27 Aug 2019, 04:44

John wrote:
27 Aug 2019, 02:49
I'd suggest giving a go at it with Cheat Engine or if VAC goes bananas[...]
I don't play online so VAC is not an issue. The Cheat Engine seems the way to go then...<big sigh>...never really used it but I found tutorials, that's a little project that will take some time :D

There is something else I found though, you know about the reposition cursor after Alt-Tabbing out en into the game? Well, I always have these hotkeys running to Minimize, Maximize and Restore the Active Window:

Code: Select all

#Down::WinMinimize, A
#up::    
    WinGet MX, MinMax, A
    If MX
        WinRestore A
    Else 
        WinMaximize A
It turns out that pressing #up in the game centers the cursor! :!: WinMaximize A does that, interesting...

Return to “Gaming”

Who is online

Users browsing this forum: Bing [Bot], Jara, night45 and 28 guests