Roman9 Posted August 5, 2007 Share Posted August 5, 2007 (edited) I'm having trouble writting a script that waits 5 seconds then checks for a change in a pixel for 6 seconds, and if there are no changes, exits. If there is a change in the pixel, then it does something else... Here's what I've got so far... Am I doing this right? Func Wait() Sleep(5000) Do PixelGetColor(176, 106) Until PixelGetColor(176, 106) = 0x4A96FF or timer() = 0 EndFunc And if that looks fine, how do I make a 6 second countdown timer function? Edited August 5, 2007 by Roman9 Link to comment Share on other sites More sharing options...
Generator Posted August 5, 2007 Share Posted August 5, 2007 (edited) Is this what you wanted? Func Wait() Sleep(5000) $TimerInit=TimerInit() Do PixelGetColor(176, 106) Until PixelGetColor(176, 106) = 0x4A96FF Or $TimerDiff($TimerInit)>6000 EndFunc Edit: Wrong click Edited August 5, 2007 by Generator Link to comment Share on other sites More sharing options...
Developers Jos Posted August 5, 2007 Developers Share Posted August 5, 2007 check TimerInit() and TimerDiff() functions in the helpfile ... .... and ... where is the fire ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Roman9 Posted August 5, 2007 Author Share Posted August 5, 2007 Thanks @JdeB, by fire you mean the color? Link to comment Share on other sites More sharing options...
Roman9 Posted August 6, 2007 Author Share Posted August 6, 2007 Ok guys I've been working on it but it gives me errors when I Tidy it up... I have a feeling I didn't do what I'm trying to do in the smartest manner, please help me out. Func Wait() Sleep(5000) ;wait 5 seconds $Timer = TimerInit() ;timer starts MouseMove(118, 59) ;Making sure it checks the correct pixel Do PixelGetColor(118, 59) ;Keep on checking the color until it turns blue or Until PixelGetColor(118, 59) = 0x4A96FF Or $TimerDiff ($TimerInit) > 7000 ;7 seconds pass, after which we restart the loop If PixelGetColor(118, 59) = 0x4A96FF Then ;If it does turn blue, then $TimerInit = 0 ;restart the timer Do PixelGetColor(117, 74) ;Keep on getting the color of the new coordinates Until $TimerDiff ($TimerInit) > 7000 ;for 7 seconds. If PixelGetColor(117, 74) = 0x4A96FF Then Send("{SPACE down}") ;If the color is blue, hold space } If PixelGetColor(117, 74) = 0xFF0808 Then Send("{SPACE up}") ;if the color is red, let go. } --Color changes so I need to keep on checking it EndIf ;### Tidy Error -> "endif" is closing previous "func" EndIf ;### Tidy Error: next line creates a negative tablevel. ;### Tidy Error: next line creates a negative tablevel for the line after it. EndIf ;### Tidy Error: next line creates a negative tablevel. ;### Tidy Error: next line creates a negative tablevel for the line after it. EndFunc ;==>Wait Thank you Link to comment Share on other sites More sharing options...
Generator Posted August 6, 2007 Share Posted August 6, 2007 Here you go Func Wait() Sleep(5000) ;wait 5 seconds $Timer = TimerInit() ;timer starts MouseMove(118, 59) ;Making sure it checks the correct pixel Do PixelGetColor(118, 59) ;Keep on checking the color until it turns blue or Until PixelGetColor(118, 59) = 0x4A96FF Or $TimerDiff ($TimerInit) > 7000 ;7 seconds pass, after which we restart the loop If PixelGetColor(118, 59) = 0x4A96FF Then ;If it does turn blue, then $TimerInit = 0 EndIf;restart the timer Do PixelGetColor(117, 74) ;Keep on getting the color of the new coordinates Until $TimerDiff ($TimerInit) > 7000 ;for 7 seconds. If PixelGetColor(117, 74) = 0x4A96FF Then Send("{SPACE down}") ;If the color is blue, hold space } If PixelGetColor(117, 74) = 0xFF0808 Then Send("{SPACE up}") ;if the color is red, let go. } --Color changes so I need to keep on checking it EndFunc ;==>Wait Link to comment Share on other sites More sharing options...
Roman9 Posted August 6, 2007 Author Share Posted August 6, 2007 Thanks Generator! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now