You might want to try the game in window mode if your running fullscreen,
I found that under window mode my game worked better for finding pixel colors
Here is a bit of code i have at the begging of my script
It has no allowance for the WIDTH of the screen yet first thing first getting everything to work under messing with the Y axis then i'll worry about width if i really want to.
; Windowed Mode - Original 1920:1080
WMO:="0" ; Window Mode On 1 = yes | 0 = No
WME:="1" ; Window Mode Extended Display ( 2nd, 3rd, 4th Monitor ) 1 = yes | 0 = No
WMD:="0" ; Window 7 Desktop 1 = yes | 0 = | No Window Must be Snapped into place !
WMXLD:="0" ; Left Allowance Width
WMXRD:="0" ; Right Allowance Width
SysGet, WMYTD, 4 ; Windows Top Border Width
SysGet, WMX, 32
SysGet, WMY, 33
if WMO = 1
{
ToolTip, Windows Mode Active, 10, 8
}
else If WME = 1
{
WMYBD = 0
WMXLD = 0
WMXRD = 0
ToolTip, Windows Extended Display Mode Active, 10, 8
}
else If WMD = 1
{
WMYBD:= "40" ; Adjustment for Task Bar
}
else If (WMO = 0 AND WMD = 0 AND WME = 0)
{
WMX = 0
WMY = 0
WMXLD = 0
WMXRD = 0
WMYTD = 0
WMYBD = 0
ToolTip, Full Screen Mode Active, 10, 8
}
This is a snippet of what my click would look like ( i editted a few things i dont want to give away for my game )
x :=(8+(WMX)+(WMXLD))
y := (1026+(WMY)-(WMYBD))
click %x% %y%
I used this to get my image created
Original
<!-- m -->
http://www.autohotke... ... s&start=15<!-- m -->
Modification just enter the coordinates vs click and drag
Suggestion make the search area 5 pixels in x,y axis larger then actual image
edit the *N variable start at something rediculous like 250 work your way down if you get a hit to an acceptable number that works test. This also depends how your game functions could also try editting all the other pixels in the image that arnt use to find the image your looking for to a specific color then set TransN to that color atleast thats how i think that works ( still a little stuck on this my self )
Sleep, 1000
SetFormat Integer,H
CoordMode Mouse, Screen
CoordMode Tooltip, Relative
CoordMode Pixel, Screen
file = C:\Users\(UserName)\Desktop\Test7.bmp Easy way to get this open my computer / documents navigate to where you want the image to go left click to nav bar, as if it was the internet ;p then copy past that here with "\filename.bmp" at the end.
SetTimer, Clock, 1000
start_x:=2799
start_y:=837
end_x:=2955
end_y:=857
CurrentRunNumber+=1
ClockCounter=0
ToolTip,Retreiving Colors...,10,8
TrayTip,,Retreiving Colors...,,1
width := end_x - start_x
height := end_y - start_y
Loop %height% {
pixely := start_y + height - A_index - 1 ; bitmaps are written backwards
Loop %width% {
pixelx := start_x + A_index - 1
PixelGetColor color,pixelx,pixely ; get the BGR value
StringTrimLeft color, color, 2 ; remove 0x
colorlist = %colorlist%%color%
}
}
TrayTip,,Saving Bitmap...,,1
ToolTip,Saving Bitmap...,10,8
WriteBMP(file,colorlist,width,height,0)
TrayTip,,Done!,,1
ToolTip,Done!...,10,8
Msgbox Done
Sleep, 5000
Return
WriteBMP(file,colors,width=16,height=16,padded=0) {
If (!padded and StrLen(colors)/6 <> height*width ; check if we have the right number of pixels
or padded and StrLen(colors)/6 - (width&3)*height <> height*width)
MsgBox Pixel Mismatch!`nThe Height*Width specified does not match the number of pixels provided, or the padding is incorrect
If (!padded and (width&3)<>0) { ; bitmap needed but not provided with padding
Loop %height% {
StringMid row, colors, % width*6*A_index-5, % width*6
colorspadded := colorspadded row padhex(0x0,width&3) ; add 00 bytes
}
colors = %colorspadded%
}
; Create the actual bitmap, starting with the header
width := padhex(width +0,4) ; make width and height 4-byte words
height:= padhex(height+0,4)
; B M size reserved offbits bitsize planes bitcount (24 bit)...the rest is color table (0s)
BMPHex = 424d00000000000000003600000028000000%width%%height%01001800000000000000000000000000000000000000000000000000%colors%
Handle := DllCall("CreateFile",Str,file,Uint,0x40000000,Uint,0,UInt,0,UInt,4,Uint,0,UInt,0)
Loop % StrLen(BMPHex)//2 {
StringMid Hex, BMPHex, 2*A_Index-1, 2
DllCall("WriteFile",UInt,Handle, UCharP,"0x" Hex, UInt,1,UIntP,UnusedVariable,UInt,0)
}
DllCall("CloseHandle", Uint,Handle)
}
padhex(hex,bytes) { ; remove 0x, right-pad hex number to bytes length <= 4
If hex > 255
hex := (hex>>8) + ((hex&255)<<8) ; little endian coding
If StrLen(hex) & 1
StringReplace hex, hex, x
Else StringTrimLeft hex, hex, 2
hex = %hex%000000
StringLeft hex, hex, 2*bytes
Return hex
}
Clock:
ClockCounter++
{
If (BestTime<>9999)
{
If (GlobalFinishTime="")
{
ToolTip, Clock=%ClockCounter%`, RunNumber=%CurrentRunNumber%, 360, 8, 20
}
/*
Else
{
ToolTip, Clock=%ClockCounter%`, Finish:%GlobalFinishTime%`, BestTime=%BestTime%`, RunNumber=%CurrentRunNumber%, 360, 8, 20
}
*/
}
}
Return
; END Clock:
Other options
might be this......
<!-- m -->
http://www.autohotke...topic47691.html<!-- m -->