It is currently September 23rd, 2020, 12:48 pm

Speaking TextClock6 with Weather

Post your work-in-progress and completed skins to share and discuss.
Vivraan
Posts: 3
Joined: August 28th, 2020, 4:57 pm

Re: Speaking TextClock6 with Weather

Post by Vivraan »

This is a cosmetic suggestion, wholly subjective, but twenty-eight degrees Celsius isn't sort of hot for me where I live - it's actually pretty comfortable.

It might be useful to have an option to drop that qualifier or an interactive setting that determines the average temperatures of a reason to normalise qualifiers.
User avatar
jsmorley
Developer
Posts: 21386
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Speaking TextClock6 with Weather

Post by jsmorley »

Vivraan wrote: August 28th, 2020, 5:01 pm This is a cosmetic suggestion, wholly subjective, but twenty-eight degrees Celsius isn't sort of hot for me where I live - it's actually pretty comfortable.

It might be useful to have an option to drop that qualifier or an interactive setting that determines the average temperatures of a reason to normalise qualifiers.
Those can be changed by editing TextClock6.lua and changing the text in this function:

Code: Select all

function TemperatureString()

	tempUnit = measureUnits:GetStringValue()
	tempValue = tonumber(measureTemperature:GetStringValue())
	if not tempValue then
		SKIN:Bang('!SetOption', 'MeterTemperature', 'Text', '')
		return ''
	end

	if tempUnit == 'C' then
		if tempValue > 31.7 then tempDesc = 'really hot'
			elseif tempValue > 26.1 then tempDesc = 'sort of hot'
			elseif tempValue > 15 then tempDesc = 'fairly warm'
			elseif tempValue > 9.4 then tempDesc = 'fairly cool'
			elseif tempValue > 0 then tempDesc = 'sort of chilly'
			else tempDesc = 'really cold'
		end
	end
	
	if tempUnit == 'F' then
		if tempValue > 89 then tempDesc = 'really hot'
			elseif tempValue > 79 then tempDesc = 'sort of hot'
			elseif tempValue > 59 then tempDesc = 'fairly warm'
			elseif tempValue > 49 then tempDesc = 'fairly cool'
			elseif tempValue > 32 then tempDesc = 'sort of chilly'
			else tempDesc = 'really cold'
		end
	end	
Vivraan
Posts: 3
Joined: August 28th, 2020, 4:57 pm

Re: Speaking TextClock6 with Weather

Post by Vivraan »

I guess it's time I finally picked up that online course for Lua 😅Thanks for the tip.

Maybe it'll be possible to interactively set this up?

Plus wouldn't it be better to internally maintain only one temperature and convert between them on demand?
Vivraan
Posts: 3
Joined: August 28th, 2020, 4:57 pm

Re: Speaking TextClock6 with Weather

Post by Vivraan »

I commented out the tempDesc text and added the Unit like so:

Code: Select all

...

	-- if belowZero == 0 then
	-- 	SKIN:Bang('!SetOption', 'MeterTemperature', 'Text', 'it\'s '..tempDesc..' at '..hundredText..tempText..degreesText)
	-- 	return 'it\'s '..tempDesc..' at '..hundredText..tempText..degreesText
	-- else
	-- 	SKIN:Bang('!SetOption', 'MeterTemperature', 'Text', 'it\'s '..tempDesc..' at '..hundredText..tempText..degreesText..' below zero')
	-- 	return 'it\'s '..tempDesc..' at '..hundredText..tempText..degreesText..' below zero'
	-- end

	local displayString = 'it\'s '..hundredText..tempText..degreesText
	if belowZero == 0 then
		displayString = displayString..' '..TemperatureUnitString()
		SKIN:Bang('!SetOption', 'MeterTemperature', 'Text', displayString)
		return displayString
	else
		displayString = displayString..' below zero, '..TemperatureUnitString()
		SKIN:Bang('!SetOption', 'MeterTemperature', 'Text', displayString)
		return displayString
	end
	
end

function TemperatureUnitString()
	if tempUnit == 'C' then return 'Celsius' else return 'Fahrenheit' end
end
DrRoboculous
Posts: 8
Joined: June 7th, 2020, 7:18 pm

Re: Speaking TextClock6 with Weather

Post by DrRoboculous »

ikarus1969 wrote: August 28th, 2020, 5:20 am
Hope that helps a little bit
Thank you. It does help. :thumbup: