Scientific Math

309 views
Skip to first unread message

Jeremy Harris

unread,
Dec 23, 2014, 3:44:52 PM12/23/14
to tas...@googlegroups.com
My next project involves calculating sunrise/sunset times based on a user's location. The formula that I need to calculate is:

cos(X) = -tan(Y)*tan(Z)

There's probably a way to do this with Java or Javascript, but i dont know either.

Is it possible to calculate this using regular Tasker actions?

Scott Miller

unread,
Dec 23, 2014, 4:20:47 PM12/23/14
to tas...@googlegroups.com

There are a couple of Tasker/Locale plug-ins that might already do what you need, although I realize it's more fun to struggle with the math and native Tasker actions. :-)

https://play.google.com/store/apps/details?id=se.akerfeldt.locale.sun

https://play.google.com/store/apps/details?id=com.terdelle.twilight

I prefer the second one, and it might be closer to what you need.

Scott

Rich D

unread,
Dec 23, 2014, 4:21:30 PM12/23/14
to Tasker Google Groups Post

> Is it possible to calculate this using regular Tasker actions?

From the guide..
Maths

Where Is Maths Used ?

When you do Variable Set and click the Do Maths checkbox
With the If action, if you select a mathematical comparison like < or =
With individual action conditions when a mathematical comparison is selected
What's Available

Tasker uses the MathEval library by Lawrence PC Dol.
Operators

+ - * / - the basic operators
% - modulus
^ - power
Constants

E - the base of the natural logarithms
EUL - Euler's Constant
LN2 - log of 2 base e
LN10 - log of 10 base e
LOG2E - log of e base 2
LOG10E - log of e base 10
PHI - the golden ratio
PI - the ratio of the circumference of a circle to its diameter
Functions

Functions take their argument in parenthesis e.g. sin(90)
abs - absolute value
acos - arc cosine; the returned angle is in the range 0.0 through pi
asin - arc sine; the returned angle is in the range -pi/2 through pi/2
atan - arc tangent; the returned angle is in the range -pi/2 through pi/2
cbrt - cube root
ceil - smallest value that is greater than or equal to the argument and is an integer
cos - trigonometric cosine
cosh - hyperbolic cosine
exp - Euler's number e raised to the power of the value
expm1 - ex-1
floor - largest value that is less than or equal to the argument and is an integer
getExp - unbiased exponent used in the representation of val
log - natural logarithm (base e)
log10 - base 10 logarithm
log1p - natural logarithm of (val+1)
nextup - floating-point value adjacent to val in the direction of positive infinity
round - closest 64 bit integer to the argument
roundhe - double value that is closest in value to the argument and is equal to a mathematical integer, using the half-even rounding method.
signum - signum function of the argument; zero if the argument is zero, 1.0 if the argument is greater than zero, -1.0 if the argument is less than zero
sin - trigonometric sine
sinh - hyperbolic sine
sqrt - correctly rounded positive square root
tan - trigonometric tangent
tanh - hyperbolic tangent
todeg - converts an angle measured in radians to an approximately equivalent angle measured in degrees
torad - converts an angle measured in degrees to an approximately equivalent angle measured in radians
ulp - size of an ulp of the argument

Jeremy Harris

unread,
Dec 23, 2014, 4:33:14 PM12/23/14
to tas...@googlegroups.com

There are a couple of Tasker/Locale plug-ins that might already do what you need, although I realize it's more fun to struggle with the math and native Tasker actions. :-)

Thanks Scott! You're right, the struggle is the FUN part! I d/l Twilight the other day, and it is useful for my auto brightness profiles (saved me from parsing an html source), but as far as I can tell, there's no actions or variables built in to it that I can use.

I'll check out the other one that you posted. Much appreciated!

Jeremy Harris

unread,
Dec 23, 2014, 4:36:31 PM12/23/14
to tas...@googlegroups.com

From the guide..
Maths

Huh....I googled all afternoon...I searched this group for everything from "scientific math" to "cosine" to "sine" and cane up with little....but some interesting threads.

I'm stumped as to why it didn't occur to me to check the userguide FIRST!

Thanks for the info... I'm gonna be up to my eyeballs in trig for a little while!

Scott Miller

unread,
Dec 23, 2014, 4:40:59 PM12/23/14
to tas...@googlegroups.com
Yeah, it might be just as much work, but because Twilight works as a very flexible state plugin, you can use it in its own profile and set a variable. Then another profile can trigger on the variable set event that occurs when Twilight goes active, and likewise a variable clear event when Twilight goes inactive. But it's probably more challenging to see the logic clearly this way. Doing it with math functions seems more obvious, once you have it figured out. 

Scott


Jeremy Harris

unread,
Dec 23, 2014, 5:04:19 PM12/23/14
to tas...@googlegroups.com

My end goal is to create a project that calculates 'best hunting times' (....or in my case, as it turns out, 'best snow melting watching times' LOL).

So, I'll be calculating sunrise/sunset, twilight, lunar overhead and underfoot times, weather, etc....for current and/or future dates and at current and/or projected locations. 

This sounds to me like a much more difficult task (at this point) than i think it'll actually turn out to be, once i get the math all worked out...

Should be an interesting challenge.  :)

Richard Finegold

unread,
Dec 23, 2014, 5:22:04 PM12/23/14
to tas...@googlegroups.com

Jeremy Harris

unread,
Dec 23, 2014, 6:18:55 PM12/23/14
to tas...@googlegroups.com

Wow, fantastic find, thank you! Those variables are exactly what I'm trying to calculate!! I imported file and profile and it works.  :D

...just took the fun out of it, but also saved me a few brain hemorrages from dusting off math I haven't used in 20 years!

Didn't think I'd get to lunar calculations today, but looks like that's my next hurdle.  :)

Thanks Richard!

On 23 Dec 2014 17:22, "Richard Finegold" <gold...@gmail.com> wrote:
--
You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/ggA5W6GERdQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+un...@googlegroups.com.
Visit this group at http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Morgan Young

unread,
Dec 24, 2014, 12:49:33 AM12/24/14
to tas...@googlegroups.com
I understand completely. Development of the user guide seems to have completely stopped. I wouldn't have thought to check it either.

Pent

unread,
Dec 24, 2014, 4:15:19 AM12/24/14
to tas...@googlegroups.com


I understand completely.  Development of the user guide seems to have completely stopped.

It changes with every new version. If you notice errors or ommisions, please let me know.

Pent

Jeremy Harris

unread,
Dec 24, 2014, 1:54:35 PM12/24/14
to tas...@googlegroups.com

Didn't think I'd get to lunar calculations today, but looks like that's my next hurdle.  :)

So, moonrise/set times are even more difficult to calculate. I actually found a source that uses JavaScript to create an html query extension for a site that calculates for me...looks very flexible as far as location and future dates too.

http://www.aphayes.pwp.blueyonder.co.uk/sun_moon.html

All the js files are there to download, so I either need to figure out how to use them or use native Tasker actions to interpret input and create the query string.

Obviously I am more comfortable working with the latter, but JavaScript should process more efficiently...if i can figure out how to use these pre-made scripts.

Hectic couple of days here, but I'm hoping to work this out before Santa gets back home!

Morgan Young

unread,
Dec 24, 2014, 2:52:53 PM12/24/14
to Tasker
on this page:  http://thebaconnation.com/tasker_res.html  has a tasker profile set up that tells you moon rise and moon set.

Be safe; get prepared.
Morgan Young, EMT-P
richard.m....@gmail.com

Jeremy Harris

unread,
Dec 24, 2014, 2:58:14 PM12/24/14
to tas...@googlegroups.com

Good lookin' out Morgan, thank you. I actually found that site last night. The xml won't import for me... I'll try again tonight or tomorrow...It might be I didn't copy/paste the text properly...it could be an old xml that is not compatible with newer versions of tasker... Not sure.

If i can get that to work, it'll probably be my first choice.

Much appreciated, and Merry Christmas (or happy <your holiday goes here>)!

Morgan Young

unread,
Dec 24, 2014, 3:03:07 PM12/24/14
to Tasker

Mine is Christmas.  I got the .xml to import.  Put I might have had to add .tsk.xml to the file name. 

Jeremy Harris

unread,
Dec 24, 2014, 6:01:26 PM12/24/14
to tas...@googlegroups.com

Yeah, i definitely have the file extensions right.  When I attempt to import, I get "Error: bad data type" and after closing and relaunching tasker, I get the message in the screenshot.

The xml text mentions version 4.3.u3m....

I'm curious what version of Tasker you're running? Also, when I click the link to the xml, I don't get a file to dl...I get a webpage with the xml text that I copy/paste into a new file using ES File Explorer.

That has worked fine for me in the past, but maybe I'll try a different text editor.

Screenshot_2014-12-24-17-17-58.png

Jeremy Harris

unread,
Dec 24, 2014, 6:40:25 PM12/24/14
to tas...@googlegroups.com

I uninstalled v. 4.5.u1m and installed the old 4.3.u3... Still no joy. Not sure why....

On a side note....always backup to your external sd...thank goodness for Titanium Backup b/c I deleted my userbackup.xml on accident in that process. Now I'm on the new 4.6.1 and only lost work since my last TB backup, about a week ago.

Morgan Young

unread,
Dec 24, 2014, 8:10:31 PM12/24/14
to Tasker

I am using 4.6u1m.
I downloaded directly to my phone, by tap and hold, then selecting save link or save link destination.
Then moving the downloaded on my phone from downloads over to the tasker folder for tasks.

--

Jeremy Harris

unread,
Dec 24, 2014, 9:44:51 PM12/24/14
to tas...@googlegroups.com

Score. Thank you! Lol... That was dumb.

Merry Christmas again!

Jeremy Harris

unread,
Dec 26, 2014, 9:16:37 AM12/26/14
to tas...@googlegroups.com

I started this thread trying to perform math calculations using native Tasker actions. I didn't intend to turn this into a "spoon feed me java script" thread. However, I am very close, but stuck. If anyone has a few moments to look at the blueyonder page linked below...

So here's where I'm at. The task that I imported <a href="http://thebaconnation.com/tasker_res.html"> HERE </a> does work, but not for my purposes because there's no way to query a user's location into intellicast's URL...although, I could make this work with a static location.

The profile and JavaScript that Richard linked from the wiki <a href=" http://tasker.wikidot.com/sunrisesunset"> HERE </a> is exactly what I'm looking for, returning variables that I can use in Tasker...however it only calculates data for the sun and not the moon.

I actually found a source that uses JavaScript to create an html query extension for a site that calculates for me...looks very flexible as far as location and future dates too.

http://www.aphayes.pwp.blueyonder.co.uk/sun_moon.html

All the js files are there to download, so I either need to figure out how to use them or use native Tasker actions to interpret input and create the query string.

Working with this site, I've successfully been able to get tasker to generate the query string correctly, and I can get all the data I need...sort of.  The website runs some JavaScripts for the calculations, then prints the results back to the web page. I can test this successfully, using the Browse URL Action. My problem is that the results are returned in embedded JavaScript in the webpage, so when I look at %HTTPD the values for ride/set times appear as "&nbsp".... so I can't access those values. Although I can see them displayed properly using Browse URL.

Does anyone know how I can access those Javascript variables in tasker?

Jeremy Harris

unread,
Dec 26, 2014, 9:21:06 AM12/26/14
to tas...@googlegroups.com

Also, I know that &nbsp is whitespace...I think somehow the .js is replacing those white spaces with a string containing the value of the actual variable.

Lastly, I've discovered this api here:

https://www.mashape.com/community/cerridwen-solar-system-data

I can't figure out how to use it but it may be a solution.

Jeremy Harris

unread,
Dec 26, 2014, 4:13:05 PM12/26/14
to tas...@googlegroups.com

Okay, i was wrong about &nbsp. Below is the script from the webpage that displays the info...it is embedded in the html, and refers to functions described in two different .js files in the 'library'.

[CODE]
var mrs=MoonRise(Year,Month,Day,TZ,Lat,Long);
if ((mrs[0]<0) && (mrs[1]<0)) {
  if (mrs[0]==-1) {
    document.write("Moon is down all day<br>");
  } else {
    document.write("Moon is up all day<br>");
  }
} else {
  if (mrs[1]<=mrs[0]) {
    if (mrs[1]>=0) {
      document.write("Moon sets at&nbsp;&nbsp;"+hmstring(mrs[1])+" "+TZname+"<br>");
    }
    if (mrs[0]>=0) {
      document.write("Moon rises at&nbsp;"+hmstring(mrs[0])+" "+TZname+"<br>");
    }
  } else {
    if (mrs[0]>=0) {
      document.write(" Moon rises at&nbsp;"+hmstring(mrs[0])+" "+TZname+"<br>");
    }
    if (mrs[1]>=0) {
      document.write(" Moon sets at&nbsp;&nbsp;"+hmstring(mrs[1])+" "+TZname+"<br>");
    }
  }
}
[/CODE]

The JavaScript declared variable 'mrs' contains the value of the result from the function 'MoonRise' in 'moon.js'

The function 'MoonRise' in 'moon.js' returns an array of the rise and set times called 'riseset'

The html/js from the webpage shows the code for dissipation this information as "+hmstring(mrs[0])+"

'hmstring' is a time formatting function of 'clock.js'

So the raw data that I need to access is contained in a variable 'riseset' that I can't access in Tasker because moon.js is called by the html query, not with a JavaScript action. And the variable 'mrs' is not accessible in Tasker because it is declared in a webpage document instead of a JavaScript file.

How can I access this data with Tasker? I'm wondering if I can copy/paste the embedded JavaScript into a new file to use as a 'method' sort of script. I know there will likely be formatting issues that I would have to overcome, but I'm not sure if the idea is even feasible. Here's what the code looks like from the webpage source:

[CODE]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sun and Moon Calculations</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<meta name="Description" content="Sun and moon calculations">
<meta name="Keywords" content="sun,sunrise,sunset,moon phase,javascript">

<!-- EDIT THE library PART OF THE NEXT LINES FOR YOUR DIRECTORIES -->

<link href="library/default.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/javascript" src="library/clock.js">
</script>

<script language="JavaScript" type="text/javascript" src="library/degrees.js">
</script>

<script language="JavaScript" type="text/javascript" src="library/astro.js">
</script>

<script language="JavaScript" type="text/javascript" src="library/sun.js">
</script>

<script language="JavaScript" type="text/javascript" src="library/moon.js">
</script>

</head>

<body>

<h1>Sun and Moon Calculations</h1>
<p>
<noscript>
<p><center>
<b><font size="+2">Please enable JavaScript to use this page.</font></b>
</center>
<p>
</noscript>

<!--
If you've saved this you may find the script missing and some text
that gives sun and moon details. Save the page again as described
below.
-->


<center>
<table border="1" cellpadding="5" width="90%" class="fixed_bluebox">
<tr align="center">
<td>

<script language="JavaScript" type="text/javascript">

// Default date and time from your computer

var now=new Date();
var Year=getFullYear(now);
var Month=now.getMonth()+1;
var Day=now.getDate();
var TZ=now.getTimezoneOffset();
var TZsummer=false;
document.write("<b>Your clock "+now.toLocaleString()+"<\/b><br>");
document.write("Which is "+now.toUTCString()+"<br>");
// Try to find daylight saving
now.setMonth(0); var tz0 = now.getTimezoneOffset();
now.setMonth(6); var tz6 = now.getTimezoneOffset();
if (tz6 < tz0) { // Northern hemisphere with DST
  document.write("You appear to be in the Northern hemisphere");
  if (TZ < tz0) {
    document.write(" with daylight saving time on");
    TZsummer=true;
  } else {
    document.write(" with daylight saving time off");
  }
}
if (tz0 < tz6) { // Southern hemisphere with DST
  document.write("You appear to be in the Southern hemisphere");
  if (TZ < tz6) {
    document.write(" with daylight saving time on");
    TZsummer=true;
  } else {
    document.write(" with daylight saving time off");
  }
}
document.write("<p>");

// Place = the name of the place the calculations are done for
// Lat = your local latitude: north positive, south negative
// Long = your local longitude: east of Greenwich is positive
// TZ = difference between your time and Greenwich time in hours
// east of Greenwich is positive, you can add 1 hour for daylight saving.
// If your computer is set to your timezone we'll make the correction for you.
// TZname = time zone name, can be a blank string might be changed for DST
// but you need to tell us what it is called if zones are not GMT/BST.

var Place = "Greenwich";
var Lat = +51.4778;
var Long = 0.0;
var TZ = 0;       // +1 for British Summer Time Correction
var TZname="GMT"; // Change to your local zone time name
if (TZsummer==true) {
  TZ+=1;
  TZname="BST"   // Change to your local zone summer time name
}
// Update variables passed as a search string

if (location.search.length > 1) {
  var argstr = location.search.substring(1,location.search.length);
  var args = argstr.split('&');
  for (var i=0; i<args.length; i++) eval(unescape(args[i]));
}

// sun rise and set

var suntimes=SunRiseSet(Year,Month,Day,Lat,Long);
document.write("<b>At "+Place+" on "+datestring(Year,Month,Day)+"<\/b><br>");
document.write("Sun rises at&nbsp;");
document.write(hmstring(suntimes[0]+TZ)+" "+TZname);
document.write("<br>");
document.write("Sun sets at&nbsp;&nbsp;");
document.write(hmstring(suntimes[1]+TZ)+" "+TZname);
document.write("<br>");
document.write("&nbsp;&nbsp;Sun up for&nbsp;&nbsp;&nbsp;");
document.write(hmstring(suntimes[1]-suntimes[0])+" &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
document.write("<p>");

// Moon rise and set
// WARNING code here changed on 6/7 May 2003
// SunRiseSet uses UTC as the Sun position varies slowly
// MoonRiseSet now uses local zone time (including daylight saving)
// if this is not done it is possible to go into the previous or next day

var mrs=MoonRise(Year,Month,Day,TZ,Lat,Long);
if ((mrs[0]<0) && (mrs[1]<0)) {
  if (mrs[0]==-1) {
    document.write("Moon is down all day<br>");
  } else {
    document.write("Moon is up all day<br>");
  }
} else {
  if (mrs[1]<=mrs[0]) {
    if (mrs[1]>=0) {
      document.write("Moon sets at&nbsp;&nbsp;"+hmstring(mrs[1])+" "+TZname+"<br>");
    }
    if (mrs[0]>=0) {
      document.write("Moon rises at&nbsp;"+hmstring(mrs[0])+" "+TZname+"<br>");
    }
  } else {
    if (mrs[0]>=0) {
      document.write(" Moon rises at&nbsp;"+hmstring(mrs[0])+" "+TZname+"<br>");
    }
    if (mrs[1]>=0) {
      document.write(" Moon sets at&nbsp;&nbsp;"+hmstring(mrs[1])+" "+TZname+"<br>");
    }
  }
}

// Moon phase
var mp=MoonPhase(Year,Month,Day,0-TZ);
document.write("Moon phase at 00:00 is "+Math.round(mp)+
               "<sup><font size=\"-1\">&deg;<\/font><\/sup> ");              
document.writeln(" = "+Math.round(100.0*(1.0+cosd(mp))/2.0)+"% illuminated<br>");
mp=MoonPhase(Year,Month,Day,24.00-TZ);
document.write("Moon phase at 24:00 is "+Math.round(mp)+
               "<sup><font size=\"-1\">&deg;<\/font><\/sup> ");              
document.writeln(" = "+Math.round(100.0*(1.0+cosd(mp))/2.0)+"% illuminated<p>");
// Table of the new, moon first quarter, full mon and last quarter
document.writeln("<table border=\"1\"cellpadding=\"5\">");
document.write("<tr><td align=\"center\">&nbsp;</td>");
document.write("<td align=\"center\">Date</td><td align=\"center\">Time (UT)</td>");
document.writeln("<td align=\"center\">Phase at 00:00 "+TZname+"</td></tr>");
var JDE=MoonQuarters(Year,Month,Day);
var JDEc;
for (i=0; i<=3; i++) {
  JDEc=jdtocd(JDE[i]);
  mp=MoonPhase(JDEc[0],JDEc[1],JDEc[2],0.0-TZ);
  if (i==0) { document.write("<tr><td>new moon</td>"); }
  if (i==1) { document.write("<tr><td>first quarter</td>"); }
  if (i==2) { document.write("<tr><td>full moon</td>"); }
  if (i==3) { document.write("<tr><td>last quarter</td>"); }
  document.write("<td>"+datestring(JDEc[0],JDEc[1],JDEc[2])+"</td>");
  document.writeln("<td align=\"center\">"+((JDEc[4]<10) ? " 0" : " ")+JDEc[4]+((JDEc[5]<10) ? ":0" : ":")+JDEc[5]+"</td>");
  document.writeln("<td align=\"center\">"+Math.round(mp)+"<sup><font size=\"-1\">&deg;<\/font><\/sup></td></tr>");
}

document.writeln("</table>");
</script>
[/CODE]

Jeremy Harris

unread,
Dec 30, 2014, 10:40:39 AM12/30/14
to tas...@googlegroups.com

I had continued this idea in a new thread, due to the subject staying far from the title of this thread.

https://groups.google.com/forum/m/#!topic/tasker/GP9JNlpWOlE

I have worked out the html/javascript and have all rise/set times processed in the script and available as Tasker variables.

I think I just used native Tasker actions to use that information to successfully calculate when Moon is directly overhead and underfoot...results look accurate to me. If any math geniuses are curious or bored:

HT Calc Lunar Major_Minor (249)
A1: Perform Task [ Name:HT LOC Convert Priority:%priority+1 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable:%location Stop:Off ]
A2: Perform Task [ Name:HT Get Sun and Moon Priority:%priority+1 Parameter 1 (%par1):%location Parameter 2 (%par2): Return Value Variable:%sunmoon Stop:Off ]
A3: Variable Split [ Name:%sunmoon Splitter:| Delete Base:Off ]
A4: Variable Set [ Name:%mnrise To:%sunmoon3 Do Maths:Off Append:Off ]
A5: Variable Set [ Name:%mnset To:%sunmoon4 Do Maths:Off Append:Off ]
A6: Variable Split [ Name:%mnrise Splitter:: Delete Base:Off ]
A7: Variable Split [ Name:%mnset Splitter:: Delete Base:Off ]
A8: Perform Task [ Name:HT Calc Date Tomorrow Priority:%priority+1 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable:%date Stop:Off ]
A9: Perform Task [ Name:HT Get Sun and Moon Priority:%priority+1 Parameter 1 (%par1):%location Parameter 2 (%par2):%date Return Value Variable:%sunmoon Stop:Off ]
A10: Variable Split [ Name:%sunmoon Splitter:| Delete Base:Off ]
A11: Variable Set [ Name:%tm_mnrise To:%sunmoon3 Do Maths:Off Append:Off ]
A12: Variable Set [ Name:%tm_mnset To:%sunmoon4 Do Maths:Off Append:Off ]
A13: Variable Split [ Name:%tm_mnrise Splitter:: Delete Base:Off ]
A14: Variable Split [ Name:%tm_mnset Splitter:: Delete Base:Off ]
A15: Perform Task [ Name:HT Calc Date Yesterday Priority:%priority+1 Parameter 1 (%par1): Parameter 2 (%par2): Return Value Variable:%date Stop:Off ]
A16: Perform Task [ Name:HT Get Sun and Moon Priority:%priority+1 Parameter 1 (%par1):%location Parameter 2 (%par2):%date Return Value Variable:%sunmoon Stop:Off ]
A17: Variable Split [ Name:%sunmoon Splitter:| Delete Base:Off ]
A18: Variable Set [ Name:%yd_mnrise To:%sunmoon3 Do Maths:Off Append:Off ]
A19: Variable Set [ Name:%yd_mnset To:%sunmoon4 Do Maths:Off Append:Off ]
A20: Variable Split [ Name:%yd_mnrise Splitter:: Delete Base:Off ]
A21: Variable Split [ Name:%yd_mnset Splitter:: Delete Base:Off ]
A22: If [ %mnset1 < %mnrise1 ]
A23: Variable Set [ Name:%lunar_underfoot_calc To:(((((12-%mnset1)+1)*60)+(60-%mnset2)+((%mnrise1-12)*60)+%mnrise2)/2)/60 Do Maths:On Append:Off ]
A24: Variable Split [ Name:%lunar_underfoot_calc Splitter:. Delete Base:Off ]
A25: Variable Set [ Name:%lunar_underfoot_min To:%lunar_underfoot_calc2*60 Do Maths:On Append:Off ]
A26: Variable Section [ Name:%lunar_underfoot_min From:1 Length:2 Adapt To Fit:Off Store Result In: ]
A27: Variable Set [ Name:%lunar_underfoot_hours To:%mnset1+%lunar_underfoot_calc1 Do Maths:On Append:Off ]
A28: Variable Set [ Name:%Moon_Underfoot To:%lunar_underfoot_hours:%lunar_underfoot_min Do Maths:Off Append:Off ]
A29: Variable Set [ Name:%lunar_overhead_calc To:((((((24-%yd_mnrise1)+1)*60)+(60-%yd_mnrise2))+((%mnset1*60)+%mnset2))/2)/60 Do Maths:On Append:Off ]
A30: Variable Split [ Name:%lunar_overhead_calc Splitter:. Delete Base:Off ]
A31: Variable Set [ Name:%lunar_overhead_min To:%lunar_overhead_calc2*60 Do Maths:On Append:Off ]
A32: Variable Section [ Name:%lunar_overhead_min From:1 Length:2 Adapt To Fit:Off Store Result In: ]
A33: Variable Set [ Name:%lunar_overhead_hours To:%mnset1-%lunar_overhead_calc1 Do Maths:On Append:Off ]
A34: Variable Set [ Name:%Moon_Overhead To:%lunar_overhead_hours:%lunar_overhead_min Do Maths:Off Append:Off ]
A35: If [ %lunar_overhead_hours < 0 ]
A36: Variable Set [ Name:%lunar_overhead_calc To:((((((24-%mnrise1)+1)*60)+(60-%mnrise2))+((%tm_mnset1*60)+%tm_mnset2))/2)/60 Do Maths:On Append:Off ]
A37: Variable Split [ Name:%lunar_overhead_calc Splitter:. Delete Base:Off ]
A38: Variable Set [ Name:%lunar_overhead_min To:%lunar_overhead_calc2*60 Do Maths:On Append:Off ]
A39: Variable Section [ Name:%lunar_overhead_min From:1 Length:2 Adapt To Fit:Off Store Result In: ]
A40: Variable Set [ Name:%lunar_overhead_hours To:%mnrise1+%lunar_overhead_calc1 Do Maths:On Append:Off ]
A41: Variable Set [ Name:%Moon_Overhead To:%lunar_overhead_hours:%lunar_overhead_min Do Maths:Off Append:Off ]
A42: End If
A43: Else If [ %mnset1 > %mnrise1 ]
A44: Variable Set [ Name:%lunar_overhead_calc To:(((((12-%mnrise1)+1)*60)+(60-%mnrise2)+((%mnset1-12)*60)+%mnset2)/2)/60 Do Maths:On Append:Off ]
A45: Variable Split [ Name:%lunar_overhead_calc Splitter:. Delete Base:Off ]
A46: Variable Set [ Name:%lunar_overhead_min To:%lunar_overhead_calc2*60 Do Maths:On Append:Off ]
A47: Variable Section [ Name:%lunar_overhead_min From:1 Length:2 Adapt To Fit:Off Store Result In: ]
A48: Variable Set [ Name:%lunar_overhead_hours To:%mnrise1+%lunar_overhead_calc1 Do Maths:On Append:Off ]
A49: Variable Set [ Name:%Moon_Overhead To:%lunar_overhead_hours:%lunar_overhead_min Do Maths:On Append:Off ]
A50: Variable Set [ Name:%lunar_underfoot_calc To:((((((24-%mnset1)+1)*60)+(60-%mnset2))+(%tm_mnrise1*60)+%tm_mnrise2)/2)/60 Do Maths:On Append:Off ]
A51: Variable Split [ Name:%lunar_underfoot_calc Splitter:. Delete Base:Off ]
A52: Variable Set [ Name:%lunar_underfoot_min To:%lunar_underfoot_calc2*60 Do Maths:On Append:Off ]
A53: Variable Section [ Name:%lunar_underfoot_min From:1 Length:2 Adapt To Fit:Off Store Result In: ]
A54: Variable Set [ Name:%lunar_underfoot_hours To:%mnset1+%lunar_underfoot_calc1 Do Maths:On Append:Off ]
A55: Variable Set [ Name:%Moon_Underfoot To:%lunar_underfoot_hours:%lunar_underfoot_min Do Maths:Off Append:Off ]
A56: If [ %lunar_underfoot_hours > 23 ]
A57: Variable Set [ Name:%lunar_underfoot_calc To:((((((24-%yd_mnrise1)+1)*60)+(60-%yd_mnrise2))+(%mnset1*60)+%mnset2)/2)/60 Do Maths:On Append:Off ]
A58: Variable Split [ Name:%lunar_underfoot_calc Splitter:. Delete Base:Off ]
A59: Variable Set [ Name:%lunar_underfoot_min To:%lunar_underfoot_calc2*60 Do Maths:On Append:Off ]
A60: Variable Section [ Name:%lunar_underfoot_min From:1 Length:2 Adapt To Fit:Off Store Result In: ]
A61: Variable Set [ Name:%lunar_underfoot_hours To:%mnset1-%lunar_underfoot_calc1 Do Maths:On Append:Off ]
A62: Variable Set [ Name:%Moon_Underfoot To:%lunar_underfoot_hours:%lunar_underfoot_min Do Maths:Off Append:Off ]
A63: End If
A64: End If

Reply all
Reply to author
Forward
0 new messages