LUAPLUGINS: Distance Calculator

All Lua-tools for Celestia in one forum.
Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 1 month
Location: Paris France

Re: LUAPLUGINS: Distance Calculator

Post #21by jogad » 08.02.2013, 19:58

Hi

I have found a serious bug in this plugin. :twisted:

Code: Select all

plugins =
   {
      -- "compassBox",
      "KeplerParamBox",
      "coordinateBox",
      "pictureBox",
      "HRBox",
      "distance_calc",    <- string to add
   }

If you run the Lua Plug-ins without the compass, it doesn't work at all! :roll:

Your plugin should not rely on another tool to work.
:idea: This is very likely why it doesn't work with Lua Edu Tools.
It is a pity because the litte toolbar that you are using is designed to make plugins that work automatically with both Lua Plug-ins and Lua Edu tools.

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: LUAPLUGINS: Distance Calculator

Post #22by Fenerit » 08.02.2013, 21:36

jogad wrote:If you run the Lua Plug-ins without the compass, it doesn't work at all! :roll:

I do not recognize this bug. On my system all works fine even though the "compassBox.lua" is commented out; both whether the "distance_calc" is placed as subfolder of .."extras/" or as subfolder of "..extras/lua_plugins/". The only library it does use is the "celutil.lua"; thus whether placed as subfolder of "..extras/" it would use that of luatools or plugins either (if specified). As subfolder of "../lua_plugins" such a library can be unspecified as "require" due to the path root; while as subfolder of "..extras/", yes (for the Luatools, tough). This is the difference amongst luatools and luaplugins about external modules, like you can see with the CMODtracer, that works also from Luatools and in which such library has been forcely specified. The why this plugin doesn't work on Luatools must be another question respect to such library.

P.S.
I do not think that plug-ins must not rely on pre-existent library: this should be a limitation for more complex plugins; being LUA an interpreted language and not a compiled language.

EDIT LATER:
If both lua_edu_tools and lua_plugins are present in "../extras" they can do conflict even though just one hook only is specified; must be place an underscore on the folders to avoid them (i.e ../extras/_lua_edu_tools/" or ../extras/_lua_plug_ins/".
Never at rest.
Massimo

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: LUAPLUGINS: Distance Calculator

Post #23by Fenerit » 08.02.2013, 22:40

Info: I find a bug with "coordinateBox" commented out, tough! :x
Never at rest.
Massimo

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 10 months

Re: LUAPLUGINS: Distance Calculator

Post #24by Chuft-Captain » 08.02.2013, 22:55

Code: Select all

"distance_calc",    <- string to add
-->

Code: Select all

"distance_calc",    -- <- string to add
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: LUAPLUGINS: Distance Calculator

Post #25by Fenerit » 09.02.2013, 05:05

Wait... I'm arriving... @echo..Brz$$$$$$REM@@fail$$$success!!!|@ECHO OFF
prompt $p$g...kfgtreyhf@@@@STACKover??$flow
Never at rest.
Massimo

Avatar
Chuft-Captain
Posts: 1779
Joined: 18.12.2005
With us: 18 years 10 months

Re: LUAPLUGINS: Distance Calculator

Post #26by Chuft-Captain » 10.02.2013, 04:14

Fenerit wrote:Wait... I'm arriving... @echo..Brz$$$$$$REM@@fail$$$success!!!|@ECHO OFF
prompt $p$g...kfgtreyhf@@@@STACKover??$flow
WTF ?!
"Is a planetary surface the right place for an expanding technological civilization?"
-- Gerard K. O'Neill (1969)

CATALOG SYNTAX HIGHLIGHTING TOOLS LAGRANGE POINTS

symaski62
Posts: 609
Joined: 01.05.2004
Age: 41
With us: 20 years 6 months
Location: france, divion

Re: LUAPLUGINS: Distance Calculator

Post #27by symaski62 » 10.02.2013, 20:27

:) distance
windows 10 directX 12 version
celestia 1.7.0 64 bits
with a general handicap of 80% and it makes much d' efforts for the community and s' expimer, thank you d' to be understanding.

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: LUAPLUGINS: Distance Calculator

Post #28by Fenerit » 11.02.2013, 14:45

LOCAL!

Distance calculator v. 1.0 (see first post)

Thanks to Jo?l now this plugin is fully functional also for LUA EDU TOOLS. Jo?l has corrected all bugs in my fault code, from which its ergonomics result changed, thus the original "one-shot" button and the colors shift have been recovered. Now this latter follows the illuminated fraction of the object (aside stars) instead of its phase angle; this feature makes the color' shift more coehrent with the toggling through the poles. Moreover, if I've well understood the symaski62's remarks, the distance is now calculated for objects radii which are in the order of meters (spacecrafts).

distance_calc_1.0.jpg
Never at rest.
Massimo

Avatar
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 1 month
Location: Paris France

Re: LUAPLUGINS: Distance Calculator

Post #29by jogad » 11.02.2013, 22:39

Hi,
Fenerit wrote:Jo?l has corrected all bugs in my fault code

I fear it is not true :oops:

I you click the button when a DSO is selected, it crashes !
It is possible to make it work for DSO too, but I think it is not relevant.
I propose a fix to prevent making measures on galaxies, globulars and so on...

Code: Select all

distance_calc_function[1] = function()
   celestia:setrenderflags{markers = true};
   refObj = nil
   long1 = nil
   celestia:unmarkall();
   local sel = celestia:getselection()
   if not empty(sel) then
      if sel:type() == "location" then
         sel:mark(StartMarkerColor, StartMarkerSymbol, StartMarkerSize, StartMarkerOpacity, "", false);
         local obsposition = obs:getposition()
         obs:setposition(sel:getposition())
         refObj = sel:getinfo().parent
         long1, lat1 = celutil.get_long_lat(obs, refObj)
         obs:setposition(obsposition)
      else
         refObj = sel
      end
   else
      refObj = obs:getframe():getrefobject()
   end
   if refObj then
      if refObj:getinfo().parent or refObj:type() == "star" then
         celestia:select(refObj)
         obs:follow(refObj)
         if not long1 then
            long1,lat1 = celutil.get_long_lat(obs, refObj)
         end
         refObj:mark(CalcMarkerColor, CalcMarkerSymbol, CalcMarkerSize, CalcMarkerOpacity, "", false);
      else
         refObj = nil
      end
   end
end;


:idea: As I am playing with this tool, I think it would be cool if we can have the starting point marker even if it is not a location.
I think it is possible with a fake object.
:mrgreen:

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: LUAPLUGINS: Distance Calculator

Post #30by Fenerit » 12.02.2013, 02:55

jogad wrote:Hi,

I fear it is not true :oops:

I you click the button when a DSO is selected, it crashes !
It is possible to make it work for DSO too, but I think it is not relevant.

Ops!.. I didn't noticed that. The link has been updated.
Never at rest.
Massimo

Avatar
Topic author
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 7 months
Location: Thyrrenian sea

Re: LUAPLUGINS: Distance Calculator

Post #31by Fenerit » 12.02.2013, 16:35

Distance calculator v. 1.1 (see first post)

Minor fixes:

- fixed the displacement of the button when Celestia is resized in windowed mode. Now the button remains where is.
- fixed the time delay when the plugin exit. Now the restored time does account for the time spent in measuring.
Never at rest.
Massimo


Return to “Lua-Tools”