View Single Post
  #2 (permalink)  
Old 02-05-2009, 06:38 PM
schettj's Avatar
schettj
morsus mihi
Offline
Threadstarter
Location: Not from around these parts
 
Join Date: Oct 2006
Posts: 3,017
Reputation: 3616
schettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIPschettj is still contributing even after becoming a VIP
Mentioned: 2 Post(s)
Tagged: 0 Thread(s)
Re: Idea... any interest in moon phase in TF3d?

Following up, its a simple calculation for the phases, so I can do it all in Mortscript.

Might get some time to play with it, if I get it working I'll post it up.

When this is run it should more or less get you a number between 0 (full moon above) and 23 - start counting from 1 above for the pic that goes with this number - for the current date. So pretty simple - not perfect since it should be UTC time, but hey close enough!

Not tested (tested C version )
Code:
#
# moon phase 0-2333
#

GetTime(d,m,y,h,min,s)

if (m < 3)
        y = y - 1
        m = m + 12
endif

m = m + 1
c = 365.25*y
e = 30.6*m
jd = c+e+d-694039.09
jd = jd /  29.53

b = floor(jd)
jd = jd - b
ph = Round(jd*24)
if (ph > 23)
  ph = 0
endif

#ph = 0 (NEW) thru 23 (last of the waning cresent)
So all I have to do is add the "run me once a day at 1pm" code, make 24 moon image files for manila named moon_0 through moon_23, and add the code to copy the computed file over the default moon file, and we're done.
__________________