PixelSearch Mutliple with Loop

Get help with using AutoHotkey and its commands and hotkeys
Spacebroetchen
Posts: 1
Joined: 15 Aug 2018, 02:55

PixelSearch Mutliple with Loop

15 Aug 2018, 03:30

Hello Community.
I tried many different codes. No code worked at the moment.
At first I want to introduce to my problem and what I want:

I need a AHK Code that will search in my game for at least one but better two colorcodes.

As example I take this two:
0xfbffff and 0xc84346

If they are both present on the screen the program should "Send F" than sleep 3 seconds and send F again.
After this procedure the loop should start searching again. And if they find this two codes again it should send again the "F".


I tried it with 1 PixelSearch:

Code: Select all

init:
#NoEnv
#IfWinActive, Grand Theft Multiplayer
#SingleInstance, Force
#Persistent
#InstallKeybdHook
#UseHook
#KeyHistory, 0
#HotKeyInterval 2000
#MaxThreadsPerHotkey 2
CoordMode, Pixel, Screen, RGB
PID := DllCall("GetCurrentProcessId")
Process, Priority, %PID%, High

Col := 3

loop
{
    sleep, 500
    PixelSearch, x1, y2, 0, 0, A_ScreenWidth, A_ScreenHeight, 0xc84346, Col, Fast RGB
        if ErrorLevel = 0
        {
            Send F
            sleep, 3000
            Send F
            goto, init
        }
        if ErrorLevel = 2
        {
            goto, error
        }
}
return

error:
msgbox, There was a mistake in the loop.

Numpad7::pause
return
Numpad8::exitapp
return
May someone can help me out? Thank you very much.

Return to “Ask For Help”

Who is online

Users browsing this forum: return and 44 guests