Posted: 16th Aug 2003 17:16
+ Code Snippet
sync on : sync rate 60

rem the clock body
make object sphere 1,0.5
color object 1,rgb(255,0,0)
position object 1,0,0,0

rem a secondhand limb handler
make object cube 100,0.2
make mesh from object 1,100
delete object 100
add limb 1,1,1

rem the seconhand
make object cube 2,3
color object 2,rgb(0,255,0)
scale object 2,5,80,5
position object 2,0,1.5,0
glue object to limb 2,1,1

rem hour limb handler
make object cube 100,0.2
make mesh from object 2,100
delete object 100
add limb 1,2,2

rem the hourhand
make object cube 3,2
color object 3,rgb(255,255,0)
scale object 3,10,50,10
position object 3,0,1,0
glue object to limb 3,1,2

rem minute limb handler
make object cube 100,0.2
make mesh from object 3,100
delete object 100
add limb 1,3,3

rem the minutehand
make object cube 4,2
color object 4,rgb(0,0,255)
scale object 4,10,50,10
position object 4,0,1,0
glue object to limb 4,1,3

position camera 0,3,-5
point camera 0,0,0

disable escapekey
while escapekey()=0

rem some gooey maths stuff

Gtime$ = get time$()

H1 = VAL(left$(Gtime$,1))
H2 = VAL(mid$(Gtime$,2))

M1 = VAL(mid$(Gtime$,4))
M2 = VAL(mid$(Gtime$,5))

S1 = VAL(mid$(Gtime$,7))
S2 = VAL(mid$(Gtime$,8))

Hour = (H2 + (H1*10))-12

Minute = (M2 + (M1*10))
Minute = Minute -(Minute*6)

Second = 6 * (S2 + (S1*10))
Second = Second - (Second*2)

rotate limb 1,1,0,0,wrapvalue(Second)
rotate limb 1,2,0,0,wrapvalue(Hour)
rotate limb 1,3,0,0,wrapvalue(Minute)


text 15,15,Gtime$

text 15,30,"hr 1 num :"+STR$(H1)
text 15,45,"hr 2 num :"+STR$(H2)

text 15,60,"mn 1 num :"+STR$(M1)
text 15,75,"mn 2 num :"+STR$(M2)

text 15,90,"sc 1 num :"+STR$(S1)
text 15,105,"sc 2 num :"+STR$(S2)

text 15,120,"Seconds Angle :"+STR$(Second)
text 15,140,"Hour Angle :"+STR$(Hour)
text 15,160,"Minute Angle :"+STR$(Minute)

sync
endwhile
for i = 1 to 4
delete object i
next i
end

Posted: 16th Aug 2003 21:23
Quite good. A suggestion would be putting spheres at the end of the hands so you know what way they are supposed to be pointing.
Posted: 17th Aug 2003 2:24
Quite good program!
Posted: 17th Aug 2003 3:07
This is my take on things without all that complicated stuff!
Posted: 17th Aug 2003 5:36
spooky it crashes dbc but i think thats just a wrapvalue issue and its upsidown in 5,3b DBP, good tho
Posted: 17th Aug 2003 6:30
OK, fixed bug in hour hand. Rest is not upside down though. I am running Beta3 of U5.

New version below which has minute and hour hand moving slowly between numbers like a real clock.
Posted: 17th Aug 2003 6:52
good stuff, the yellow hand was upsidown in the last one but you solved it
Posted: 17th Aug 2003 6:56
how could you ammend this line to work for DBC 113


h=val(left$(t$,2)) : h=(h mod 12)

its the mod command throwing it?
Posted: 17th Aug 2003 13:42
just replace it with:

h=val(left$(t$,2)) : if h > 11 then h=h-12
Posted: 18th Aug 2003 0:06
Indi, are you bored???
Posted: 18th Aug 2003 8:06
no mate it was from a question I answered related to the newcomers section.

I just re added it here for all and spooky went to town on my crappy math to make it better and less gooey.
Posted: 18th Aug 2003 13:39
I think you're bored.

Oh, and when are you going to post some new DT screenies?????