Help with PixelSearch at Mouse position, not working in game window correctly - Freelancer game

Ask gaming related questions (AHK v1.1 and older)
Deadscale
Posts: 1
Joined: 14 Dec 2015, 14:05

Help with PixelSearch at Mouse position, not working in game window correctly - Freelancer game

14 Dec 2015, 14:28

Howdy

Looking for some help, I'm currently playing Freelancer, a space game, and after getting back into it I decided to try and use PixelSearch to make mining easier but I'm having a lot of trouble getting it to work because the Mouse Position seems to be incorrect.

For those who haven't played it, you aim your turrets with your cursor, and the cursor turns White and Spins when you aim at an asteroid, When this happens you fire (Right click) and then tractor beam stuff in.

This is my current code (Please disregard the PixelSearch part, as that works fine outside of the game so I'm sure that isn't the issue) And I'm running the game in Windowed mode

Code: Select all

NumpadAdd::Suspend, Toggle
SendMode Input
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen

]::
Loop {
            MouseGetPos, xpos, ypos
            PixelSearch, FoundX, FoundY, (%xpos% -5), (%ypos% -5), (%xpos%+5), (%ypos%+5), 0xFFFFFF, 10, Fast RGB
                if ErrorLevel = 0
                    {
                     Send {RButton down}
                     Sleep 100
                     Send {RButton up}
                     Sleep 2000
                     }
                 return
             }
 
^!z::  ; Control+Alt+Z hotkey.
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%, RGB
MsgBox The color at the current cursor position is %color%, X%MouseX% Y%MouseY%.
return
After it wasn't working I added the "scan on key-press" part and when that failed, I added the last part in to check where the mouse was and what color it was aiming at, The color never matched up to what I was aiming at (For one, there's a huge targeting reticule that's white and spinning, but often it'd pick up the space background or my ships black color instead). The only weird thing is that, When a cut-scene plays/the intro movies play the cursor gives the correct color/coordinates, but the second you're in the game/at menu's it starts to fuck up, I'm assuming it's some sort of Anti-cheat or the games resolution is botched. but I don't really know.

I've tried all the different Coordmode's and none have worked, so any suggestions?

EDIT: I decided to try and see what MouseGetPos was actually returning visually, so I found a script that draws a circle around the current GetMousePos, the results are strange... At first it looks like the position of the mouse changes depending on your current resolution, but the second you put your mouse Outside the game window and back in, the position changes. Think this one's an impossible one.
User avatar
evilC
Posts: 4824
Joined: 27 Feb 2014, 12:30

Re: Help with PixelSearch at Mouse position, not working in game window correctly - Freelancer game

16 Dec 2015, 13:35

So you have tried this in windowed mode and still you get strange results?

Rather than trying to draw stuff on-screen, I would just run the following script:

Code: Select all

Loop {
MouseGetPos, x, y
Tooltip % "X: " x ", Y: " y
Sleep 100
}
When trying to mine, is the "cursor" always in the middle of the screen (FPS style) or is it an actual cursor you move around the screen?
If the latter, it's entirely possible that the in-game cursor is unrelated to the windows cursor. I can see why this may be different in cut-scenes.
Try putting the real mouse cursor at the edge of the monitor, then tab into the game - where is the turret cursor? Move the turret cursor, tab out. Has the real cursor moved?
Another question is - can you endlessly move the turret cursor in one direction? If so, it is unrelated to the windows cursor, as otherwise the turret cursor would stop when the windows cursor hit the edge of the screen.
S1lver
Posts: 23
Joined: 07 Nov 2020, 04:14

Re: Help with PixelSearch at Mouse position, not working in game window correctly - Freelancer game

15 Jun 2022, 17:30

Deadscale wrote:
14 Dec 2015, 14:28
Howdy

Looking for some help, I'm currently playing Freelancer, a space game, and after getting back into it I decided to try and use PixelSearch to make mining easier but I'm having a lot of trouble getting it to work because the Mouse Position seems to be incorrect.
Did you figure it out. I find this AHK scripting so buggy. you can follow the guides on there homepage, but then it doesn't work as they say. its very misinformation. however. I'm trying to do something like your script just with PixelSearch and Controlclick command. but it cannot work with controlclick only with click. which moves my cursor to another window (the window I wants to click in)



[Mod edit: Added /quote tag to close the quote.]

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 105 guests