2013-03-31 5 views
0

내가 버전에있어이 X AHL_L 32 비트 1.1.05.06 내가 픽셀 시간의 X 금액에 대한 최대 인 경우 15 일 이후, AutoHotkey를에 감지하는 논리적 방법을 찾고 있어요AutoHotkey를 감지 PixelColor는 초

초, 나는 그것이 추락했다고 가정하고 우리는 새로 고침을 할 것입니다.

나의 현재 코드는 다음과 같다 : 나는 스크립트의 시작 부분에 다음과 같이 글로벌로 변수를 넣어 시도했습니다

CrashCheck: 
if stuckinbonus = 0x1D001A 
{ 

    if(FoundCrash = 0) { 
    FirstFound := A_Tickcount 
    FoundCrash = 1 
     } else { 
CrashCheckTime := A_Tickcount - FirstFound 
    } 




if(CrashCheckTime >= 15000){ 
SetTimer,CrashCheck,off 
MsgBox,Refreshing page (Pseudo Code) 
} 
} 
return 

,하지만 난 CrashCheckTime 그냥 0 인 문제로 실행 해요 :/어떤 아이디어?

Global FoundCrash := "" 
Global FirstFound := "0" 
Global CrashCheckTime:= "" 

답변

0

이 작업을 수행 할 수 있습니까?

#SingleInstance Force 
#installKeybdHook 
#Persistent 
SetTimer, CrashCheck, 1000 ; run CrashCheck every second 
MyAlert := 0 
Return 

CrashCheck: 
PixelGetColor, Color, 100, 100 
If (Color = 0x1D001A) 
{ 
    MyAlert++ 
} 
Else 
{ 
    MyAlert := 0 
} 
If (MyAlert > 15) 
{ 
    MyAlert := 0 
    Refresh Page 
} 
Return 

귀하의 코드와 관련하여. CrashCheck를 실행하기 전에 FoundCrash := 0을 설정하지 않았습니까? 이 방법은 If (FoundCrash = 0)에 대해 결코 사실이 아니므로 항상 Else choise로 건너 뜁니다.

예 :

#SingleInstance Force 
#installKeybdHook 
#Persistent 
;FoundCrash := 0 ; Script fails when this line is commented out! 
stuckinbonus = 0x1D001A 

!t:: ; [Alt]+t to simulate CrashCheck 
If (stuckinbonus = 0x1D001A) 
{ 
    If (FoundCrash = 0) 
    { 
     SoundBeep, 500, 500 ;(Low beep) 
       FirstFound := A_Tickcount 
     FoundCrash := 1 
    } 
    Else 
    { 
     SoundBeep, 1500, 500 ;(High beep) 
     CrashCheckTime := A_Tickcount - FirstFound 
    } 
    If (CrashCheckTime >= 15000) 
    { 
    ;SetTimer,CrashCheck,off 
    FoundCrash := 0 
    MsgBox,Refreshing page (Pseudo Code) 
    } 
} 
Return 

난 당신이, SciTE4AutoHotKey 내부 디버그 모드에서이 작업을 실행하는 지점이 촬영 어떤 변수 값이 단계의 실행에 의해 단계 중에 있습니다되는 참조하는 것이 좋습니다.

+0

의견을 제공해 주시겠습니까? 내 솔루션이 당신과 다르다는 것을 알고 있습니다. 아니면 일부 변수가 비어있는 이유를 알고 싶습니까? –

0

필자는 원하는 좌표에서 원하는 픽셀 색상을 볼 때까지 루프를 반복하고 대기하며 루프를 유지하는 약간의 기능을 작성했습니다. 어쩌면 도움이 될까요?

;This function checks the Pixel at the provided coordinates and waits until the colour matches the provided parameter 
WaitForLoad(PixelColorX,PixelColorY,PixelColorValue) 
{ 
CycleCount = 0 
    PixelGetColor SearchPixel, PixelColorX, PixelColorY 
    ;msgbox "Found Pixel %SearchPixel% at %PixelColorX%, %PixelColorY%, Looking for %PixelColorValue%" ;DEBUGG ASSISTANT 
    While (SearchPixel != PixelColorValue) 
      { 
    CycleCount = CycleCount + 1 
    sleep 100 
    ; Tooltip Waiting to detect pixels HERE!, PixelColorX, PixelColorY  ; Doesn't work 
    PixelGetColor SearchPixel, PixelColorX, PixelColorY 
    } 
    sleep 500 
;Debug 
;msgbox Exiting Function with %PixelColorValue% at %PixelColorX%, %PixelColorY% after %CycleCount% Cycles. 
SearchPixel = 0 
PixelColorValue = 1 
관련 문제