Slow script; long if else statements and PixelGetColor. Can anyone help?

Ask gaming related questions (AHK v1.1 and older)
Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 03 Jun 2020, 08:22

I made a script to help with healing. I used pixels to check at what percentage the health is of the party members. Its starts checking 20% health of all the members, then 40% etcetera. However it is quite slow, can anyone help? There is probably a better alternative to all these if else statements, but I couldn't come up with it.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0

If not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}

#MaxThreadsperHotkey 2
#singleInstance, Force
toggle = 0


$e::	;________________________

PixelGetColor,zelf20, 50, 1371
PixelGetColor,zelf40, 68, 1371
PixelGetColor,zelf60, 86, 1371
PixelGetColor,zelf80, 104, 1371
PixelGetColor,zelf95, 120, 1371

PixelGetColor,party120, 50, 1380
PixelGetColor,party140, 68, 1380
PixelGetColor,party160, 86, 1380
PixelGetColor,party180, 104, 1380
PixelGetColor,party195, 120, 1380

PixelGetColor,party220, 50, 1389
PixelGetColor,party240, 68, 1389
PixelGetColor,party260, 86, 1389
PixelGetColor,party280, 104, 1389
PixelGetColor,party295, 120, 1389

PixelGetColor,party320, 50, 1399
PixelGetColor,party340, 68, 1399
PixelGetColor,party360, 86, 1399
PixelGetColor,party380, 104, 1399
PixelGetColor,party395, 120, 1399

PixelGetColor,party420, 50, 1408
PixelGetColor,party440, 68, 1408
PixelGetColor,party460, 86, 1408
PixelGetColor,party480, 104, 1408
PixelGetColor,party495, 120, 1408

If zelf20=0x2CFF00 ;
{
send, {\} 
}
else if party120=0x2CFF00 ;
{
send, {[}
}
else if party220=0x2CFF00 ;
{
send, {]}
}
else if party320=0x2CFF00 ;
{
send, {;}
}
else if party420=0x2CFF00 ;
{
send, {'}
}

else if zelf40=0x2CFF00 ;
{
send, {\}
}
else if party140=0x2CFF00 ;
{
send, {[}
}
else if party240=0x2CFF00 ;
{
send, {]}
}
else if party340=0x2CFF00 ;
{
send, {;}
}
else if party440=0x2CFF00 ;
{
send, {'}
}

else if zelf60=0x2CFF00 ;
{
send, {\}
}
else if party160=0x2CFF00 ;
{
send, {[}
}
else if party260=0x2CFF00 ;
{
send, {]}
}
else if party360=0x2CFF00 ;
{
send, {;}
}
else if party460=0x2CFF00 ;
{
send, {'}
}

else if zelf80=0x2CFF00 ;
{
send, {\}
}
else if party180=0x2CFF00 ;
{
send, {[}
}
else if party280=0x2CFF00 ;
{
send, {]}
}
else if party380=0x2CFF00 ;
{
send, {;}
}
else if party480=0x2CFF00 ;
{
send, {'} 
} 

else if zelf95=0x2CFF00 ;
{
send, {\}
}
else if party195=0x2CFF00 ;
{
send, {[}
}
else if party295=0x2CFF00 ;
{
send, {]}
}
else if party395=0x2CFF00 ;
{
send, {;}
}
else if party495=0x2CFF00 ;
{
send, {'} 
}

; Return / Get the color of the pixel at the X and Y coordinates / at the X and Y location party=  20 / 40 / 60 / 80


swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 03 Jun 2020, 09:20

its the 25 PixelGetSearches thats making ur script run slow, not the if statements
i dont understand ur script's logic. presumably the hotkeys heal each respective party member. so, sample 5 pixels at close to full hp, test if they're at close to full hp. if not, heal them

Code: Select all

$e::	;________________________
	healIfBelow95(120, 1371, "\") ; zelf
	healIfBelow95(120, 1380, "[") ; party1
	healIfBelow95(120, 1389, "]") ; party2
	healIfBelow95(120, 1399, ";") ; party3
	healIfBelow95(120, 1408, "'") ; party4
return

healIfBelow95(x, y, key) {
	PixelGetColor color, x, y, RGB
	if color != 0x2CFF00 ; if not green
		Send {%key%} ; heal
}

Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 03 Jun 2020, 09:36

Thank you for your reply. Well with these pixelcheckers I can choose the lowest HP partymember. Is there another way?

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 03 Jun 2020, 10:34

there is, with gdip

Code: Select all

#Include Gdip_All.ahk

pToken := Gdip_Startup()

$e::	;________________________
healMostInjured() {
	pBitmap := Gdip_BitmapFromScreen(x??? "|" y??? "|" w??? "|" h???) ; replace with coords
	
	Gdip_LockBits(pBitmap, 0, 0, w, h, stride, scan0, bmData)

	static xCoordThresholds := [???  ; 20%
							  , ???  ; 40%
							  , ???  ; 60%
							  , ???  ; 80%
							  , ???] ; 95%

	for each, x in xCoordThresholds
	{
		static yCoordHealKey := { ???: "\"  ; zelf
								, ???: "["  ; party1
								, ???: "]"  ; party2
								, ???: ";"  ; party3
								, ???: "'"} ; party4

		for y, key in yCoordHealKey
		{
			color := Gdip_GetLockBitPixel(scan0, x, y, stride)

			if color != 0x2CFF00 ; if not green
			{
				Send {%key%} ; heal
				goto end
			}
		}
	}

	end:
	Gdip_UnlockBits(pBitmap, bmData)
	Gdip_DisposeImage(pBitmap)
}
ull have to insert ur coords as offsets relative to the portion of the screen that ure clipping

Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 03 Jun 2020, 12:19

Thanks!!

What do I have to insert for these coords? : Gdip_BitmapFromScreen(x??? "|" y??? "|" w??? "|" h???) ;
I understand the rest.

The rectangle to be searched is from xy 50, 1371 to 120, 1408

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 03 Jun 2020, 12:30

Code: Select all

x1 := 50
y1 := 1371

x2 := 120
y2 := 1408

w := x2 - x1
h := y2 - y1

Gdip_BitmapFromScreen(x1 "|" y1 "|" w "|" h)

Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 03 Jun 2020, 15:03

Thanks again, very kind. I updated the script, when I launch it, it says: Error at line 28

#Include file "C:\.. (filepath).\Gdip_All.ahk" cannot be opened.

The program will exit.

I guess I have to download something? I'm not that of an expert at ahk.

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 03 Jun 2020, 16:12

yes, the gdip library is required
swagfag wrote:there is, with gdip
u can download it here https://github.com/mmikeww/AHKv2-Gdip
also read how #Include works
or paste the whole lib into ur script(not really recommended)

Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 04 Jun 2020, 05:04

It is not working, when I press 'e' nothing happens. It actually automatically exits the script. This is the current code:

I don't really know how gdip works. My original script I have the health of the party members inversely made (when 100% nothing is green, when 50% from left to right 50% filled with green and when dead 100% green). I first scanned the 20% pixels from all the party members and if no one was at that health it checks the 40% etcetera. I don't really know how to solve it.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0

If not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}

#MaxThreadsperHotkey 2
#singleInstance, Force
toggle = 0

#Include Gdip_All.ahk

pToken := Gdip_Startup()

$e::	;________________________


healMostInjured() {

x1 := 50
y1 := 1371

x2 := 120
y2 := 1408

w := x2 - x1
h := y2 - y1

	pBitmap := Gdip_BitmapFromScreen(x1 "|" y1 "|" w "|" h) ; replace with coords
	
	Gdip_LockBits(pBitmap, 0, 0, w, h, stride, scan0, bmData)

	static xCoordThresholds := [50  ; 20%
							  , 68  ; 40%
							  , 86  ; 60%
							  , 104  ; 80%
							  , 120] ; 95%

	for each, x in xCoordThresholds
	{
		static yCoordHealKey := { 1371: "\"  ; zelf
								, 1380: "["  ; party1
								, 1389: "]"  ; party2
								, 1399: ";"  ; party3
								, 1408: "'"} ; party4

		for y, key in yCoordHealKey
		{
			color := Gdip_GetLockBitPixel(scan0, x, y, stride)

			if color != 0x2CFF00 ; if not green
			{
				Send {%key%} ; heal
				goto end
			}
		}
	}

	end:
	Gdip_UnlockBits(pBitmap, bmData)
	Gdip_DisposeImage(pBitmap)
}

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 04 Jun 2020, 05:17

swagfag wrote:
03 Jun 2020, 10:34
ull have to insert ur coords as offsets relative to the portion of the screen that ure clipping
a 70x37 px screen clipping clearly doesnt have pixels located at
  • x

    Code: Select all

    , 86  ; 60%
    , 104  ; 80%
    , 120] ; 95%
  • y

    Code: Select all

    { 1371: "\"  ; zelf
    , 1380: "["  ; party1
    , 1389: "]"  ; party2
    , 1399: ";"  ; party3
    , 1408: "'"} ; party4
ure trying to access memory that doesnt belong to u, which is what crashes ur script

Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 04 Jun 2020, 10:15

Thanks for your patience. It works now, but it only selects myself. I don't really know how to tweak the function; does it check all pixels if it is green or not?

This is my current code.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0

If not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}

#MaxThreadsperHotkey 2
#singleInstance, Force
toggle = 0

#Include Gdip_All.ahk

pToken := Gdip_Startup()

$e::	;________________________


healMostInjured() {

x1 := 50
y1 := 1371

x2 := 120
y2 := 1408

w := x2 - x1
h := y2 - y1

	pBitmap := Gdip_BitmapFromScreen(x1 "|" y1 "|" w "|" h) ; replace with coords
	
	Gdip_LockBits(pBitmap, 0, 0, w, h, stride, scan0, bmData)

	static xCoordThresholds := [1  ; 20%
							  , 18  ; 40%
							  , 36  ; 60%
							  , 54  ; 80%
							  , 70] ; 95%

	for each, x in xCoordThresholds
	{
		static yCoordHealKey := { 1: "\"  ; zelf
								, 9: "["  ; party1
								, 18: "]"  ; party2
								, 28: ";"  ; party3
								, 37: "'"} ; party4

		for y, key in yCoordHealKey
		{
			color := Gdip_GetLockBitPixel(scan0, x, y, stride)

			if color != 0x2CFF00 ; if not green
			{
				Send {%key%} ; heal
				goto end
			}
		}
	}

	end:
	Gdip_UnlockBits(pBitmap, bmData)
	Gdip_DisposeImage(pBitmap)
}

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 04 Jun 2020, 10:40

yeah, gdip returns ARGB colors, so either mask off the alpha

Code: Select all

color := Gdip_GetLockBitPixel(scan0, x, y, stride) & 0xFFFFFF
or switch to working with ARGB colors

Code: Select all

if color != 0xFF2CFF00 ; if not green

the pixels are checked top-to-bottom in columns(20% -> 40% -> 60% etc) until the hotkey to heal is sent or nothing happens(ie everyone is above 95%)

Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 06 Jun 2020, 14:10

I'm sorry, but it still doesn't work.

Image: https://imgur.com/a/KSItanb

This is how I set the game up. You can see green bars which is not the health%, but the health% that is missing. It is inverse of what you expect. Then my old script checked from up to down at 20% marks where he would find green and it would stop itself and send the corresponding key when it reached green.

The script with gdip is really fast but I just keep selecting myself. I don't know how gdip works and I can't work it out. I hope someone can help me

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 06 Jun 2020, 14:23

i see, then change the condition to

Code: Select all

if (color = 0x2CFF00) ; if green
or

Code: Select all

if (color = 0xFF2CFF00) ; if green
depending on which approach(from my previous post) u decided to go for

juniormarinho96
Posts: 6
Joined: 01 May 2020, 06:55

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by juniormarinho96 » 11 Jun 2020, 09:41

@swagfag @autohotkeynoob
post the complete script for me to help you, I did something similar these days

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by swagfag » 11 Jun 2020, 09:54

going by the lack of posts since, i think he got the point

malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by malcev » 11 Jun 2020, 12:55

I do not like how this functions are called - this creates confusion.
Gdip_BitmapFromScreen - better be called Gdip_BitmapFromHwndFast.
Gdip_BitmapFromHWND - better be called Gdip_BitmapFromHwndSlow.
Because this 2 functions captures from hwnd, but with different api - First with GetDCEx, Second with PrintWindow.
Difference between them besides speed is that hardware accelerated windows like chrome (if it runs without --disable-gpu) can be captured with Gdip_BitmapFromHwndFast, only with hwnd = 0 (desktop), therefore You cannot get it if it is behind others windows.
But You can capture it behind others windows with Gdip_BitmapFromHWNDSlow if You put flag=2 in PrintWindow function.

Auothokeysnoob
Posts: 8
Joined: 03 Jun 2020, 08:16

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by Auothokeysnoob » 12 Jun 2020, 06:23

Hello, I did not get the script to work of Swagfag. I do not know how gdip works, but I modified his script with a loop to make it work for me. For now the script below works. If people want to use it, what it does is that it will perform triage of lowest health member partys.

It will check at 20% (you can change this) the health of yourself, party member 1, party member 2 ... etcetera and if they all are NOT at 20% (which it will check if the pixel there is green or not (you can change this as well)) it will go to 40% and do the same.

Things you have to customize on your own is what colour the pixel is you want to be checked and where the health bars of the party members are. I also used not a hexadecimal color code but something I don't know what it is but it works. It most definitely is not the best script (I am not a coder usually) so it can be made better. I tried explaining the code under here a bit.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0

If not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}

#MaxThreadsperHotkey 2
#singleInstance, Force
toggle = 0

#Include Gdip_All.ahk

pToken := Gdip_Startup()


$e::	;________________________

healMostInjured() {

x1 := 34   ; rectangle of all the health bars coordinates. 
y1 := 1371

x2 := 120
y2 := 1408

w := x2 - x1
h := y2 - y1

	pBitmap := Gdip_BitmapFromScreen(x1 "|" y1 "|" w "|" h) ; gets health bars from 5 party members
	
	Gdip_LockBits(pBitmap, 0, 0, w, h, stride, scan0, bmData)

posX := [1,18,36,54,70]			; x coordinates of percentage of health you want to check (you can change this and add more for accuracy)
posY := [1,9,18,28,37]			; y coordinates of each party member health bar
char := ["{\}","{[}","{]}","{;}","{'}"]		; sends the key that corresponds to selecting party member 1, 2, 3, 
x=-1

loop 25 
{
x++
a:=PosX[floor(x/5+1)]
b:=PosY[Mod(x, 5)+1]
c:=Mod(x, 5)+1
			color := Gdip_GetLockBitPixel(scan0, a, b, stride)

						
				;MsgBox The color at the position is %color%. a is %a% b is %b% c is %c% 
				;MsgBox % char[c]
				if (color=4278255404)    ; the colorcode that needs to be checked if it is there or not. You can find which number with the above messageboxes. Remove the dotcomma
				{			
					Send % char[c]
                                break
				}
				
}
				goto end
			
	end:
	Gdip_UnlockBits(pBitmap, bmData)
	Gdip_DisposeImage(pBitmap)
}









juniormarinho96
Posts: 6
Joined: 01 May 2020, 06:55

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by juniormarinho96 » 12 Jun 2020, 19:14

[Mod edit: english translation (by DeepL) added]:
Spoiler


Poderia explicar em portugues o que cada parte faz eu baixei o jogo e tentei fazer uns testes mas não consegui... para tentar chegar a um script final, a forma que eu encontrei foi.

search image: checkbox onde pega o nome do player (varivel)
e descendo x+45 y+10 pega a life bar do personagem a dar sio, contudo ele tem que aparecer na battle

Auothokeysnoob wrote:
12 Jun 2020, 06:23
Hello, I did not get the script to work of Swagfag. I do not know how gdip works, but I modified his script with a loop to make it work for me. For now the script below works. If people want to use it, what it does is that it will perform triage of lowest health member partys.

It will check at 20% (you can change this) the health of yourself, party member 1, party member 2 ... etcetera and if they all are NOT at 20% (which it will check if the pixel there is green or not (you can change this as well)) it will go to 40% and do the same.

Things you have to customize on your own is what colour the pixel is you want to be checked and where the health bars of the party members are. I also used not a hexadecimal color code but something I don't know what it is but it works. It most definitely is not the best script (I am not a coder usually) so it can be made better. I tried explaining the code under here a bit.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0

If not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}

#MaxThreadsperHotkey 2
#singleInstance, Force
toggle = 0

#Include Gdip_All.ahk

pToken := Gdip_Startup()


$e::	;________________________

healMostInjured() {

x1 := 34   ; rectangle of all the health bars coordinates. 
y1 := 1371

x2 := 120
y2 := 1408

w := x2 - x1
h := y2 - y1

	pBitmap := Gdip_BitmapFromScreen(x1 "|" y1 "|" w "|" h) ; gets health bars from 5 party members
	
	Gdip_LockBits(pBitmap, 0, 0, w, h, stride, scan0, bmData)

posX := [1,18,36,54,70]			; x coordinates of percentage of health you want to check (you can change this and add more for accuracy)
posY := [1,9,18,28,37]			; y coordinates of each party member health bar
char := ["{\}","{[}","{]}","{;}","{'}"]		; sends the key that corresponds to selecting party member 1, 2, 3, 
x=-1

loop 25 
{
x++
a:=PosX[floor(x/5+1)]
b:=PosY[Mod(x, 5)+1]
c:=Mod(x, 5)+1
			color := Gdip_GetLockBitPixel(scan0, a, b, stride)

						
				;MsgBox The color at the position is %color%. a is %a% b is %b% c is %c% 
				;MsgBox % char[c]
				if (color=4278255404)    ; the colorcode that needs to be checked if it is there or not. You can find which number with the above messageboxes. Remove the dotcomma
				{			
					Send % char[c]
                                break
				}
				
}
				goto end
			
	end:
	Gdip_UnlockBits(pBitmap, bmData)
	Gdip_DisposeImage(pBitmap)
}









buliasz
Posts: 26
Joined: 10 Oct 2016, 14:31
Contact:

Re: Slow script; long if else statements and PixelGetColor. Can anyone help?

Post by buliasz » 21 Jul 2020, 19:49

If you want really fast PixelGetColor function you can use my Gdip_Toolbox.ahk with Gdip adapted to AHKv2.
Here is my GitHub fork Gdip sources: https://github.com/buliasz/AHKv2-Gdip
Just download those two files: Gdip_All.ahk and Gdip_Toolbox.ahk, include Gdip_Toolbox.ahk and use the GetPixelColorBuffered(x,y) function to get pixel color (with current AutoHotKey version 2).

Here's simple usage example:

Code: Select all

#include Gdip_Toolbox.ahk
color := GetPixelColorBuffered(120,130)
MsgBox(Format("0x{:06X}", color))

Post Reply

Return to “Gaming Help (v1)”