It is currently April 27th, 2024, 8:53 pm

[Resolved] LuaCalendar Repeat="Month" Help

Get help with creating, editing & fixing problems with skins
whyhellojo
Posts: 2
Joined: January 22nd, 2022, 9:24 am

[Resolved] LuaCalendar Repeat="Month" Help

Post by whyhellojo »

Hello!
I could be missing something but I can't get Repeat="Month" to work. I've tried different alterations where I remove the year and month but the outcome's always the same. I don't know what I'm doing wrong.

Code: Select all

 <Event Repeat="Month" Month="1" Day="8" Year="2022" color="230, 48, 115">Monthly Meeting</Event> 
Screenshot 2022-01-22 17_20_39.png

I tried this but the days shift since there aren't always 30 days in a month. I need it to be on the 8th of every month.

Code: Select all

<Event Repeat="Custom" Multiplier="86400*30" Month="1" Day="8" Year="2022" color="230, 48, 115">Monthly Meeting</Event>
I did my best to find to something discussing this but I haven't had any luck >:
Help would be greatly appreciated. I've been at this for a while now and I'm absolutely deflated T^T
Does anyone know of a work around?



---------------------------------------------------------------[ EDIT ]---------------------------------------------------------------


If ever you have this problem, edit CScript.lua and find this bulk of code:

Code: Select all

elseif event.erepeat == 'month' then
			if not event.day then
				Error.Create('Day must be specified in %s when using Month repeat.', event.description)
			elseif not tstamp(event.day, event.month, event.year) <= event.finish then
				-- Do Nothing
			elseif not event.month and event.year then
				AddEvent(event.day)
			elseif Time.show.year >= event.year then
				local ydiff = Time.show.year - event.year - 1
				local mdiff
				if ydiff == -1 then
					mdiff = Time.show.month - event.month
				else
					mdiff = (12 - event.month) + Time.show.month + ydiff * 12
				end
				
				if (mdiff % event.multip) == 0 and Time.stats.cmonth >= tstamp(1, event.month, event.year) then
					AddEvent(event.day, mdiff / event.multip + 1)
				end
			end
Replace it with this:

Code: Select all

		elseif event.erepeat == 'month' then
				local Results = TestRequirements{
				{event.day, 'Day must be specified in %s when using Month repeat.', event.description},
			}
			if Results then
				if tstamp(event.day, event.month, Time.show.year) <= event.finish then
					AddEvent(event.day)	
				end
			end	
It helped me get Repeat="Month" to work. I don't know if you need to edit CScriptW.lua but I didn't need to.

The Finish and Skip event options still work with the edit but they have to be in the DD/MM/YYYY format.
Ex. Skipping on Sep 8, 2022 and Apr 8, 2022 + finishing on Dec 8, 2022: Skip="8/9/2022|8/4/2022" Finish="8/12/2022"

If you catch anything wrong with it, please let me know but this does what I need it to so far.
I hope it helps someone else! C: Until it gets officially patched at least!
You do not have the required permissions to view the files attached to this post.
Last edited by whyhellojo on January 22nd, 2022, 6:11 pm, edited 1 time in total.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: LuaCalendar Repeat="Month" Help

Post by eclectic-tech »

whyhellojo wrote: January 22nd, 2022, 9:52 am Hello!
I could be missing something but I can't get Repeat="Month" to work. I've tried different alterations where I remove the year and month but the outcome's always the same. I don't know what I'm doing wrong.

Code: Select all

 <Event Repeat="Month" Month="1" Day="8" Year="2022" color="230, 48, 115">Monthly Meeting</Event> 
I tried this but the days shift since there aren't always 30 days in a month. I need it to be on the 8th of every month.

Code: Select all

<Event Repeat="Custom" Multiplier="86400*30" Month="1" Day="8" Year="2022" color="230, 48, 115">Monthly Meeting</Event>
I did my best to find to something discussing this but I haven't had any luck >:
Help would be greatly appreciated. I've been at this for a while now and I'm absolutely deflated T^T
Does anyone know of a work around?
This works for me: <Event Day="8" Month="{$MName}">Monthly Meeting</Event>

This line was added just before <Set Month="1"> in the code.

I agree that your attempts should have worked, but I noticed they created an error message in the log about 'Attempting to compare a Boolean value to a number', so I used the variable {$MName} as the 'Month' value.

EDITS:
There seems to be an issue when using Repeat="Month" that may need to be investigated by the author, or someone more familiar with using the Lua calendar.

I think you would want to use a built-in variable for the day also, since the '8th' will not be the same every month; Day="{$FirstTue}"
whyhellojo
Posts: 2
Joined: January 22nd, 2022, 9:24 am

Re: LuaCalendar Repeat="Month" Help

Post by whyhellojo »

eclectic-tech wrote: January 22nd, 2022, 1:48 pm This works for me: <Event Day="8" Month="{$MName}">Monthly Meeting</Event>

This line was added just before <Set Month="1"> in the code.

I agree that your attempts should have worked, but I noticed they created an error message in the log about 'Attempting to compare a Boolean value to a number', so I used the variable {$MName} as the 'Month' value.

EDITS:
There seems to be an issue when using Repeat="Month" that may need to be investigated by the author, or someone more familiar with using the Lua calendar.

I think you would want to use a built-in variable for the day also, since the '8th' will not be the same every month; Day="{$FirstTue}"
Ahhhhh! I looked into the built-in variables but I ran into the problem of the days not always falling on the day I want it to.
Your response prompted me to check the script and I was able to figure out a fix, I think! I'll edit it in.
Thank you for the reply! It was very much appreciated!
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5407
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: LuaCalendar Repeat="Month" Help

Post by eclectic-tech »

You are welcome... I learned a bit more myself! :D
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: [Resolved] LuaCalendar Repeat="Month" Help

Post by CodeCode »

whyhellojo wrote: January 22nd, 2022, 9:52 am ---------------------------------------------------------------[ EDIT ]---------------------------------------------------------------

If ever you have this problem, edit CScript.lua and find this bulk of code:

Code: Select all

elseif event.erepeat == 'month' then
			if not event.day then
				Error.Create('Day must be specified in %s when using Month repeat.', event.description)
			elseif not tstamp(event.day, event.month, event.year) <= event.finish then
				-- Do Nothing
			elseif not event.month and event.year then
				AddEvent(event.day)
			elseif Time.show.year >= event.year then
				local ydiff = Time.show.year - event.year - 1
				local mdiff
				if ydiff == -1 then
					mdiff = Time.show.month - event.month
				else
					mdiff = (12 - event.month) + Time.show.month + ydiff * 12
				end
				
				if (mdiff % event.multip) == 0 and Time.stats.cmonth >= tstamp(1, event.month, event.year) then
					AddEvent(event.day, mdiff / event.multip + 1)
				end
			end
Replace it with this:

Code: Select all

		elseif event.erepeat == 'month' then
				local Results = TestRequirements{
				{event.day, 'Day must be specified in %s when using Month repeat.', event.description},
			}
			if Results then
				if tstamp(event.day, event.month, Time.show.year) <= event.finish then
					AddEvent(event.day)	
				end
			end	
It helped me get Repeat="Month" to work. I don't know if you need to edit CScriptW.lua but I didn't need to.

The Finish and Skip event options still work with the edit but they have to be in the DD/MM/YYYY format.
Ex. Skipping on Sep 8, 2022 and Apr 8, 2022 + finishing on Dec 8, 2022: Skip="8/9/2022|8/4/2022" Finish="8/12/2022"

If you catch anything wrong with it, please let me know but this does what I need it to so far.
I hope it helps someone else! C: Until it gets officially patched at least!
This turned out to be very useful. With no obvious defects. :great:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: [Resolved] LuaCalendar Repeat="Month" Help

Post by CodeCode »

CodeCode wrote: November 20th, 2023, 6:27 am This turned out to be very useful. With no obvious defects. :great:
Erm, I get a "XXX" month string error, everything seems to work but this Formula: "NOV" is unknown: (NOV) (Utopia Task Organiser\UtopiaCode Tasks.ini) error shows up for any month dialed into .

CC
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.
User avatar
CodeCode
Posts: 1366
Joined: September 7th, 2020, 2:24 pm
Location: QLD, Australia

Re: [Resolved] LuaCalendar Repeat="Month" Help

Post by CodeCode »

CodeCode wrote: November 20th, 2023, 6:54 am Erm, I get a "XXX" month string error, everything seems to work but this Formula: "NOV" is unknown: (NOV) (Utopia Task Organiser\UtopiaCode Tasks.ini) error shows up for any month dialed into .

CC
The Calendar works well enough, just not a fan of totally ignored errors. :thumbdown:
ƈǟռ'ȶ ʄɨӼ ɨȶ ɨʄ ɨȶ ǟɨռ'ȶ ɮʀօӄɛ - ʊռʟɛֆֆ ɨȶ ɨֆ ɨռ ƈօɖɛ.