Ha! I just noticed a bug in the above that causes the hour hand to be updated 6x as often as it should be. The below (I think) updates the second hand once per second, the minute hand 360 times per hour, and the hour hand 360 times per 12 hours.
The long time was to check if the correct time was being displayed, the long seconds to see how the "send..in" was working. In the earliest versions of the script the "send..in" was being done every 500 milliseconds or so.The switch to send in (1 - (the long seconds mod 1)) seconds was a very unexpected and exceedingly clever hack. The actual script in practice would be: on mouseUp setTime end mouseUp on setTime put word 1 of the long time into T split T using ":" set the startangle of grc "second" to 90 - (6 * T[3]) if T[3] mod 10 = 0 then set the startangle of grc "minute" to 90 - (6 * T[2]) - (T[3] div 10) if T[3] = 0 and T[2] mod 2 = 0 then set the startangle of grc "hour" to 90 - (30 * T[1]) - (T[2] div 2) send "setTime" to me in (1 - (the long seconds mod 1)) seconds end setTime On Fri, Oct 4, 2013 at 5:51 AM, Kay C Lan <lan.kc.macm...@gmail.com> wrote: > Hi Geoff, > > I'm not sure what the original context was, so I guess there was a need for > 'the long seconds', but I just created two clock faces and ran one against > your original code, and the other with the 2 references to the long seconds > removed, i.e it just updates every second. > > The outputs are identical. > > So no less lines of code but about 50 chars less typing. > > > On Fri, Oct 4, 2013 at 6:36 AM, Geoff Canyon <gcan...@gmail.com> wrote: > > > > > on setTime > > put word 1 of the long time into T > > put T && the long seconds into fld "time" > > split T using ":" > > set the startangle of grc "second" to 90 - (6 * T[3]) > > if T[3] mod 10 = 0 then set the startangle of grc "minute" to 90 - (6 > * > > T[2]) - (T[3] div 10) > > if T[3] mod 10 = 0 and T[2] mod 2 = 0 then set the startangle of grc > > "hour" to 90 - (30 * T[1]) - (T[2] div 2) > > send "setTime" to me in (1 - (the long seconds mod 1)) seconds > > end setTime > > > > Never be satisfied. > > > > gc > > _______________________________________________ > > use-livecode mailing list > > use-livecode@lists.runrev.com > > Please visit this url to subscribe, unsubscribe and manage your > > subscription preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode