Sign in to follow this  
Followers 0
bennyvo

some if statementt question..

7 posts in this topic

hello.

can someone tell me if this is possible or impossible.

If something is true THEN

do it

Else

Delay 5 seconds

The code should work fine, however i would like it to be like this. If something is true THEN do it, else, Delay 5 seconds, but during that 5 second, if something is true, i want it to do it right away.

Lets say something is False, now it delay 5 seconds, but then it just delay for 2 seconds then something True, so now i want it to do it right away, it must skip that 3 remaining seconds.

i hope i make some sense to you.

can somebody tell me if its possible or not.

thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

something like this?

While 1
    If [your condition] THEN
        [your actions]
        ExitLoop

    Else
        Sleep(500)

    EndIf

WEnd

Edit: Missed out your conditions

a while loop with a cobination of if-else statement should do the trick

added the 0.5sec delay

Edited by Shibuya

The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

Share this post


Link to post
Share on other sites

i know that script and its doesn't what i need.

lets say it start to sleep 5000, after 5000 then it will come back to the

If [your condition] THEN

that's normal.

what i need is even sleep 5000 is not complete yet, as long as

If [your condition] is TRUE THEN

[your actions] if perform.

Share this post


Link to post
Share on other sites

can you post that while loop too?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i know that script and its doesn't what i need.

lets say it start to sleep 5000, after 5000 then it will come back to the

If [your condition] THEN

that's normal.

what i need is even sleep 5000 is not complete yet, as long as

If [your condition] is TRUE THEN

[your actions] if perform.

can you elaborate more?

what is your condition?

i suppose you want to quit your script when the 5sec is up?

$count = 1
While 1
    If [your condition] THEN
        [your actions]
        ExitLoop

    Else
        Sleep(500)

        If $count = 5 Then Exit
        Else $count = $count + 1
        EndIf
    EndIf

WEnd
Edited by Shibuya

The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

Share this post


Link to post
Share on other sites

i think i make my own problem.

While 1

If [start] THEN

[Jump]

Else

Stay Still

EndIf

WEnd

i put in the delay that make me confuse, if i didn't put in the delay then it exactly what i need. so it will jump when [start] is true, else it stay still waiting for [start] to be true then it jump again, and it stay still when [start] is false...and so on...

thanks for your help.

Share this post


Link to post
Share on other sites

While 1
    If [START] Then ExitLoop

WEnd

[Jump]

are you waiting for an window/application to start?

what you might be looking for could be WinWaitActive or ProcessWait


The speed of sound is defined by the distance from door to computer divided by the time interval needed to close the media player and pull up your pants when your mom shouts "OH MY GOD WHAT ARE YOU DOING!!!"

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