Update AardClock2.0_Beta

Made changes, clock saves position.
pull/2/head
AardCrowley 6 years ago
parent 0b10a2ccb1
commit 31a87ea920

@ -6,414 +6,434 @@
<!-- Plugin "Aardwolf_Clock" generated by Plugin Wizard --> <!-- Plugin "Aardwolf_Clock" generated by Plugin Wizard -->
<muclient> <muclient>
<plugin <plugin name="Aardwolf_Clock" author="Crowley" id="28a36788fa20aa062e760ee2" language="Lua" purpose="Displays a realtime clock based on Aardwolf game time" save_state="y" date_written="2018-05-15 11:43:22" requires="4.90" version="1.0">
name="Aardwolf_Clock"
author="Crowley" </plugin>
id="28a36788fa20aa062e760ee2"
language="Lua" <!-- Triggers -->
purpose="Displays a realtime clock based on Aardwolf game time"
save_state="y" <triggers>
date_written="2018-05-15 11:43:22" <trigger enabled="n" match="^\s+\*\s+It is ((?:\d+|Noon|Midnight))((?:p|a))?m? on the (\d+)(?:rd|th|nd|st) day of the Season of (?:the )?(\w+).*$" script="getTime" regexp="y" sequence="100" omit_from_output="n" name="GetTime">
requires="4.90" </trigger>
version="1.0" </triggers>
>
<!-- Timers -->
</plugin>
<timers>
<!-- Triggers --> <timer script="onTimer" second="0.25" offset_second="0.00" name="clockTimer" enabled="y">
<triggers> </timer>
<trigger </timers>
enabled="n"
match="^\s+\*\s+It is ((?:\d+|Noon|Midnight))((?:p|a))?m? on the (\d+)(?:rd|th|nd|st) day of the Season of (?:the )?(\w+).*$" <!-- Script -->
script="getTime"
regexp="y"
sequence="100" <script>
omit_from_output="n" <![CDATA[
name="GetTime" require 'mw_theme_base'
> require 'movewindow'
</trigger>
</triggers> background_colour = Theme.PRIMARY_BODY
<!-- Timers --> clock_seasons = {
Sun = {138, 3, 19, 1, "Light"},
<timers> Scourge = {168, 9, 18, 2, "Disease"},
<timer script="onTimer" second="0.25" offset_second="0.00" name="clockTimer" enabled="y" > River = {138, 7, 18, 3, "Water"},
Song = {150, 6, 19, 4, "Sonic"},
</timer> Energy = {148, 6, 20, 5, "Energy"},
</timers> Nature = {140, 5, 19, 6, "Earth"},
Snake = {142, 5, 20, 7, "Poison"},
<!-- Script --> Sword = {140, 7, 18, 8, "Slash"},
Freeze = {148, 9, 19, 9, "Cold"},
Thought = {148, 8, 20, 10, "Mental"},
<script> Darkness = {134, 10, 18, 11, "Shadow"},
<![CDATA[ Corrosion = {136, 8, 20, 12, "Acid"},
require "mw_theme_base" Dagger = {120, 9, 18, 13, "Pierce"},
require 'movewindow' Storm = {131, 8, 19, 14, "Electric"},
Piety = {143, 7, 18, 15, "Holy"},
background_colour = Theme.PRIMARY_BODY Suffering = {135, 6, 19, 16, "Negative"},
Burning = {144, 7, 20, 17, "Fire"},
clock_seasons = { Tornado = {142, 7, 21, 18, "Air"},
Sun = {138, 3, 19, 1, "Light"}, Stone = {120, 7, 21, 19, "Bash"},
Scourge = {168, 9, 18, 2, "Disease"}, Magi = {138, 6, 19, 20, "Magic"},
River = {138, 7, 18, 3, "Water"}, }
Song = {150, 6, 19, 4, "Sonic"},
Energy = {148, 6, 20, 5, "Energy"}, clock_season_order = {
Nature = {140, 5, 19, 6, "Earth"}, "Sun",
Snake = {142, 5, 20, 7, "Poison"}, "Scourge",
Sword = {140, 7, 18, 8, "Slash"}, "River",
Freeze = {148, 9, 19, 9, "Cold"}, "Song",
Thought = {148, 8, 20, 10, "Mental"}, "Energy",
Darkness = {134, 10, 18, 11, "Shadow"}, "Nature",
Corrosion = {136, 8, 20, 12, "Acid"}, "Snake",
Dagger = {120, 9, 18, 13, "Pierce"}, "Sword",
Storm = {131, 8, 19, 14, "Electric"}, "Freeze",
Piety = {143, 7, 18, 15, "Holy"}, "Thought",
Suffering = {135, 6, 19, 16, "Negative"}, "Darkness",
Burning = {144, 7, 20, 17, "Fire"}, "Corrosion",
Tornado = {142, 7, 21, 18, "Air"}, "Dagger",
Stone = {120, 7, 21, 19, "Bash"}, "Storm",
Magi = {138, 6, 19, 20, "Magic"}, "Piety",
} "Suffering",
"Burning",
clock_season_order = {"Sun", "Scourge", "River", "Song", "Energy", "Nature", "Snake", "Sword", "Freeze", "Thought", "Darkness", "Corrosion", "Dagger", "Storm", "Piety", "Suffering", "Burning", "Tornado", "Stone", "Magi"} "Tornado",
clock_current = {Season = "Sun", day = 1, order = 1} "Stone",
"Magi"
local win = "AardClock_" .. GetPluginID() }
local font = "f"
clock_current = {Season = "Sun", day = 1, order = 1}
windowinfo = movewindow.install(win, 7, miniwin.create_absolute_location, true, nil, {mouseup = MoveMouseUp, mousedown = MoveMouseDown})
local win = "AardClock_" .. GetPluginID()
checked_time = false local font = "f"
local footer_text = {}
windowinfo = movewindow.install(win, 7, miniwin.create_absolute_location, true, nil, {mouseup = MoveMouseUp, mousedown = MoveMouseDown})
WindowCreate(win, 0, 0, 0, 0, 1, 0, 0)
WindowFont(win, font, "Monoid", 10, true) checked_time = false
local font_height = WindowFontInfo(win, font, 1) local footer_text = {}
local font_width = WindowTextWidth(win, font, " ", 1)
window_width = (20 * font_width) + 11 local font_families = utils.getfontfamilies()
local cx = math.floor((window_width-5)/2) + 1 if font_families["Monoid"] then
local cy = cx + font_height font_name = "Monoid"
canRedraw = true font_size = 8
elseif font_families["Dina"] then
bgDay = 'khaki' font_name = "Dina"
bgNight = 'navy' font_size = 8
textDay = 'black' elseif font_families["Lucida Sans Console"] then
textNight = 'white' font_name = "Lucida Sans Console"
hourTime = 12 font_size = 10
bgColour = 'khaki' else
textColour = 'black' font_name = "Consolas"
handDay = 'black' font_size = 10
handNight = 'yellow' end
handColour = 'black'
WindowCreate(win, 0, 0, 0, 0, 1, 0, 0)
function round(v) WindowFont(win, font, font_name, font_size, true)
local r = 0 local font_height = WindowFontInfo(win, font, 1)
if type(v) == 'number' then local font_width = WindowTextWidth(win, font, " ", 1)
i, f = math.modf(v)
if f >0.5 then window_width = (20 * font_width) + 11
r = i + 1 local cx = math.floor((window_width-5)/2) + 1
else local cy = cx + font_height
r = i canRedraw = true
end
end bgDay = 'khaki'
return r bgNight = 'navy'
end textDay = 'black'
textNight = 'white'
function findPos(t) hourTime = 12
local spt = 12.0 bgColour = 'khaki'
local r = 62 textColour = 'black'
local offset = 0 handDay = 'black'
handNight = 'yellow'
if t > 6 then handColour = 'black'
offset = font_width
elseif t<= 6 then function round(v)
offset = font_width/2 local r = 0
end if type(v) == 'number' then
i, f = math.modf(v)
local a = 2 * math.pi * (spt-t) / spt if f >0.5 then
local diff = 0.9 -- default 0.9 r = i + 1
else
local s = math.sin(a) r = i
local c = math.cos(a) end
end
local x = 1 + round(cx - diff * r * s) return r
local y = 10 + round(cy - diff * r * c) end
return {posx = x - offset, posy = y} function findPos(t)
end local spt = 12.0
local r = 62
function drawHand(t, r, subset) local offset = 0
local y9, x12, y3, x6 = findPos(9), findPos(12), findPos(3), findPos(6)
local startx, starty, endx, endy = x12.posx + (font_width)/2, y9.posy + (font_height/2), x6.posx + font_width/2, y3.posy + font_height/2 if t > 6 then
local tcx = (startx + endx)/2 -- + startx offset = font_width
local tcy = (starty + endy)/2 -- + starty elseif t<= 6 then
local spt = subset offset = font_width/2
local a = 2 * math.pi * (spt-t)/ spt end
local s = math.sin(a)
local c = math.cos(a) local a = 2 * math.pi * (spt-t) / spt
local diff = 0.9 -- default 0.9
local x1 = 1 + round(tcx + 0.1 * r * s)
local y1 = 1 + round(tcy + 0.1 * r * c) local s = math.sin(a)
--local x1 = cx local c = math.cos(a)
--local y1 = cy
local x2 = 1 + round(tcx - 0.9 * r * s) local x = 1 + round(cx - diff * r * s)
local y2 = 1 + round(tcy - 0.9 * r * c) local y = 10 + round(cy - diff * r * c)
WindowLine(win, x1, y1, x2, y2, ColourNameToRGB(handColour), miniwin.pen_solid + miniwin.pen_join_miter + miniwin.pen_endcap_round, 2) return {posx = x - offset, posy = y}
end end
function circleDraw(x, y, r) function drawHand(t, r, subset)
local y9, x12, y3, x6 = findPos(9), findPos(12), findPos(3), findPos(6) local y9, x12, y3, x6 = findPos(9), findPos(12), findPos(3), findPos(6)
local startx, starty, endx, endy = x12.posx + (font_width)/2, y9.posy + (font_height/2), x6.posx + font_width/2, y3.posy + font_height/2 local startx, starty, endx, endy = x12.posx + (font_width)/2, y9.posy + (font_height/2), x6.posx + font_width/2, y3.posy + font_height/2
local tcx = (startx + endx)/2 -- + startx local tcx = (startx + endx)/2 -- + startx
local tcy = (starty + endy)/2 -- + starty local tcy = (starty + endy)/2 -- + starty
local left, top, right, bottom = tcx - r, tcy - r, tcx + r, tcy + r local spt = subset
local a = 2 * math.pi * (spt-t)/ spt
local s = math.sin(a)
local c = math.cos(a)
local x1 = 1 + round(tcx + 0.1 * r * s)
local y1 = 1 + round(tcy + 0.1 * r * c)
--local x1 = cx
--local y1 = cy
local x2 = 1 + round(tcx - 0.9 * r * s)
local y2 = 1 + round(tcy - 0.9 * r * c)
WindowLine(win, x1, y1, x2, y2, ColourNameToRGB(handColour), miniwin.pen_solid + miniwin.pen_join_miter + miniwin.pen_endcap_round, 2)
end
function circleDraw(x, y, r)
local y9, x12, y3, x6 = findPos(9), findPos(12), findPos(3), findPos(6)
local startx, starty, endx, endy = x12.posx + (font_width)/2, y9.posy + (font_height/2), x6.posx + font_width/2, y3.posy + font_height/2
local tcx = (startx + endx)/2 -- + startx
local tcy = (starty + endy)/2 -- + starty
local left, top, right, bottom = tcx - r, tcy - r, tcx + r, tcy + r
return {l = left, t = top, r = right, b = bottom} return {l = left, t = top, r = right, b = bottom}
end end
function drawFace() function drawFace()
local clock_numbers = {} local clock_numbers = {}
local startx, endy, circle_left, circle_top, circle_right, circle_bottom = 0, 0, 0, 0, 0, 0 local startx, endy, circle_left, circle_top, circle_right, circle_bottom = 0, 0, 0, 0, 0, 0
for i = 1,12 do for i = 1,12 do
table.insert(clock_numbers, {text = i, pos = findPos(i)}) table.insert(clock_numbers, {text = i, pos = findPos(i)})
if i == 6 then if i == 6 then
endy = clock_numbers[6].pos.posy endy = clock_numbers[6].pos.posy
end end
if i == 12 then if i == 12 then
starty = clock_numbers[12].pos.posy starty = clock_numbers[12].pos.posy
end end
end end
local window_height = font_height + 5 + endy + starty + (font_height * (#footer_text + 2)) -- font_height * 10 local window_height = font_height + 5 + endy + starty + (font_height * (#footer_text + 2)) -- font_height * 10
WindowCreate(win, windowinfo.window_left, windowinfo.window_top, window_width, window_height, windowinfo.window_mode, windowinfo.window_flags + miniwin.create_keep_hotspots, ColourNameToRGB(Theme.SECONDARY_BODY)) WindowCreate(win, windowinfo.window_left, windowinfo.window_top, window_width, window_height, windowinfo.window_mode, windowinfo.window_flags + miniwin.create_keep_hotspots, ColourNameToRGB(Theme.SECONDARY_BODY))
WindowLoadImage(win, "background", GetInfo(66) .. "/worlds/plugins/images/" .. bgImage .. ".png") WindowDrawImage(win, "background", 0, 0, WindowInfo(win, 3), WindowInfo(win, 4), miniwin.image_stretch)
WindowDrawImage(win, "background", 0, 0, WindowInfo(win, 3), WindowInfo(win, 4), miniwin.image_stretch)
local x = 5 local x = 5
local y = clock_numbers[6].pos.posy + font_height * 2 local y = clock_numbers[6].pos.posy + font_height * 2
WindowText(win, font, seasonEnd, center(seasonEnd), font_height/2, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, seasonEnd, center(seasonEnd), font_height/2, 0, 0, ColourNameToRGB(textColour))
local sunr = clock_seasons[clock_current.Season][2] .. "am" local sunr = clock_seasons[clock_current.Season][2] .. "am"
local suns = (tonumber(clock_seasons[clock_current.Season][3]) - 12) .. "pm" local suns = (tonumber(clock_seasons[clock_current.Season][3]) - 12) .. "pm"
WindowText(win, font, sunr, x, font_height*1.5, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, sunr, x, font_height*1.5, 0, 0, ColourNameToRGB(textColour))
local cdiml, cdimt = font_width, font_height*2.5 local cdiml, cdimt = font_width, font_height*2.5
local cdimr, cdimb = cdiml + font_width*2, cdimt + (font_width*2) local cdimr, cdimb = cdiml + font_width*2, cdimt + (font_width*2)
WindowCircleOp(win, 1, cdiml, cdimt, cdimr, cdimb, ColourNameToRGB("yellow"), 2, 1, ColourNameToRGB("yellow"), 0) WindowCircleOp(win, 1, cdiml, cdimt, cdimr, cdimb, ColourNameToRGB("yellow"), 2, 1, ColourNameToRGB("yellow"), 0)
cdiml = (WindowInfo(win, 3) - 5) - font_width*3 cdiml = (WindowInfo(win, 3) - 5) - font_width*3
cdimr = cdiml + font_width*2 cdimr = cdiml + font_width*2
WindowText(win, font, suns, ((WindowInfo(win, 3) -5) - font_width*4), font_height*1.5, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, suns, ((WindowInfo(win, 3) -5) - font_width*4), font_height*1.5, 0, 0, ColourNameToRGB(textColour))
WindowCircleOp(win, 1, cdiml, cdimt, cdimr, cdimb, ColourNameToRGB("orangered"), 2, 1, ColourNameToRGB("orangered"), 0) WindowCircleOp(win, 1, cdiml, cdimt, cdimr, cdimb, ColourNameToRGB("orangered"), 2, 1, ColourNameToRGB("orangered"), 0)
sqdim = circleDraw(cx, cy, 68) sqdim = circleDraw(cx, cy, 68)
WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1) WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1)
sqdim = circleDraw(cx, cy, 70) sqdim = circleDraw(cx, cy, 70)
WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1) WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1)
sqdim = circleDraw(cx, cy, 71) sqdim = circleDraw(cx, cy, 71)
WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1) WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1)
sqdim = circleDraw(cx, cy, 72) sqdim = circleDraw(cx, cy, 72)
WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1) WindowCircleOp(win, 1, sqdim.l, sqdim.t, sqdim.r, sqdim.b, ColourNameToRGB(handColour), 0, 1, 0, 1)
for _,v in ipairs(clock_numbers) do for _,v in ipairs(clock_numbers) do
WindowText(win, font, v.text, v.pos.posx, v.pos.posy, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, v.text, v.pos.posx, v.pos.posy, 0, 0, ColourNameToRGB(textColour))
end end
WindowText(win, font, dTime, center(dTime), y, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, dTime, center(dTime), y, 0, 0, ColourNameToRGB(textColour))
y = y + font_height y = y + font_height
WindowText(win, font, string.format("[ Day %d of %d ]", footer_text.Day, footer_text.Cycle), center(string.format("[ Day %d of %d ]", footer_text.Day, footer_text.Cycle)), y, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, string.format("[ Day %d of %d ]", footer_text.Day, footer_text.Cycle), center(string.format("[ Day %d of %d ]", footer_text.Day, footer_text.Cycle)), y, 0, 0, ColourNameToRGB(textColour))
y = y + font_height y = y + font_height
WindowText(win, font, string.format("Season of %s", footer_text.Season), center(string.format("Season of %s", footer_text.Season)), y, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, string.format("Season of %s", footer_text.Season), center(string.format("Season of %s", footer_text.Season)), y, 0, 0, ColourNameToRGB(textColour))
y = y + font_height y = y + font_height
WindowText(win, font, string.format("[ %s ]", footer_text.DamType), center(string.format("[ %s ]", footer_text.DamType)), y, 0, 0, ColourNameToRGB(textColour)) WindowText(win, font, string.format("[ %s ]", footer_text.DamType), center(string.format("[ %s ]", footer_text.DamType)), y, 0, 0, ColourNameToRGB(textColour))
movewindow.add_drag_handler (win, 0, 0, 0, window_height) movewindow.add_drag_handler (win, 0, 0, 0, window_height)
WindowRectOp(win, 4, 1, 1, WindowInfo(win, 3)-1, WindowInfo(win, 4)-1, Theme.PRIMARY_BODY, Theme.SECONDARY_BODY) -- 9, 15 + 0x1000 + 0x4000) WindowRectOp(win, 4, 1, 1, WindowInfo(win, 3)-1, WindowInfo(win, 4)-1, Theme.PRIMARY_BODY, Theme.SECONDARY_BODY) -- 9, 15 + 0x1000 + 0x4000)
WindowSetZOrder(win, 50) WindowSetZOrder(win, 50)
WindowShow(win, true) WindowShow(win, true)
end end
function center(t) function center(t)
local twid = WindowTextWidth(win, font, t) local twid = WindowTextWidth(win, font, t)
local cdiff = window_width - twid local cdiff = window_width - twid
return cdiff/2 return cdiff/2
end end
function OnPluginBroadcast (msg, id, name, text) function OnPluginBroadcast (msg, id, name, text)
if (id == '3e7dedbe37e44942dd46d264') then if (id == '3e7dedbe37e44942dd46d264') then
if (text == 'comm.tick') then if (text == 'comm.tick') then
if checked_time then if checked_time then
if hourTime == 12 then if hourTime == 12 then
hourTime = 1 hourTime = 1
else else
hourTime = hourTime + 1 hourTime = hourTime + 1
end end
if rTime == 23 then if rTime == 23 then
rTime = 0 rTime = 0
updateDay() updateDay()
else else
rTime = rTime + 1 rTime = rTime + 1
end end
if rTime >= 12 then if rTime >= 12 then
dTime = hourTime .. "pm" dTime = hourTime .. "pm"
else else
dTime = hourTime .. "am" dTime = hourTime .. "am"
end end
checkColours() checkColours()
ResetTimer("clockTimer") ResetTimer("clockTimer")
last_tick = os.clock() last_tick = os.clock()
onTimer() onTimer()
else else
EnableTrigger("GetTime") EnableTrigger("GetTime")
Send("time") Send(" time")
end end
end end
end end
end end
function OnPluginConnect() function OnPluginConnect()
checked_time = false checked_time = false
end end
function checkColours() function checkColours()
local sunrise, sunset = clock_seasons[clock_current.Season][2], clock_seasons[clock_current.Season][3] local sunrise, sunset = clock_seasons[clock_current.Season][2], clock_seasons[clock_current.Season][3]
if rTime >= sunrise and rTime < sunset then if rTime >= sunrise and rTime < sunset then
bgColour = bgDay bgColour = bgDay
textColour = textDay textColour = textDay
handColour = handDay handColour = handDay
bgImage = "cloud" bgImage = "cloud"
elseif rTime >= sunset or rTime < sunrise then elseif rTime >= sunset or rTime < sunrise then
bgColour = bgNight bgColour = bgNight
textColour = textNight textColour = textNight
handColour = handNight handColour = handNight
sunsetColour = textColour sunsetColour = textColour
bgImage = "darkstone" bgImage = "darkstone"
end end
end
WindowLoadImage(win, "background", GetInfo(66) .. "/worlds/plugins/images/" .. bgImage .. ".png")
function getTime(name, line, args) end
clock_current = {Season = args[4], day = tonumber(args[3]), order = clock_seasons[args[4]][4]}
function getTime(name, line, args)
footer_text = {Day = tonumber(args[3]), Season = args[4], Cycle = clock_seasons[args[4]][1], DamType = clock_seasons[args[4]][5]} clock_current = {Season = args[4], day = tonumber(args[3]), order = clock_seasons[args[4]][4]}
footer_text = {Day = tonumber(args[3]), Season = args[4], Cycle = clock_seasons[args[4]][1], DamType = clock_seasons[args[4]][5]}
if args[1] == "Noon" then
hourTime = 12
rTime = 12 if args[1] == "Noon" then
elseif args[1] == "Midnight" then hourTime = 12
hourTime = 12 rTime = 12
rTime = 0 elseif args[1] == "Midnight" then
else hourTime = 12
hourTime = tonumber(args[1]) rTime = 0
if args[2] == "a" then else
rTime = tonumber(args[1]) hourTime = tonumber(args[1])
dTime = hourTime .. "am" if args[2] == "a" then
else rTime = tonumber(args[1])
rTime = tonumber(args[1]) + 12 dTime = hourTime .. "am"
dTime = hourTime .. "pm" else
end rTime = tonumber(args[1]) + 12
end dTime = hourTime .. "pm"
end
checkColours() end
updateTime()
checkColours()
checked_time = true updateTime()
EnableTrigger("GetTime", false)
end checked_time = true
EnableTrigger("GetTime", false)
function updateTime() end
seasonEnd = "Season ends: "
local days, hours, cday = clock_seasons[clock_current.Season][1], rTime, clock_current.day function updateTime()
seasonEnd = "Season ends: "
local days_left = days - cday local days, hours, cday = clock_seasons[clock_current.Season][1], rTime, clock_current.day
local days_mins_left = (days_left-1) * 12
local day_mins_left = 24 - (rTime * 0.5) local days_left = days - cday
local days_mins_left = (days_left-1) * 12
local mins_left = days_mins_left + day_mins_left local day_mins_left = 24 - (rTime * 0.5)
local rH, rM = math.floor(mins_left/60), math.floor(mins_left%60) local mins_left = days_mins_left + day_mins_left
seasonEnd = seasonEnd .. rH .. "h " .. rM .. "m" local rH, rM = math.floor(mins_left/60), math.floor(mins_left%60)
end
seasonEnd = seasonEnd .. rH .. "h " .. rM .. "m"
function onTimer() end
if canRedraw then
if checked_time then function onTimer()
last_tick = last_tick or os.clock() if canRedraw then
local s = os.clock() - last_tick if checked_time then
updateTime() last_tick = last_tick or os.clock()
drawFace() local s = os.clock() - last_tick
drawHand(math.min(30, s), 60, 30) updateTime()
hourHandTime = hourTime + s/30 drawFace()
drawHand(hourHandTime, 45, 12) drawHand(math.min(30, s), 60, 30)
Redraw() hourHandTime = hourTime + s/30
end drawHand(hourHandTime, 45, 12)
end Redraw()
end end
end
function updateDay() end
if clock_current.day == clock_seasons[clock_current.Season][1] then
if clock_current.order == #clock_season_order then function updateDay()
clock_current.order = 1 if clock_current.day == clock_seasons[clock_current.Season][1] then
clock_current.Season = "Sun" if clock_current.order == #clock_season_order then
clock_current.day = 1 clock_current.order = 1
else clock_current.Season = "Sun"
clock_current.order = clock_current.order + 1 clock_current.day = 1
clock_current.Season = clock_season_order[clock_current.order] else
clock_current.day = 1 clock_current.order = clock_current.order + 1
end clock_current.Season = clock_season_order[clock_current.order]
else clock_current.day = 1
clock_current.day = clock_current.day + 1 end
end else
clock_current.day = clock_current.day + 1
footer_text = {Day = clock_current.day, Cycle = clock_seasons[clock_current.Season][1], Season = clock_current.Season, DamType = clock_seasons[clock_current.Season][5]} end
end footer_text = {Day = clock_current.day, Cycle = clock_seasons[clock_current.Season][1], Season = clock_current.Season, DamType = clock_seasons[clock_current.Season][5]}
function OnPluginDisable() end
WindowDelete(win)
end function OnPluginDisable()
WindowDelete(win)
function OnPluginSaveState() end
movewindow.save_state(win)
end function OnPluginSaveState()
movewindow.save_state(win)
function MoveMouseDown() end
canRedraw = false
print("Mousedown!") function MoveMouseDown()
end canRedraw = false
print("Mousedown!")
function MoveMouseUp() end
canRedraw = true
print("Mouseup!") function MoveMouseUp()
end canRedraw = true
print("Mouseup!")
end
]]> ]]>
</script> </script>
</muclient> </muclient>

Loading…
Cancel
Save