Welcome, Guest
Please Login or Register.    Lost Password?

Moon phase?
(1 viewing) (1) Guest
Go to bottomPage: 123
TOPIC: Moon phase?
#21043
Re: Sun-Moon 5 Months ago  
Jorge_Luis wrote:
Copy the attached lua file to ~/.config/.rainlendar2/scripts/ and refresh Rainlendar. This is a standalone (and cut) version with sunrise and sunset only.
The file will create the alarm without the need for a window.
Well done! In the meanwhile I did a shorter version reusing globals functions.
The idea behind the script was to show the sunrise/sunset for the specified date, and not only the current date, that's why time1 changes everything.
At the end I will need it for all visible days. But, for now today is OK.
To avoid further problem, all the variables should be locals... but I leave that for you
Done And functions too!
I think that when 2 functions have the same name, the last win...
Noted the hard way:
Code:

-- Last definition always win if functions names collides:
-- First: Global folder for scripts: /usr/lib/rainlendar2/scripts/
-- Second: User folder for scripts: ~/.config/.rainlendar2/scripts/
-- Last: ~/.config/.rainlendar2/skins/Shadow4.r2skin/scripts/

With the added pitfall of required globals still not defined, but will go off when this be an addon.
File Attachment:
File Name: sun_moon_alarm.lua
File Size: 5082
Nilfred
Junior Boarder
Posts: 23
graphgraph
User Offline Click here to see the profile of this user
Gender: Male Location: Argentina
The administrator has disabled public write access.
 
#21044
Re: Sun-Moon 5 Months ago  
If you need the addon for the script to work, then is better to modify the addon.
Mixing the standalone file with the addon, both could happen at the same time. In this way, with only have the addon installed the events are created, (without any window selected).

The only problem I have is that if you dismiss the alarm, the events disappears (for that day? for always?). The only way to show them again is edit the alarms.ini file.

File Attachment:
File Name: sun_moon_riseset.lua
File Size: 26718


EDIT: I duplicate the code to create the event in a function at bottom, called by the last line of the script.
EDIT 2: A workaround could be set the ID as "Sunset-for-%04d%02d%02d"
Jorge_Luis
Platinum Boarder
Posts: 795
graphgraph
User Offline Click here to see the profile of this user
Gender: Male My Rainlendar Skins Location: Argentina Birthday: 03/15
Last Edit: 2014/04/23 22:02 By Jorge_Luis.
The administrator has disabled public write access.
 
Go to topPage: 123
get the latest posts directly to your desktop