View Single Post
  #18 (permalink)  
Old 06-01-2009, 11:06 PM
rex_4321's Avatar
rex_4321
Lurker
Offline
 
Join Date: May 2009
Posts: 2
Reputation: 0
rex_4321 is a n00b
Mentioned: 0 Post(s)
Tagged: 0 Thread(s)
Re: MoonPhase Manila (regular and HD/Squished versions)

Hi there, thanks for sharing your scripts. A great idea. I'm having a few problems. I'm running mortscript 4.2, the 'ph' value being calculated for 2nd June 2009 is 1.100000 which when combined with the statement fname="\Windows\moon-" & ph & "_manila.x" produces an invalid file name. I reckon the moon phase should be around 8. Any ideas as to why the calculation is going pearshape ?

test script currently playing with...
# standard moon phase algorithm from the web
# note should be UTC time, so phases can be off by a day or so
# we're not talking hubble telescope here, just close enough is fun!
ErrorLevel( "warn" )
# current time
GetTime(hour,min,sec,day,month,year)
d=day
m=month
y=year
Message ( "year, month , day = " & y & m & d , "date value" )
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, 1 )
jd = jd - b
ph = Round(jd*24, 1)
Message ( "moon phase to use = " & ph , "ph value" )
if (ph > 23)
ph = 0
endif
# ph = 0 (NEW) thru 23 (last of the waning cresent)
# copy file
fname="\Windows\moon-" & ph & "_manila.x"
# message(fname,ph)
# delete ("\Windows\060bb8f2_manila")
Copy (fname, "\My Documents\060bb8f2_manila", TRUE)
Copy ("\My Documents\060bb8f2_manila", "\Windows\060bb8f2_manila", TRUE)
# that's it.