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
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.