Author Topic: AHK pixel detection help  (Read 2041 times)

0 Members and 1 Guest are viewing this topic.

kleankanteen

  • Poptart
  • *
  • Posts: 7
    • View Profile
AHK pixel detection help
« on: July 21, 2012, 03:48:17 am »
Can someone please make me a ahk pixel detection script that does the following.

While holding F it will continuously scan near the center of the screen 1900 x 1080

If it detects red or a variation of red it will right click once.

Is that within someones ability to create?

Thanks

kleankanteen

  • Poptart
  • *
  • Posts: 7
    • View Profile
Re: AHK pixel detection help
« Reply #1 on: July 21, 2012, 04:19:46 am »
I found a similar script.

H::
Click down

goto, start

start:

PixelSearch, Px, Py, 1045, 562, 1165, 570, 0x2727C6, 0, Fast
If ErrorLevel = 0
   goto end
Else
{
sleep 150
goto start
}

end:

Can someone modify this to while pressing and holding F it scans, and if detects red it right clicks once?  I can tweak it once I get a basic script going.

Thanks

ZOldDude

  • The Unknown Rank!
  • Administrator
  • MasstKer
  • *
  • Posts: 20874
  • Old School TKC
    • View Profile
    • Admin
Re: AHK pixel detection help
« Reply #2 on: July 21, 2012, 04:52:38 am »
Quote
H::
Click down

goto, start

*While we crash and burn, small, low tech, agrarian societies such as the Hmong in the mountains of Laos will continue on without so much as blinking an eye.*

[TKC]Symantic

  • The Indifferent Character
  • The Central Committee
  • Heckler
  • *
  • Posts: 1647
  • I can has personal text?
    • View Profile
Re: AHK pixel detection help
« Reply #3 on: July 21, 2012, 08:40:28 am »
Can someone please make me a ahk pixel detection script that does the following.

While holding F it will continuously scan near the center of the screen 1900 x 1080

If it detects red or a variation of red it will right click once.

Is that within someones ability to create?

Thanks

Good idea, +1 for that. I would totally help you if i was fluent in AHK scripting.

Im not sure what the pixelsearch function does, it looks like its taking 2 X's and Y's and searching between those values for a color of 0x2727C6? if so, then it looks like you would be able to add a mouse_down_left_key right under "if errorlevel=0" and just above "goto end".


all i wana say is.. medic, can i ask you a question? lol.
Enjoy your creative game-play, whatever that may include.

Buster

  • Klass Klown
  • ***
  • Posts: 295
  • Kool Kat
    • View Profile
Re: AHK pixel detection help
« Reply #4 on: July 22, 2012, 03:21:31 am »
might do better asking on the AHK forums, dont ya think  :icon_thumbsup

ZOldDude

  • The Unknown Rank!
  • Administrator
  • MasstKer
  • *
  • Posts: 20874
  • Old School TKC
    • View Profile
    • Admin
Re: AHK pixel detection help
« Reply #5 on: July 22, 2012, 04:03:03 am »
Quote
H::
Click down

goto, start
You wanted to change the HOTKEY to F....from H.  :icon_rolleyes2

http://www.autohotkey.com/docs/

*While we crash and burn, small, low tech, agrarian societies such as the Hmong in the mountains of Laos will continue on without so much as blinking an eye.*

kleankanteen

  • Poptart
  • *
  • Posts: 7
    • View Profile
Re: AHK pixel detection help
« Reply #6 on: July 24, 2012, 01:42:59 am »
Yes F and H were easy to switch, thanks. lol

But will it only scan once or will it continue to scan while holding F?

ZOldDude

  • The Unknown Rank!
  • Administrator
  • MasstKer
  • *
  • Posts: 20874
  • Old School TKC
    • View Profile
    • Admin
Re: AHK pixel detection help
« Reply #7 on: July 24, 2012, 03:28:06 am »
Quote
If ErrorLevel = 0
   goto end
Else
{
sleep 150
goto start
}

end:

*While we crash and burn, small, low tech, agrarian societies such as the Hmong in the mountains of Laos will continue on without so much as blinking an eye.*