It is currently May 14th, 2024, 12:03 pm
Get help with creating, editing & fixing problems with skins
Kaelri
Developer
Posts: 1721 Joined: July 25th, 2009, 4:47 am
Post
by Kaelri » July 27th, 2012, 7:12 pm
Fulmar wrote: One last question in this topic maybe: I will calculate the orbits for n objects in the same skin. Can this be done by this one Lua script? Do I create another Measure "MeasureKeplerScript" and another Meter "MeterLuaReturn" for each object?
Yes, the easiest way would be to create additional script measures. They can all use the same "Kepler.lua" script file; each will return the correct results for their "M" and "e" settings. Example:
Code: Select all
[Kepler1]
Measure=Script
ScriptFile=#CURRENTPATH#Kepler.lua
M=MeadObject1
e=EcorObject1
[Kepler2]
Measure=Script
ScriptFile=#CURRENTPATH#Kepler.lua
M=MeadObject2
e=EcorObject2
Fulmar
Posts: 21 Joined: July 24th, 2012, 4:50 pm
Location: Belgium
Post
by Fulmar » August 26th, 2012, 3:09 pm
Just to tell the Kepler lua is working fine, except I had to change the script a bit. Because of the extreme accuracy Rainmeter crashed easily.
The script is now:
function Initialize()
MeasureName_M = SELF:GetOption("M")
MeasureName_e = SELF:GetOption("e")
Measure_M = SKIN:GetMeasure(MeasureName_M)
Measure_e = SKIN:GetMeasure(MeasureName_e)
end
function Update()
local M = Measure_M:GetValue()
local e = Measure_e:GetValue()
local E = M
repeat
local LastE = E
E = E + (M + math.deg(e)*math.sin(math.rad(E)) - E)/(1 - e*math.cos(math.rad(E)))
until math.abs (E - LastE) < 0.0000000001
return E
end
Thanks for your help
Kaelri
Developer
Posts: 1721 Joined: July 25th, 2009, 4:47 am
Post
by Kaelri » August 26th, 2012, 3:22 pm
That makes sense. Good solution. Glad everything's working out. :)
Lightz39
Posts: 98 Joined: August 1st, 2012, 12:48 am
Post
by Lightz39 » August 27th, 2012, 3:10 am
This is the most ridiculous thing I've ever read in my life. Nerds.
My brain hurts.
jsmorley
Developer
Posts: 22632 Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA
Post
by jsmorley » August 27th, 2012, 3:12 am
Lightz39 wrote: This is the most ridiculous thing I've ever read in my life. Nerds.
My brain hurts.
LOL.. I'm glad you said it. I was just thinking it.