Weather message plus current time
Posted: Sat Feb 11, 2023 2:51 am
Hi
Getting there (slowly) with Lua, Ive setup weather with special message (as below) and current (random) forecast with hourly trigger this works fine, I would like to add the current time to the message.
How do I do that?
Do I add this ...
ScenEdit_CurrentTime ()
Weather with special message and hourly trigger
Assisstance would be appricated
DB
Getting there (slowly) with Lua, Ive setup weather with special message (as below) and current (random) forecast with hourly trigger this works fine, I would like to add the current time to the message.
How do I do that?
Do I add this ...
ScenEdit_CurrentTime ()
Code: Select all
local now = ScenEdit_CurrentTime()
local elapsed = now - timeFromLastTiggered
if elapsed > 60*5 then
-- been more than 5 minutes, set the lastTriggered time to now
timeFromLastTiggered = now
endWeather with special message and hourly trigger
Code: Select all
------Set Weather and set it on a regular time trigger with a low % chance of firing
----- Temperature Range = 22C to 42C (71.6F to 107.6F)
local temp= math.random( 23, 25 )
------- Rain Range = 0 to 50
local rain= math.random( 0, 10 )
------- Cloud Range = 0.0 to1.0
local cloud= math.random( 2.0, 5.0 ) / 10.0
------- Sea State Range = 0 to 9
local sea= math.random( 3,5)
------- Set Ranges
ScenEdit_SetWeather( temp, rain, cloud, sea )
------- Special Message that can go with random weather
ScenEdit_SpecialMessage('Blue', '<P><FONT size=2 face="Courier New">ALL<BR>AUSTRALIAN GOVERNMENT BUREAU OF METEOROLOGY TASMANIA<BR>COASTAL WATERS FORECAST BASS STRAIT AND APPROACHES<BR><BR>TEMPERATURE: ' .. temp .. ' DEGREES CELSIUS<BR>RAIN STATE: ' .. rain .. '<BR>CLOUD LEVEL: ' .. cloud .. '<BR>SEA STATE: ' .. sea)
Assisstance would be appricated
DB