green text is being edited and should not be considered
relevant to the tutorial. for a while, it will make up
the bulk of this section.
black text has been edited to be more accurate with
regards to puppybasic.
........................................................................
timing
1 of 7
an intro to puppybasic
chapter 15: timing
........................................................................
........................................................................
timing
2 of 7
vital to graphics and games, and useful for many other things you'll
want to do, the following are common functions for accessing the
timer inside the computer and its clock functions:
TIMER
(mentioned earlier for use with RANDOMIZE) is a numeric function that
returns the number of seconds that have elapsed since midnight.
you can code a delay using TIMER this way...
... (only joking, it's on the next page.)
........................................................................
........................................................................
timing
3 of 7
delay = .5 'delay in seconds, in this case: half of one second
t = TIMER + delay: DO: LOOP UNTIL TIMER > t or TIMER < t - delay * 1.2
it is also possible to create a short delay using FOR q=1 TO d: NEXT q
where d is a large number, but the faster computers get, the more
useless this method becomes. also it is unreliable in that the delay is
longer on slower machines, and that the delay it creates can't be
determined exactly on any machine but the one you try it on.
........................................................................
........................................................................
timing
4 of 7
SLEEP
makes a program suddenly sit and do absolutely nothing until a key is
pressed, and if used with a number:
SLEEP 5
works the same way, only gives up waiting for a key after that number of
seconds.
........................................................................
........................................................................
timing
5 of 7
if used enough times in a program, (especially in a loop,) the keyboard
buffer will fill, which adds up to annoying clicking noises. you can
clear this buffer using INKEY$, but i think it makes more sense to
substitute q$=INPUT$(1) for SLEEP, or a variation of the timer code
example (throw in an INKEY$ function) in this chapter for SLEEP N, and
i usually only use SLEEP when i'm busy enough doing other things to
avoid typing parenthesis: (example: SLEEP is very useful during
debugging.)
........................................................................
........................................................................
timing
6 of 7
TIME$
has the double use of checking and setting the time.
to check the time, let q$=TIME$ which will set q$ to an 8-byte string
comprised of "hh:mm:ss" with hh being a pair of hour digits, mm being
minutes, and ss being seconds.
to set the time, create a string in the same 8-byte "hh:mm:ss" format
and let TIME$=q$
easy!
........................................................................
........................................................................
timing
7 of 7
DATE$ works like TIME$ and checks and sets the date with the format
month-day-year as "mm-dd-yyyy"
note: if your computer is outside the united states, it's possible that
your OS and thus puppybasic will use a different date display.
-= end of chapter 15 =-
........................................................................
an intro to puppybasic (chapter 15)
this content is public domain.
........................................................................
click here to go back to the contents page
Before You Post, Please Note...
-> Please Note: By Posting, you agree to submit the contents of your post to the Public Domain <- SEE: howto post to this blog
Friday, February 2, 2007
puppybasic intro ch. 15 - timing
Subscribe to:
Post Comments (Atom)
24 comments:
generic xanax xanax for anxiety panic - generic xanax s 900
tramadol online pharmacy buy tramadol overnight saturday delivery - safe place buy tramadol
xanax without a perscription what is xanax medication used for - xanax effects overdose
buy tramadol online tramadol dosage oral - can you buy tramadol online in usa
generic xanax torn city cheap xanax - xanax quotes myspace
buy tramadol online tramadol for dogs an 627 - tramadol 400 mg
alprazolam 0.5mg xanax high .25 - xanax bars milligrams
buy tramadol online buy generic tramadol no prescription - what's the tramadol high like
buy tramadol online tramadol online us - buy tramadol online missouri
cialis no prescription overnight generic cialis to usa - cialis 8cpr riv 20mg
buy xanax online without rx buy xanax bars - buy cheap xanax online no prescription
buy cialis online buy generic cialis no prescription - cialis quiz
http://landvoicelearning.com/#44827 tramadol hcl recreational use - buy tramadol ultram
buy tramadol can get high tramadol 50mg - tramadol 50mg tab
buy tramadol online tramadol 93/58 - tramadol 50 mg efectos secundarios
buy tramadol without a script buy tramadol online no prescription mastercard - tramadol online with no prescription
buy tramadol online no prescription overnight tramadol dosage recreational use - tramadol hcl for cats
buy tramadol 180 tramadol er - tramadol 40 mg
buy tramadol where can i purchase tramadol with a mastercard - best place buy tramadol online reviews
buy tramadol tramadol 50mg capsules dosage - tramadol for dogs fever
http://buytramadolonlinecool.com/#50897 tramadol dosage mg - tramadol addiction buprenorphine
buy tramadol online buy tramadol bluelight - tramadol addiction nhs
http://buytramadolonlinecool.com/#51726 tramadol hcl acetaminophen 650 - tramadol classification
buy tramadol tramadol 200mg online - tramadol hcl high effects
Post a Comment