Sign in to follow this  
Followers 0
Sniperwolf

Do something Until @error (or for 30sec)?

6 posts in this topic

Hi guys! I have come across another problem, well for me it is atleast cause I dont know how to write it in code. I post the code I tried but didnt work then maybe you can get an Idea of what I am after here.

$timer=30
    Do
        PixelSearch(723,77,723,77,0,3)
        $timer=$timer-1
        sleep(1000)
    Until @error Or Until $timer=0

I think you can easily se what I am after, I want it to check that spot over and over again, if it gets any other color than black I want it to stop looping this. Or if it has past 30 seconds I want it to stop aswell. But I know I cant write it like I did but how should I write it then?

Share this post


Link to post
Share on other sites



Hi guys! I have come across another problem, well for me it is atleast cause I dont know how to write it in code. I post the code I tried but didnt work then maybe you can get an Idea of what I am after here.

$timer=30
    Do
        PixelSearch(723,77,723,77,0,3)
        $timer=$timer-1
        sleep(1000)
    Until @error Or Until $timer=0oÝ÷ Øay2¢ç欬{Z´¦iû^¬Ø­¶!yÉ-«l¦h½êÚÚ/z¶ j)â~+`zÛ*-êÜ¢Z+¶§nVØ­¶-¢h¢§Øb°êâ~+ajÊZ²Ýô±ç(ÛÁ©íÛh²Ú)jÌPn´'£j{p®+^ÙbâÖî¶0².Ò0®+^Ûazêº^>,¹r²¶§X¤zØb±«­¢+ØÀÌØíÑ¥µÈôÌÀ)¼($ÀÌØí½±½ÉÑÉ­ÈôA¥á±MÉ  ÜÈÌ°ÜÜ°ÜÈÌ°ÜÜ°À°Ì¤($ÀÌØíÑ¥µÈôÀÌØíÑ¥µÈ´Ä(%M±À ÄÀÀÀ¤(%%ÀÌØí½±½ÉÑÉ­ÈôÄQ¡¸($%5Í  ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí
½±½È¡¹ÑÑÅÕ½Ðì¤($%á¥Ð(%¹%()U¹Ñ¥°ÀÌØíÑ¥µÈôÀ()5Í  ½à À°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíQ¥µÈáÁ¥ÉÅÕ½Ðì¤

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Do
    $colortracker = PixelSearch(723, 77, 723, 77, 0, 3)
    $timer = $timer - 1
    Sleep(1000)
    If $colortracker = 1 Then
        $timer=0
    EndIf
Until $timer = 0

Thanks mate! Works fine.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You could use an actual timer:

$STAMP = TimerInit()
$colortracker = 0
Do
    $colortracker = PixelSearch(723, 77, 723, 77, 0, 3)
    MsgBox(0,"",Int(TimerDiff ($STAMP) / 1000))
Until $colortracker OR Int(TimerDiff ($STAMP) / 1000) >= 30

Yes but is it possible to know if it goes on with the rest of the script because it found what it wanted, or because the timer ended?

So that if the timer ended put a msgbox for timeout..

i cant find a way

Edited by meekaah

Share this post


Link to post
Share on other sites

Oh nevermind i doded something that worked fine for what i wanted, thanx anyays :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0