Enabled the clock update. Sort of working, but not displaying in order
His Dad [03-13-15 - 08:08]
Enabled the clock update. Sort of working, but not displaying in order
diff --git a/lua/GRID.lua b/lua/GRID.lua
index e9747f1..d1e97ec 100644
--- a/lua/GRID.lua
+++ b/lua/GRID.lua
@@ -236,6 +236,6 @@ function RT.GRID_Sort()
RT.UI.GRID_WD[v].panel:SetAnchor(TOPLEFT,RT.UI.GRID_TLW,TOPLEFT,0,panelheight*(k-1))
end
- RT.UI.GRID_TLW:SetHeight(table.getn(RT.CharsInOrder) * panelheight)
+ RT.UI.GRID_TLW:SetHeight(table.getn(RT.CharsInOrder) * panelheight)
end
EVENT_MANAGER:RegisterForEvent(RT.name, EVENT_ADD_ON_LOADED, RT.Init)
diff --git a/lua/ResearchTimer.lua b/lua/ResearchTimer.lua
index 158e255..5eb9800 100644
--- a/lua/ResearchTimer.lua
+++ b/lua/ResearchTimer.lua
@@ -104,7 +104,7 @@ function RT.Init(eventCode, addOnName)
-- SavedVariables
RT.SV.data = ZO_SavedVars:NewAccountWide(RT.name, 1, nil, nil )
- if RT.SV.data.Craft == nil
+ if RT.SV.data.Craft == nil
then RT.SV.data.Craft = {}
RT.SV.data.Craft[RT.playername]= {}
else RT.GRID_Remove_Expired()
@@ -126,14 +126,25 @@ function RT.Init(eventCode, addOnName)
RT.Collect_Data()
RT.GRID_Create()
+ RT.GRID_Update(timestamp) --Manual Update
+ RT.GRID_Sort()
RT.Init_done = true
+
-- Only after initialised do we hook any other events.
EVENT_MANAGER:RegisterForEvent(RT.name, EVENT_SMITHING_TRAIT_RESEARCH_STARTED, RT.Research_started)
+ EVENT_MANAGER:RegisterForUpdate(RT.name, 1000, RT.Update)
end
end
+function RT.Update()
+ if (RT.UI.GRID_TLW:IsHidden()) then return; end -- Don't waste effort while its hidden.
+ local timestamp = GetTimeStamp()
+ RT.GRID_Update(timestamp)
+ RT.GRID_Sort()
+end
+
function RT.toggleGRID()
- if (RT.UI.GRID_TLW:IsHidden() == true) then
+ if (RT.UI.GRID_TLW:IsHidden()) then
RT.GRID_Sort()
RT.UI.GRID_TLW:SetHidden(false)
else
@@ -165,7 +176,7 @@ function RT.Converthms(timesec)
if (days > 0) then
humanDuration = string.format("%dd ", days)..humanDuration
end
-
+
return humanDuration
end