It is currently April 19th, 2024, 2:50 pm

Help in editing a lua script designed by another person - details in post.

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help in editing a lua script designed by another person - details in post.

Post by balala »

Mor3bane wrote: July 20th, 2020, 3:53 am Although, I would like to ask for help to make the modified skin function with days remaining, rather than months and/or years - due to the preference to not have a countdown that would tick over an entire year - month - then day/hour/minute/second. To just be Days+Hours+Minutes+Seconds.
For this you have to modify a little bit the code of the CountDownLua.lua script. Here is what have I done:

Code: Select all

function Initialize()
   tYear   = SKIN:GetVariable('Year')
   tMonth  = SKIN:GetVariable('Month')
   tDay    = SKIN:GetVariable('Day')
   tHour   = SKIN:GetVariable('Hour')
   tMinute = SKIN:GetVariable('Minute')
   tSecond = SKIN:GetVariable('Second')
   numberTime = SKIN:GetVariable('nTime')
   timerTime = SKIN:GetVariable('CurrentTimerTime')  
   counterSetTime = SKIN:GetVariable('CurrentTimerTimeSet') 
   skinClamp = SKIN:GetVariable('SkinClampOn')
   customMessageOn = SKIN:GetVariable('EndMessageOn')
   showYears = SKIN:GetVariable('ShowYears')
   showMonths = SKIN:GetVariable('ShowMonths')
   showDays = SKIN:GetVariable('ShowDays')
   showHours = SKIN:GetVariable('ShowHours')
   showMinutes = SKIN:GetVariable('ShowMinutes')
   showSeconds = SKIN:GetVariable('ShowSeconds')
   showDesktopOnZero = SKIN:GetVariable('ShowDesktopOnZero')
   shutdownOnZero = SKIN:GetVariable('ShutdownOnZero')
   customMessage = SKIN:GetVariable('CustomMessage')
   usePlayer = SKIN:GetVariable('UsePlayer')
   loop = SKIN:GetVariable('Loop')
end

function ShowOrHide()
   return SKIN:GetVariable('HideCountdown')
end

function CountFromDate()
   return SKIN:GetVariable('DateSet')
end

function GetXPos()
	local x = tonumber(SKIN:GetVariable('EndMessageXPos'))
	local w = tonumber(SKIN:GetMeter('GhostEndMessage'):GetW())
	w = w/2
	if x < w then
    return w
	else
	return x
	end
end

function SaveTime(_years, _months, _days, _hours, _minutes, _seconds)
	local yearsec = _years * 365 * 24 * 60 * 60
	local monthsec = _months * (365/12) * 24 * 60 * 60
	local daysec = _days * 24 * 60 * 60
	local hoursec = _hours * 60 * 60
	local minutesec = _minutes * 60
	local totalsec = yearsec + monthsec + daysec + hoursec + minutesec + _seconds
	local totaltime = totalsec + os.time()
	
	SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTime', totaltime, "Options/options.inc")
	SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTimeSet', totalsec, "Options/options.inc")
	timerTime = totaltime
	counterSetTime = totalsec
end

function RoundUpYear(nt)
	local yrs = nt / 60 / 60 / 24 / 30 / 12
	
	if yrs <= 1 and yrs >= 0.6 then
	return 0
	else
	return math.floor(yrs)
	end
end

function GetDays(X)
	if (X > 0) then
		local date = os.date("*t", X)
		date.day = date.day - 1
		return date.day
	else
		return 0
	end
end

function Update()
   local nTime = 0
   local timeTbl = {month=tMonth, day=tDay, year=tYear, hour=tHour, min=tMinute, sec=tSecond}
   local dateset = tonumber(CountFromDate())

    if (dateset == 0) then
		nTime = timerTime - os.time()
	else
		nTime = os.time(timeTbl) - os.time()   
	end
	
   local numbertime = tonumber(numberTime)
   local avgDaysInMonth = 30
   local endmessageon = tonumber(customMessageOn)
   local looping = tonumber(loop)
   
    if nTime < 0 then
		if (dateset == 0) and (looping == 1) then
			timerTime = counterSetTime + os.time()
			nTime = timerTime - os.time()
			SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTime', timerTime, "Options/options.inc")
		else
			if (numbertime == 1) then
				SKIN:Bang('!WriteKeyValue','Variables', 'nTime', '0')
				SKIN:Bang('!SetVariable', 'nTime', '0')
				numberTime = 0
			end
			if (endmessageon == 1) then
				SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Years', 'Text', '')
				SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
				SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')

				SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Months', 'Text', '')
				SKIN:Bang('!HideMeter', 'Months')
				SKIN:Bang('!HideMeter', 'LineMonths')
				SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
				SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')

				SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Days', 'Text', '')
				SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
				SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
				
				SKIN:Bang('!SetOption', 'Hours', 'Text', '')
				SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
				SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
				SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
				
				SKIN:Bang('!SetOption', 'Minutes', 'Text', '')
				SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
				SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
				SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
				
				SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Seconds', 'Text', '')
				SKIN:Bang('!SetOption', 'SecondsLabel', 'Text', '')
				SKIN:Bang('!SetOption', 'SecondsLabelCentered', 'Text', '')
				SKIN:Bang('!SetOption', 'EndMessage', 'Text', customMessage)
				SKIN:Bang('!SetOption', 'EndMessage', 'X', GetXPos())
				return
			else
				nTime = 0
				return
			end
		end
    end
   
   local years = math.floor(nTime / 60 / 60 / 24 / avgDaysInMonth / 12)
   local months = math.floor(nTime / 60 / 60 / 24 / avgDaysInMonth) % 12
   local days = tonumber(GetDays(nTime))
   local hours = math.floor(nTime / 60 / 60) % 24
   local minutes = math.floor(nTime / 60) % 60
   local seconds = math.floor(nTime) % 60
   
   local altminutes = math.floor(nTime / 60)
   local althours = math.floor(nTime / 60 / 60)
   local altdays =  math.floor(nTime / 60 / 60 / 24)
   local altmonths = math.floor(nTime / 60 / 60 / 24 / avgDaysInMonth)
   local altyears = RoundUpYear(nTime)
   
   local hidecountdown = tonumber(ShowOrHide())
   local skinclamp = tonumber(skinClamp)
   local showyears = tonumber(showYears)
   local showmonths = tonumber(showMonths)
   local showdays = tonumber(showDays)
   local showhours = tonumber(showHours)
   local showminutes = tonumber(showMinutes)
   local showseconds = tonumber(showSeconds)
   local showdesktoponzero = tonumber(showDesktopOnZero)
   local shutdownonzero = tonumber(shutdownOnZero)
   local useplayer = tonumber(usePlayer)

 
	if (altmonths <= 0) then
		days = altdays
	end

   if (hidecountdown == 0) then
   
   	if (showyears == 1) then
	
		if (showmonths == 0 and showdays == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
		
			SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
		
		else
		
			if (years < 10) then
			SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
			end
			
		end
	
		if (altyears <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Years')
		SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
		SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Years')
		
			if (showmonths == 0 and showdays == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
		
			SKIN:Bang('!SetOption', 'Years', 'Text', altyears..'')
		
			else
			
			SKIN:Bang('!SetOption', 'Years', 'Text', years..'')
				
			end
		
			if (showmonths == 1 or showdays == 1 or showhours == 1 or showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'YearsDash', 'Text', '/')
			SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '0')
			else
			SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
			end
			
		end
		
	else
	SKIN:Bang('!HideMeter', 'Years')
	SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')
	end
	
	if (showmonths == 1) then

		if (altmonths <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
		SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Months')
		
			if (showdays == 1 or showhours == 1 or showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '')
			SKIN:Bang('!SetOption', 'MonthsDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
			end
			
			if (showyears == 0 and showdays == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			end
			
		end
				
		if (showyears == 0) then
		SKIN:Bang('!SetOption', 'Months', 'Text', altmonths..'')
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		
			if (altmonths < 10) then
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			end
		
		else
		SKIN:Bang('!SetOption', 'Months', 'Text', months..'')
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		
			if (months < 10) then
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			end
		
		end
			
	else
	SKIN:Bang('!HideMeter', 'Months')
	SKIN:Bang('!HideMeter', 'LineMonths')
	SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')
	end
	
	
	if (showdays == 1) then

		if (altdays <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Days')
		SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
		SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Days')
		
			if (showhours == 1 or showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '0')
			SKIN:Bang('!SetOption', 'DaysDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
			end
			
			if (showyears == 0 and showmonths == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			end
			
		end

		if (showyears == 0 and showmonths == 0) then
		SKIN:Bang('!SetOption', 'Days', 'Text', altdays..'')
		
			if (altdays < 10) then
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			end
		
		else
		SKIN:Bang('!SetOption', 'Days', 'Text', altdays..'')
		
			if (days < 10) then
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			end
		
		end
			
	else
	SKIN:Bang('!HideMeter', 'Days')
	SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
	SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
	end

		
	if (showhours == 1) then

		if (althours <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Hours')
		SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
		SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Hours')
		
			if (showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '0')
			SKIN:Bang('!SetOption', 'HoursDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
			end
			
			if (showyears == 0 and showmonths == 0 and showdays == 0 and showminutes == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
			end
			
		end
		
		if (showyears == 0 and showmonths == 0 and showdays == 0) then
		SKIN:Bang('!SetOption', 'Hours', 'Text', althours..'')
		
			if (althours < 10) then
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
			end
			
		else
		SKIN:Bang('!SetOption', 'Hours', 'Text', hours..'')
		
			if (hours < 10) then
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
			end
			
		end
			
	else
	SKIN:Bang('!HideMeter', 'Hours')
	SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
	SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
	end

			
	if (showminutes == 1) then

		if (altminutes <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Minutes')
		SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
		SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Minutes')
		
			if (showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '0')
			SKIN:Bang('!SetOption', 'MinutesDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
			end
			
			if (showyears == 0 and showmonths == 0 and showdays == 0 and showhours == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
			end
			
		end
		
		if (showyears == 0 and showmonths == 0 and showdays == 0 and showhours == 0) then
		SKIN:Bang('!SetOption', 'Minutes', 'Text', altminutes..'')
		
			if (altminutes < 10) then
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
			end
		
		else
		SKIN:Bang('!SetOption', 'Minutes', 'Text', minutes..'')
		
			if (minutes < 10) then
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
			end
		
		end
			
	else
	SKIN:Bang('!HideMeter', 'Minutes')
	SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
	end

				
	if (showseconds == 1) then

		SKIN:Bang('!ShowMeter', 'Seconds')
		
		if (showyears == 0 and showmonths == 0 and showdays == 0 and showhours == 0 and showminutes == 0) then
		SKIN:Bang('!SetOption', 'Seconds', 'Text', nTime..'')
		SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '')
		SKIN:Bang('!ShowMeter', 'SecondsLabelCentered')
		SKIN:Bang('!HideMeter', 'SecondsLabel')
		else
		SKIN:Bang('!SetOption', 'Seconds', 'Text', seconds..'')
		SKIN:Bang('!HideMeter', 'SecondsLabelCentered')
		SKIN:Bang('!ShowMeter', 'SecondsLabel')
		
			if (seconds < 10) then
			SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '')
			end
			
		end
			
	else
	SKIN:Bang('!HideMeter', 'Seconds')
	SKIN:Bang('!SetOption', 'SecondsLabel', 'Text', '')
	SKIN:Bang('!SetOption', 'SecondsLabelCentered', 'Text', '')
	end
	
   else
		SKIN:Bang('!HideMeter', 'Years')
		SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Days')
		SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
	SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Hours')
		SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
	SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Minutes')
		SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Seconds')
	SKIN:Bang('!SetOption', 'SecondsLabel', 'Text', '')
	SKIN:Bang('!SetOption', 'SecondsLabelCentered', 'Text', '')
    end
		
	if (years <= 0) and (months <= 0) and (days <= 0) and (hours <= 0) and (minutes <= 0)  then
	
		if (seconds == 10) or (seconds == 8) or (seconds == 6) or (seconds == 4) or (seconds == 2) then
		SKIN:Bang('[Play "#L10SSound#"]')
		end	
		
		if (nTime <= 0) and (numbertime == 1) then

			if (dateset == 0) and (looping == 1) then
				timerTime = 1 + counterSetTime + os.time()
				SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTime', timerTime, "Options/options.inc")
			else
				SKIN:Bang('!WriteKeyValue','Variables', 'nTime', '0')
				SKIN:Bang('!SetVariable', 'nTime', '0')
				numberTime = 0
			end
			
			SKIN:Bang('[Play "#TZeroSound#"]')
			SKIN:Bang('"#URLinput#"')
			
			if (showdesktoponzero == 1) then
				SKIN:Bang('[Shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}]')
			end
			
			if (shutdownonzero == 1) then
				SKIN:Bang('[shutdown.exe /s /c "Countdown has reached zero. The computer is shutting down!"]')
			end
			
			if (useplayer == 1) then
				SKIN:Bang('"#Player#" #ExecFile#')
			else
				SKIN:Bang('"#ExecFile#"')
			end

		end
	end	
end -- function Update
Later we definitely will have to modify a little bit the code of the skin itself as well, but for now please just check how does it work.
Mor3bane wrote: July 20th, 2020, 3:53 am An interesting alternative to have not only one choice, but to have both selected from my modified date-set - "Months or Days" for example.
To be honest I didn't understand this. Please give me a few details more.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Help in editing a lua script designed by another person - details in post.

Post by Mor3bane »

balala wrote: July 20th, 2020, 7:50 pm For this you have to modify a little bit the code of the CountDownLua.lua script. Here is what have I done:

Code: Select all

function Initialize()
   tYear   = SKIN:GetVariable('Year')
   tMonth  = SKIN:GetVariable('Month')
   tDay    = SKIN:GetVariable('Day')
   tHour   = SKIN:GetVariable('Hour')
   tMinute = SKIN:GetVariable('Minute')
   tSecond = SKIN:GetVariable('Second')
   numberTime = SKIN:GetVariable('nTime')
   timerTime = SKIN:GetVariable('CurrentTimerTime')  
   counterSetTime = SKIN:GetVariable('CurrentTimerTimeSet') 
   skinClamp = SKIN:GetVariable('SkinClampOn')
   customMessageOn = SKIN:GetVariable('EndMessageOn')
   showYears = SKIN:GetVariable('ShowYears')
   showMonths = SKIN:GetVariable('ShowMonths')
   showDays = SKIN:GetVariable('ShowDays')
   showHours = SKIN:GetVariable('ShowHours')
   showMinutes = SKIN:GetVariable('ShowMinutes')
   showSeconds = SKIN:GetVariable('ShowSeconds')
   showDesktopOnZero = SKIN:GetVariable('ShowDesktopOnZero')
   shutdownOnZero = SKIN:GetVariable('ShutdownOnZero')
   customMessage = SKIN:GetVariable('CustomMessage')
   usePlayer = SKIN:GetVariable('UsePlayer')
   loop = SKIN:GetVariable('Loop')
end

function ShowOrHide()
   return SKIN:GetVariable('HideCountdown')
end

function CountFromDate()
   return SKIN:GetVariable('DateSet')
end

function GetXPos()
	local x = tonumber(SKIN:GetVariable('EndMessageXPos'))
	local w = tonumber(SKIN:GetMeter('GhostEndMessage'):GetW())
	w = w/2
	if x < w then
    return w
	else
	return x
	end
end

function SaveTime(_years, _months, _days, _hours, _minutes, _seconds)
	local yearsec = _years * 365 * 24 * 60 * 60
	local monthsec = _months * (365/12) * 24 * 60 * 60
	local daysec = _days * 24 * 60 * 60
	local hoursec = _hours * 60 * 60
	local minutesec = _minutes * 60
	local totalsec = yearsec + monthsec + daysec + hoursec + minutesec + _seconds
	local totaltime = totalsec + os.time()
	
	SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTime', totaltime, "Options/options.inc")
	SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTimeSet', totalsec, "Options/options.inc")
	timerTime = totaltime
	counterSetTime = totalsec
end

function RoundUpYear(nt)
	local yrs = nt / 60 / 60 / 24 / 30 / 12
	
	if yrs <= 1 and yrs >= 0.6 then
	return 0
	else
	return math.floor(yrs)
	end
end

function GetDays(X)
	if (X > 0) then
		local date = os.date("*t", X)
		date.day = date.day - 1
		return date.day
	else
		return 0
	end
end

function Update()
   local nTime = 0
   local timeTbl = {month=tMonth, day=tDay, year=tYear, hour=tHour, min=tMinute, sec=tSecond}
   local dateset = tonumber(CountFromDate())

    if (dateset == 0) then
		nTime = timerTime - os.time()
	else
		nTime = os.time(timeTbl) - os.time()   
	end
	
   local numbertime = tonumber(numberTime)
   local avgDaysInMonth = 30
   local endmessageon = tonumber(customMessageOn)
   local looping = tonumber(loop)
   
    if nTime < 0 then
		if (dateset == 0) and (looping == 1) then
			timerTime = counterSetTime + os.time()
			nTime = timerTime - os.time()
			SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTime', timerTime, "Options/options.inc")
		else
			if (numbertime == 1) then
				SKIN:Bang('!WriteKeyValue','Variables', 'nTime', '0')
				SKIN:Bang('!SetVariable', 'nTime', '0')
				numberTime = 0
			end
			if (endmessageon == 1) then
				SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Years', 'Text', '')
				SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
				SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')

				SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Months', 'Text', '')
				SKIN:Bang('!HideMeter', 'Months')
				SKIN:Bang('!HideMeter', 'LineMonths')
				SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
				SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')

				SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Days', 'Text', '')
				SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
				SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
				
				SKIN:Bang('!SetOption', 'Hours', 'Text', '')
				SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
				SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
				SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
				
				SKIN:Bang('!SetOption', 'Minutes', 'Text', '')
				SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
				SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
				SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
				SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
				
				SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '')
				SKIN:Bang('!SetOption', 'Seconds', 'Text', '')
				SKIN:Bang('!SetOption', 'SecondsLabel', 'Text', '')
				SKIN:Bang('!SetOption', 'SecondsLabelCentered', 'Text', '')
				SKIN:Bang('!SetOption', 'EndMessage', 'Text', customMessage)
				SKIN:Bang('!SetOption', 'EndMessage', 'X', GetXPos())
				return
			else
				nTime = 0
				return
			end
		end
    end
   
   local years = math.floor(nTime / 60 / 60 / 24 / avgDaysInMonth / 12)
   local months = math.floor(nTime / 60 / 60 / 24 / avgDaysInMonth) % 12
   local days = tonumber(GetDays(nTime))
   local hours = math.floor(nTime / 60 / 60) % 24
   local minutes = math.floor(nTime / 60) % 60
   local seconds = math.floor(nTime) % 60
   
   local altminutes = math.floor(nTime / 60)
   local althours = math.floor(nTime / 60 / 60)
   local altdays =  math.floor(nTime / 60 / 60 / 24)
   local altmonths = math.floor(nTime / 60 / 60 / 24 / avgDaysInMonth)
   local altyears = RoundUpYear(nTime)
   
   local hidecountdown = tonumber(ShowOrHide())
   local skinclamp = tonumber(skinClamp)
   local showyears = tonumber(showYears)
   local showmonths = tonumber(showMonths)
   local showdays = tonumber(showDays)
   local showhours = tonumber(showHours)
   local showminutes = tonumber(showMinutes)
   local showseconds = tonumber(showSeconds)
   local showdesktoponzero = tonumber(showDesktopOnZero)
   local shutdownonzero = tonumber(shutdownOnZero)
   local useplayer = tonumber(usePlayer)

 
	if (altmonths <= 0) then
		days = altdays
	end

   if (hidecountdown == 0) then
   
   	if (showyears == 1) then
	
		if (showmonths == 0 and showdays == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
		
			SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
		
		else
		
			if (years < 10) then
			SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Years', 'Prefix', '')
			end
			
		end
	
		if (altyears <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Years')
		SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
		SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Years')
		
			if (showmonths == 0 and showdays == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
		
			SKIN:Bang('!SetOption', 'Years', 'Text', altyears..'')
		
			else
			
			SKIN:Bang('!SetOption', 'Years', 'Text', years..'')
				
			end
		
			if (showmonths == 1 or showdays == 1 or showhours == 1 or showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'YearsDash', 'Text', '/')
			SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '0')
			else
			SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
			end
			
		end
		
	else
	SKIN:Bang('!HideMeter', 'Years')
	SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')
	end
	
	if (showmonths == 1) then

		if (altmonths <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
		SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Months')
		
			if (showdays == 1 or showhours == 1 or showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '')
			SKIN:Bang('!SetOption', 'MonthsDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
			end
			
			if (showyears == 0 and showdays == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			end
			
		end
				
		if (showyears == 0) then
		SKIN:Bang('!SetOption', 'Months', 'Text', altmonths..'')
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		
			if (altmonths < 10) then
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			end
		
		else
		SKIN:Bang('!SetOption', 'Months', 'Text', months..'')
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		
			if (months < 10) then
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Months', 'Prefix', '')
			end
		
		end
			
	else
	SKIN:Bang('!HideMeter', 'Months')
	SKIN:Bang('!HideMeter', 'LineMonths')
	SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')
	end
	
	
	if (showdays == 1) then

		if (altdays <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Days')
		SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
		SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Days')
		
			if (showhours == 1 or showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '0')
			SKIN:Bang('!SetOption', 'DaysDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
			end
			
			if (showyears == 0 and showmonths == 0 and showhours == 0 and showminutes == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			end
			
		end

		if (showyears == 0 and showmonths == 0) then
		SKIN:Bang('!SetOption', 'Days', 'Text', altdays..'')
		
			if (altdays < 10) then
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			end
		
		else
		SKIN:Bang('!SetOption', 'Days', 'Text', altdays..'')
		
			if (days < 10) then
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			else
			SKIN:Bang('!SetOption', 'Days', 'Prefix', '')
			end
		
		end
			
	else
	SKIN:Bang('!HideMeter', 'Days')
	SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
	SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
	end

		
	if (showhours == 1) then

		if (althours <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Hours')
		SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
		SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Hours')
		
			if (showminutes == 1 or showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '0')
			SKIN:Bang('!SetOption', 'HoursDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
			end
			
			if (showyears == 0 and showmonths == 0 and showdays == 0 and showminutes == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
			end
			
		end
		
		if (showyears == 0 and showmonths == 0 and showdays == 0) then
		SKIN:Bang('!SetOption', 'Hours', 'Text', althours..'')
		
			if (althours < 10) then
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
			end
			
		else
		SKIN:Bang('!SetOption', 'Hours', 'Text', hours..'')
		
			if (hours < 10) then
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Hours', 'Prefix', '')
			end
			
		end
			
	else
	SKIN:Bang('!HideMeter', 'Hours')
	SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
	SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
	end

			
	if (showminutes == 1) then

		if (altminutes <= 0 and skinclamp == 1) then
		SKIN:Bang('!HideMeter', 'Minutes')
		SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
		SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
		SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
		else
		SKIN:Bang('!ShowMeter', 'Minutes')
		
			if (showseconds == 1) then
			SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '0')
			SKIN:Bang('!SetOption', 'MinutesDash', 'Text', ':')
			else
			SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
			SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
			end
			
			if (showyears == 0 and showmonths == 0 and showdays == 0 and showhours == 0 and showseconds == 0) then
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
			end
			
		end
		
		if (showyears == 0 and showmonths == 0 and showdays == 0 and showhours == 0) then
		SKIN:Bang('!SetOption', 'Minutes', 'Text', altminutes..'')
		
			if (altminutes < 10) then
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
			end
		
		else
		SKIN:Bang('!SetOption', 'Minutes', 'Text', minutes..'')
		
			if (minutes < 10) then
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Minutes', 'Prefix', '')
			end
		
		end
			
	else
	SKIN:Bang('!HideMeter', 'Minutes')
	SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
	end

				
	if (showseconds == 1) then

		SKIN:Bang('!ShowMeter', 'Seconds')
		
		if (showyears == 0 and showmonths == 0 and showdays == 0 and showhours == 0 and showminutes == 0) then
		SKIN:Bang('!SetOption', 'Seconds', 'Text', nTime..'')
		SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '')
		SKIN:Bang('!ShowMeter', 'SecondsLabelCentered')
		SKIN:Bang('!HideMeter', 'SecondsLabel')
		else
		SKIN:Bang('!SetOption', 'Seconds', 'Text', seconds..'')
		SKIN:Bang('!HideMeter', 'SecondsLabelCentered')
		SKIN:Bang('!ShowMeter', 'SecondsLabel')
		
			if (seconds < 10) then
			SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '0')
			else
			SKIN:Bang('!SetOption', 'Seconds', 'Prefix', '')
			end
			
		end
			
	else
	SKIN:Bang('!HideMeter', 'Seconds')
	SKIN:Bang('!SetOption', 'SecondsLabel', 'Text', '')
	SKIN:Bang('!SetOption', 'SecondsLabelCentered', 'Text', '')
	end
	
   else
		SKIN:Bang('!HideMeter', 'Years')
		SKIN:Bang('!SetOption', 'LineYears', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'YearsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'YearsLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Months')
		SKIN:Bang('!HideMeter', 'LineMonths')
		SKIN:Bang('!SetOption', 'LineMonths', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MonthsDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MonthsLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Days')
		SKIN:Bang('!SetOption', 'LineDays', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'DaysDash', 'Text', '')
	SKIN:Bang('!SetOption', 'DaysLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Hours')
		SKIN:Bang('!SetOption', 'LineHours', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'HoursDash', 'Text', '')
	SKIN:Bang('!SetOption', 'HoursLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Minutes')
		SKIN:Bang('!SetOption', 'LineMinutes', 'Hidden', '1')
	SKIN:Bang('!SetOption', 'MinutesDash', 'Text', '')
	SKIN:Bang('!SetOption', 'MinutesLabel', 'Text', '')
		SKIN:Bang('!HideMeter', 'Seconds')
	SKIN:Bang('!SetOption', 'SecondsLabel', 'Text', '')
	SKIN:Bang('!SetOption', 'SecondsLabelCentered', 'Text', '')
    end
		
	if (years <= 0) and (months <= 0) and (days <= 0) and (hours <= 0) and (minutes <= 0)  then
	
		if (seconds == 10) or (seconds == 8) or (seconds == 6) or (seconds == 4) or (seconds == 2) then
		SKIN:Bang('[Play "#L10SSound#"]')
		end	
		
		if (nTime <= 0) and (numbertime == 1) then

			if (dateset == 0) and (looping == 1) then
				timerTime = 1 + counterSetTime + os.time()
				SKIN:Bang('!WriteKeyValue','Variables', 'CurrentTimerTime', timerTime, "Options/options.inc")
			else
				SKIN:Bang('!WriteKeyValue','Variables', 'nTime', '0')
				SKIN:Bang('!SetVariable', 'nTime', '0')
				numberTime = 0
			end
			
			SKIN:Bang('[Play "#TZeroSound#"]')
			SKIN:Bang('"#URLinput#"')
			
			if (showdesktoponzero == 1) then
				SKIN:Bang('[Shell:::{3080F90D-D7AD-11D9-BD98-0000947B0257}]')
			end
			
			if (shutdownonzero == 1) then
				SKIN:Bang('[shutdown.exe /s /c "Countdown has reached zero. The computer is shutting down!"]')
			end
			
			if (useplayer == 1) then
				SKIN:Bang('"#Player#" #ExecFile#')
			else
				SKIN:Bang('"#ExecFile#"')
			end

		end
	end	
end -- function Update
Later we definitely will have to modify a little bit the code of the skin itself as well, but for now please just check how does it work.

To be honest I didn't understand this. Please give me a few details more.
balala, would you mind highlighting the lines or parts you changed, please? I would really like to see what the differences are.

So, in the pop-up window where the counter is set from (i modified that a bit from original) it would be pretty cool to have a choice to select if months or only days are being desired in the out put. (That is what I meant - so I hope this makes more sense).
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help in editing a lua script designed by another person - details in post.

Post by balala »

Mor3bane wrote: July 20th, 2020, 10:57 pm balala, would you mind highlighting the lines or parts you changed, please? I would really like to see what the differences are.
  • Added lines 116 and 117: SKIN:Bang('!HideMeter', 'Months') and SKIN:Bang('!HideMeter', 'LineMonths')
  • Added line 241: SKIN:Bang('!HideMeter', 'LineMonths')
  • Added lines 264 and 265: SKIN:Bang('!HideMeter', 'Months') and SKIN:Bang('!HideMeter', 'LineMonths')
  • Added lines 275 and 276: SKIN:Bang('!HideMeter', 'Months') and SKIN:Bang('!HideMeter', 'LineMonths')
  • Added line 288: SKIN:Bang('!HideMeter', 'LineMonths')
  • Updated line 320 from SKIN:Bang('!SetOption', 'Days', 'Text', days..'') to SKIN:Bang('!SetOption', 'Days', 'Text', altdays..'')
  • Added line 485: SKIN:Bang('!HideMeter', 'LineMonths')
Mor3bane wrote: July 20th, 2020, 10:57 pm So, in the pop-up window where the counter is set from (i modified that a bit from original) it would be pretty cool to have a choice to select if months or only days are being desired in the out put. (That is what I meant - so I hope this makes more sense).
Sorry, didn't even realized until now there is such a window. Now I see.
This gonna be a next step. First please test the above modifications of the CountDownLua.lua script file.
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Help in editing a lua script designed by another person - details in post.

Post by Mor3bane »

That looks great.

Thanks.

I really, really need to practice my lua learning.

I look forward to future implementation of modification.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help in editing a lua script designed by another person - details in post.

Post by balala »

Mor3bane wrote: July 21st, 2020, 5:43 am I look forward to future implementation of modification.
Later today I'm gonna work a little bit more on your skin.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help in editing a lua script designed by another person - details in post.

Post by balala »

For a try I (manually) entered a previous date than the current one. The skin disappeared. No refresh or reload helps. How do I bring it back (just not to search it over the whole code)?
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Help in editing a lua script designed by another person - details in post.

Post by Mor3bane »

If there is an area of [where] the skin [should] be that allows a hand mouse pointer then just click and set the new date through the GUI.

To set the date with the GUI the date and time have to be followed with the enter key, before selecting [start].

I too have been working on the skin and increased the click area to encompass the scrollie graphics. If it might help I have attached your previously modified lua, and my ini here.
Scroll Timer_1.2.1.xx.rmskin
You may have noticed that editing the skin files is problematic, when it is running. I have not developed a way to suspend the 1000 ms update to allow editing the skin live - to try and do so 30% of the time results in a skin-breaking error/typo/incorrect edit outcome. I have not tried since unloading the skin seems easy enough...
You do not have the required permissions to view the files attached to this post.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help in editing a lua script designed by another person - details in post.

Post by balala »

Mor3bane wrote: July 22nd, 2020, 10:53 pm If there is an area of [where] the skin [should] be that allows a hand mouse pointer then just click and set the new date through the GUI.

To set the date with the GUI the date and time have to be followed with the enter key, before selecting [start].
Now I'm not sure: is there anything else you'd like help with?
Mor3bane wrote: July 22nd, 2020, 10:53 pm You may have noticed that editing the skin files is problematic, when it is running. I have not developed a way to suspend the 1000 ms update to allow editing the skin live - to try and do so 30% of the time results in a skin-breaking error/typo/incorrect edit outcome. I have not tried since unloading the skin seems easy enough...
No, I didn't. Both the skin and the attached countDownLua.lua are perfectly editable for me. They can be edited, saved. Not sure what you mean by "problematic".
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Help in editing a lua script designed by another person - details in post.

Post by Mor3bane »

balala wrote: July 23rd, 2020, 6:10 pm Now I'm not sure: is there anything else you'd like help with?
The counter being days rather than months seems decent to my tastes. So, not really. Further modifications are not really necessary, only for experimental reasons, I will tinker with this skin since its singular purpose should be a good example for learning a bit of lua (I hope).
balala wrote: July 23rd, 2020, 6:10 pm No, I didn't. Both the skin and the attached countDownLua.lua are perfectly editable for me. They can be edited, saved. Not sure what you mean by "problematic".
The main ini updates live with the !WriteKeyValue Bangs it uses. I found this to cause issues during editing with Sublime Text. I don't know what editor you use but perhaps therein lies the issue. In any case, I think I can manage with future modifications. If not I will ask again, likely for a different reason/s.
Cheers.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help in editing a lua script designed by another person - details in post.

Post by balala »

Mor3bane wrote: July 25th, 2020, 2:03 pm The main ini updates live with the !WriteKeyValue Bangs it uses. I found this to cause issues during editing with Sublime Text. I don't know what editor you use but perhaps therein lies the issue. In any case, I think I can manage with future modifications. If not I will ask again, likely for a different reason/s.
I'm using Notepad++ and as said I can edit it with no problems. If a !WriteKeyValue bang writes anything, Notepad++ ask me if I want to reload the file, but otherwise it is editable.