Pause Function V2

Post Reply
User avatar
Posts: 1971
Joined: Sun May 31, 2015 12:11 am
My devices: iPhone X
iPad 4
Dell Inspiron laptop
CHUWI Plus 10 convertible Windows/Android tablet
Location: Calgary, Canada
Flag: Canada

Pause Function V2

Post by rbytes » Wed Jan 30, 2019 4:57 pm

Pause Function V2 by rbytes
January 2019
Sometimes you want the user to be
able to interrupt a PAUSE.
How do you do that when other commands
are not executed during a pause? The wait
function uses multiple pauses to create
the desired pause, so the user can exit
early by pressing the "wake" button.
Only the blue code is needed. If your program
already gets the screen size elsewhere, that
line can also be eliminated.

time reset

get screen size sw,sh
print time()

def wait(dur)
button "go" text "😲🎺" at .sw/2-50,200
do slowdown ! z+=1
pause (dur/waiter)*.45
until z>waiter or button_pressed("go")
button "go" delete
end def
####### Living the colorful life #######

Post Reply