If pixel found, display countdown timer onscreen Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
kentpachi
Posts: 152
Joined: 15 May 2016, 01:23

If pixel found, display countdown timer onscreen

Post by kentpachi » 18 May 2021, 15:14

this is my code for finding pixel


loop
{
CoordMode, Pixel, Window
PixelSearch, FoundX, FoundY, 938, 982, 938, 982, 0x3C3241, 0, Fast RGB
If ErrorLevel = 0

}


Now i just need it to display an overlay 5 second countdown the the pixel is found in this specific coordinates "780,890"

can anyone help me on this please?

Rohwedder
Posts: 7669
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: If pixel found, display countdown timer onscreen  Topic is solved

Post by Rohwedder » 19 May 2021, 02:04

Hallo,
try:

Code: Select all

loop
{
	CoordMode, Pixel, Window
	PixelSearch, FoundX, FoundY, 938, 982, 938, 982, 0x3C3241, 0, Fast RGB
	If ErrorLevel = 0
		CountDown(5,200,200,400)
}
Return
CountDown(No,X:=0,Y:=0,Dia:=100,Time_No:=1000)
{ ; StartNumber(<10000), Position X,Y, Diameter, Time(>300)/(ms Number)
	Static N, Colors:=["Blue","Yellow"], SF:= [.60,.44,.31,.25], YF:= [-.06,.08,.22,.27]
	NL := StrLen(N:=Round(No)), Rad := Dia//2, V := 3*Time_No//100
	Loop,% (2, dP := 8*Atan(1)/V++, Gui := 1, T := A_TickCount + Time_No*N)
	{
		Gui, %A_Index%CD:New, -DPIScale +LastFound -Caption -SysMenu +AlwaysOnTop
		Gui, Margin, 0, 0
		Gui, Font,% "s" Dia*SF[NL] " c" Colors[A_Index]
		Gui, Add, Text,% "Center X0 Y" Dia*YF[NL] " w" Dia " h" 2*Dia " vN",% N
		Gui, Color,% Colors[3-A_Index]
		WinSet, Region,% "2-2 W" Dia-4 " H" Dia-4 " E"
		Gui, Show, NA w%Dia%  h%Dia% x%X% y%Y%
	}
	While, N
	{
		Gui,% (Gui^=3) "CD: +AlwaysOnTop +LastFound"
		Loop,% (V, Edge:= Rad "-" Rad, P:= -dP)
		{
			WinSet, Region,% Edge.=" " Rad*(1+sin(P+=dP)) "-" Rad*(1-cos(P))
			Sleep,% (T-A_TickCount)//(1+N*V-A_Index)
		}
		GuiControl, 1CD: Text, N,% --N
		GuiControl, 2CD: Text, N,% N
		Loop,% StrLen(N) < NL?(2, --NL):
		{
			Gui, %A_Index%CD:Font,% "s" Dia*SF[NL]
			GuiControl, %A_Index%CD: Font, N
			GuiControl, %A_Index%CD: Move, N ,% "y" Dia*YF[NL]
		}
	}
	Gui, 1CD: Destroy
	Gui, 2CD: Destroy
	Return
}

Post Reply

Return to “Ask for Help (v1)”