Can someone help me editing this ahk script?

Ask gaming related questions (AHK v1.1 and older)
rwallhacker0
Posts: 7
Joined: 18 May 2018, 17:49

Can someone help me editing this ahk script?

18 May 2018, 18:02

So this is a Color Change Detection bot that send Left Click when the color in the center of the screen changes.
It uses just 1 pixel in the middle of the screen, and my question is, can i make it to Follow with the mouse the found pixel?
Sorry my english :v

Code: Select all

sens:=10
delz:=1
holdtiem:=1
crossset:=0
;color split
SplitRGBColor(RGBColor, ByRef Red, ByRef Green, ByRef Blue)
{
    Red := RGBColor >> 16 & 0xFF
    Green := RGBColor >> 8 & 0xFF
    Blue := RGBColor & 0xFF
}

SplitBGRColor(BGRColor, ByRef Red, ByRef Green, ByRef Blue)
{
    Red := BGRColor & 0xFF
    Green := BGRColor >> 8 & 0xFF
    Blue := BGRColor >> 16 & 0xFF
}

;Menu loop
loop
{
GetKeyState, state, F10
if state = D
{
SoundPlay, %A_ScriptDir%\8.mp3
sleep 2000
ExitApp
}

GetKeyState, state, F11
if state = D
{
trigger:=false
}

GetKeyState, state, Insert
if state = D
{
trigger:=true
}

;Beta trigger
if !GetKeyState("RButton") && trigger==true
{
sleep 50
MouseGetPos, oneX, oneY 
PixelGetColor, colorone, oneX+crossset, oneY+crossset
SplitRGBColor(colorone, oneRed, oneGreen, oneBlue)
}

if GetKeyState("RButton") && trigger==true
{
sleep 1
MouseGetPos, twoX, twoY 
PixelGetColor, colortwo, twoX+crossset, twoY+crossset
SplitRGBColor(colortwo, twoRed, twoGreen, twoBlue)

if (((oneRed-sens)<=twoRed) && ((oneRed+sens)<=twoRed)) or (((oneRed-sens)>=twoRed) && ((oneRed+sens)>=twoRed)) or (((oneGreen-sens)<=twoGreen) && ((oneGreen+sens)<=twoGreen)) or (((oneGreen-sens)>=twoGreen) && ((oneGreen+sens)>=twoGreen)) or (((oneBlue-sens)<=twoBlue) && ((oneBlue+sens)<=twoBlue)) or (((oneBlue-sens)>=twoBlue) && ((oneBlue+sens)>=twoBlue))
{
sleep delz
DllCall("mouse_event", uint, 2, int, 0, int, 0, uint, 0, int, 0)
sleep holdtiem
DllCall("mouse_event", uint, 4, int, 0, int, 0, uint, 0, int, 0)
}
}
}
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Can someone help me editing this ahk script?

18 May 2018, 18:48

https://autohotkey.com/docs/commands/MouseMove.htm

accepts x y coordinates as parameters, so you can stuff the xy coordinates of your pixelgetcolor result in there and have the mouse move automatically
rwallhacker0
Posts: 7
Joined: 18 May 2018, 17:49

Re: Can someone help me editing this ahk script?

18 May 2018, 19:44

Hmm, its not my code and i really dont know how to do that, could you give me an example please? xD

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 98 guests