here is the CLOCKFACE script...coded in 3 MINUTES...17 LINES of CODE
Scott Rossi
scott at tactilemedia.com
Wed Jun 8 12:14:17 EDT 2005
Recently, Eric Chatonet wrote:
> on openCard
> setTime
> end openCard
>
> on setTime
> send "setTime" to me in 1 - (the long seconds mod 1) seconds
> put word 1 of the long time into T --8:13:15
> put T & char 2 to 7 of (the long seconds mod 1) into fld "Time"
> split T using ":"
> set the angle of grc "Second" to 450 - (6 * T[3])
> if T[3] mod 10 <> 0 then exit setTime
> set the angle of grc "Minute" to 90 - (6 * T[2]) - (T[3] div 10)
> if T[3] <> 0 or T[2] mod 2 <> 0 then exit setTime
> set the angle of grc "Hour" to 90 - (30 * T[1]) - (T[2] div 2)
> end setTime
> Very impressed to see how much a code can be improved again and again.
> Just a little thing: with this new very clever code, the clock will
> not be at time just when opening ;-)
> So 4 lines more and 2 repetitions that are not satisfying: I bet you
> will find a better solution in 3 minutes!
If I understand your comment, I believe all you need to do is change
"on openCard" to "on preOpenCard" -- no extra lines needed.
Regards,
Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com
More information about the use-livecode
mailing list