This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-27 10:25:38

RCScratch
Scratcher
Registered: 2010-05-26
Posts: 48

Complete Timer- Counting Up

Here is a complete timer that counts up WITH COMMENTS

when gf clicked // second count up script
set [hr v] to (0) // hrs digit
set [10m v] to (0) //ten minute digit, if none it would display: 1:0:00
set [min v] to (0) //one minute digit
set [10s v] to (0) //ten sec digit, if none it would display: 1:00:0
set [sec v] to (0) //seconds
forever
 wait (1) secs
 change [sec v] by (1)

when gf clicked //10s increment
wait (5) secs // to prevent errors
forever
 if <(round((sec)/(10)))=((sec)/(10))>
  change [10s v] by (1)
  wait until <not<(round((sec)/(10)))=((sec)/(10))>> // to prevent errors
 end

when gf clicked //min increment
wait (5) secs // to prevent errors
forever
 if <(round((sec)/(60)))=((sec)/(60))>
  change [min v] by (1)
  wait until <not<(round((sec)/(60)))=((sec)/(60))>> // to prevent errors
 end

when gf clicked //10m increment
wait (5) secs // to prevent errors
forever
 if <(round((sec)/(600)))=((sec)/(600))>
  change [10m v] by (1)
  wait until <not<(round((sec)/(600)))=((sec)/(600))>> // to prevent errors
 end

when gf clicked //hr increment
wait (5) secs // to prevent errors
forever
 if <(round((sec)/(3600)))=((sec)/(3600))>
  change [hr v] by (1)
  wait until <not<(round((sec)/(3600)))=((sec)/(3600))>> // to prevent errors
 end

when gf clicked //display
forever
 say (join(join(join(join(join(join(hr)[:])((10m)mod(6)))((min)mod(10)))[:])((10s)mod(6)))((sec)mod(10)))


http://i736.photobucket.com/albums/xx7/RCScratch/RCSCRatch.gif http://www.danasoft.com/sig/467044211994.jpg

Offline

 

Board footer