Pause Function V2

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

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.
V2
Only the blue code is needed. If your program
already gets the screen size elsewhere, that
line can also be eliminated.
*/

time reset

'c'
get screen size sw,sh
wait(3)
''
text
print time()
end

'c'
def wait(dur)
button "go" text "😲🎺" at .sw/2-50,200
waiter=dur*10
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