Code: Select all
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
#Persistent
#MaxThreadsPerHotkey 2
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
plot(x1, y1, a, r, byref x2, byref y2) {
rad := (a * 0.01745329252)
x2 := (x1 - sin(rad) * r)
y2 := (y1 + cos(rad) * r)
}
xMidScrn := A_ScreenWidth //2
yMidScrn := A_ScreenHeight //2
yMidScrn := yMidScrn - 2
toggle := False
f1 UP::
toggle := !toggle
loop{
If (!toggle) {
break
}
coordmode mouse
coordmode pixel
setformat floatfast, 0
arc := 5 , radius := 53
loop {
If (!toggle) {
break
}
plot(xMidScrn, yMidScrn, a_index * arc, radius, x2, y2)
PixelSearch, oX, oY, x2, y2, x2, y2, 0xFFFFFF , 30 , Fast RGB
if !ErrorLevel
{
;mousemove oX, oY
psX := oX
psY := oY
break
}
}
loop
{
If (!toggle) {
break
}
PixelSearch, oX1, oY1, psX, psY, psX, psY, 0xFF0000 , 70 , Fast RGB
Sleep 100
} until (!ErrorLevel) || (a_index = 50)
Send {Space down}
Sleep 30
Send {Space up}
}
return
I also thought that I could use the pixelsearch to find the white just like I'm using it right now, and for finding the red and pressing space I could just do
Code: Select all
loop {
plot(xMidScrn, yMidScrn, a_index * arc, radius, x2, y2)
PixelSearch, oX, oY, x2, y2, x2, y2, 0xFFFFFF , 20, Fast RGB
if !ErrorLevel
{
pixelgetcolor white, oX, oY, rgb
break
}
}
loop
{
pixelgetcolor c, x2, y2, rgb
} until (white <> c)
Send {Space down}
Sleep 10
Send {Space up}
But the same thing as before happens, it keeps pressing space even if appears that the white is still white and that's probably because it changed to a diff shade of white.
So I got stuck with pixelsearch, and while works 5/10 of the times it's not optimal and that is because it can't search fast enough.
For you visuals out there check out this GIF (that is not the actual speed, it appears to be slow cause I've used mousemove to track down it's path)
Is there anything that we could do? or this is how far we can reach with AHK?
Thanks!!