Jump to content

While loops and IsPressed function


furian
 Share

Recommended Posts

Hey all, I'm looking for a way to make this a little smarter. This while loops works almost like I want, except for one thing.  I would like it to start over from the beginning if F6 is released, then held down again.

While 1
    if _IsPressed(75) then
        DoStuff1()
    EndIf
    if _IsPressed(75) then
        DoStuff2()
    EndIf
    if _IsPressed(75) then
        DoStuff3()
    EndIf
Wend


I tried the following, however, this will cycle through each function even if the F6 key is released midway, which I don't want.

While 1
    if _IsPressed(75) then
        DoStuff1()
        DoStuff2()
        DoStuff3()
    EndIf
Wend

Basically, if F6 is held down, begin cycling through the functions, however, if it is released, stop immediately.  If it is pressed down again, start from the beginning.

Any help is appreciated!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...