Code: Select all
PROPERTIES =
{
}
function Initialize()
--[[
Ooh boy, that's a lot. Basically, 49 measures for the times of 49 events, and then the 98 string meters that are tied to the 49 events.
--]]
E1 = SKIN:GetMeasure("mTime1")
E2 = SKIN:GetMeasure("mTime2")
E3 = SKIN:GetMeasure("mTime3")
E4 = SKIN:GetMeasure("mTime4")
E5 = SKIN:GetMeasure("mTime5")
E6 = SKIN:GetMeasure("mTime6")
E7 = SKIN:GetMeasure("mTime7")
E8 = SKIN:GetMeasure("mTime8")
E9 = SKIN:GetMeasure("mTime9")
E10 = SKIN:GetMeasure("mTime10")
E11 = SKIN:GetMeasure("mTime11")
E12 = SKIN:GetMeasure("mTime12")
E13 = SKIN:GetMeasure("mTime13")
E14 = SKIN:GetMeasure("mTime14")
E15 = SKIN:GetMeasure("mTime15")
E16 = SKIN:GetMeasure("mTime16")
E17 = SKIN:GetMeasure("mTime17")
E18 = SKIN:GetMeasure("mTime18")
E19 = SKIN:GetMeasure("mTime19")
E20 = SKIN:GetMeasure("mTime20")
E21 = SKIN:GetMeasure("mTime21")
E22 = SKIN:GetMeasure("mTime22")
E23 = SKIN:GetMeasure("mTime23")
E24 = SKIN:GetMeasure("mTime24")
E25 = SKIN:GetMeasure("mTime25")
E26 = SKIN:GetMeasure("mTime26")
E27 = SKIN:GetMeasure("mTime27")
E28 = SKIN:GetMeasure("mTime28")
E29 = SKIN:GetMeasure("mTime29")
E30 = SKIN:GetMeasure("mTime30")
E31 = SKIN:GetMeasure("mTime31")
E32 = SKIN:GetMeasure("mTime32")
E33 = SKIN:GetMeasure("mTime33")
E34 = SKIN:GetMeasure("mTime34")
E35 = SKIN:GetMeasure("mTime35")
E36 = SKIN:GetMeasure("mTime36")
E37 = SKIN:GetMeasure("mTime37")
E38 = SKIN:GetMeasure("mTime38")
E39 = SKIN:GetMeasure("mTime39")
E40 = SKIN:GetMeasure("mTime40")
E41 = SKIN:GetMeasure("mTime41")
E42 = SKIN:GetMeasure("mTime42")
E43 = SKIN:GetMeasure("mTime43")
E44 = SKIN:GetMeasure("mTime44")
E45 = SKIN:GetMeasure("mTime45")
E46 = SKIN:GetMeasure("mTime46")
E47 = SKIN:GetMeasure("mTime47")
E48 = SKIN:GetMeasure("mTime48")
E49 = SKIN:GetMeasure("mTime49")
TL1 = SKIN:GetMeter("Item1Left")
TL2 = SKIN:GetMeter("Item2Left")
TL3 = SKIN:GetMeter("Item3Left")
TL4 = SKIN:GetMeter("Item4Left")
TL5 = SKIN:GetMeter("Item5Left")
TL6 = SKIN:GetMeter("Item6Left")
TL7 = SKIN:GetMeter("Item7Left")
TL8 = SKIN:GetMeter("Item8Left")
TL9 = SKIN:GetMeter("Item9Left")
TL10 = SKIN:GetMeter("Item10Left")
TL11 = SKIN:GetMeter("Item11Left")
TL12 = SKIN:GetMeter("Item12Left")
TL13 = SKIN:GetMeter("Item13Left")
TL14 = SKIN:GetMeter("Item14Left")
TL15 = SKIN:GetMeter("Item15Left")
TL16 = SKIN:GetMeter("Item16Left")
TL17 = SKIN:GetMeter("Item17Left")
TL18 = SKIN:GetMeter("Item18Left")
TL19 = SKIN:GetMeter("Item19Left")
TL20 = SKIN:GetMeter("Item20Left")
TL21 = SKIN:GetMeter("Item21Left")
TL22 = SKIN:GetMeter("Item22Left")
TL23 = SKIN:GetMeter("Item23Left")
TL24 = SKIN:GetMeter("Item24Left")
TL25 = SKIN:GetMeter("Item25Left")
TL26 = SKIN:GetMeter("Item26Left")
TL27 = SKIN:GetMeter("Item27Left")
TL28 = SKIN:GetMeter("Item28Left")
TL29 = SKIN:GetMeter("Item29Left")
TL30 = SKIN:GetMeter("Item30Left")
TL31 = SKIN:GetMeter("Item31Left")
TL32 = SKIN:GetMeter("Item32Left")
TL33 = SKIN:GetMeter("Item33Left")
TL34 = SKIN:GetMeter("Item34Left")
TL35 = SKIN:GetMeter("Item35Left")
TL36 = SKIN:GetMeter("Item36Left")
TL37 = SKIN:GetMeter("Item37Left")
TL38 = SKIN:GetMeter("Item38Left")
TL39 = SKIN:GetMeter("Item39Left")
TL40 = SKIN:GetMeter("Item40Left")
TL41 = SKIN:GetMeter("Item41Left")
TL42 = SKIN:GetMeter("Item42Left")
TL43 = SKIN:GetMeter("Item43Left")
TL44 = SKIN:GetMeter("Item44Left")
TL45 = SKIN:GetMeter("Item45Left")
TL46 = SKIN:GetMeter("Item46Left")
TL47 = SKIN:GetMeter("Item47Left")
TL48 = SKIN:GetMeter("Item48Left")
TL49 = SKIN:GetMeter("Item49Left")
TR1 = SKIN:GetMeter("Item1Right")
TR2 = SKIN:GetMeter("Item2Right")
TR3 = SKIN:GetMeter("Item3Right")
TR4 = SKIN:GetMeter("Item4Right")
TR5 = SKIN:GetMeter("Item5Right")
TR6 = SKIN:GetMeter("Item6Right")
TR7 = SKIN:GetMeter("Item7Right")
TR8 = SKIN:GetMeter("Item8Right")
TR9 = SKIN:GetMeter("Item9Right")
TR10 = SKIN:GetMeter("Item10Right")
TR11 = SKIN:GetMeter("Item11Right")
TR12 = SKIN:GetMeter("Item12Right")
TR13 = SKIN:GetMeter("Item13Right")
TR14 = SKIN:GetMeter("Item14Right")
TR15 = SKIN:GetMeter("Item15Right")
TR16 = SKIN:GetMeter("Item16Right")
TR17 = SKIN:GetMeter("Item17Right")
TR18 = SKIN:GetMeter("Item18Right")
TR19 = SKIN:GetMeter("Item19Right")
TR20 = SKIN:GetMeter("Item20Right")
TR21 = SKIN:GetMeter("Item21Right")
TR22 = SKIN:GetMeter("Item22Right")
TR23 = SKIN:GetMeter("Item23Right")
TR24 = SKIN:GetMeter("Item24Right")
TR25 = SKIN:GetMeter("Item25Right")
TR26 = SKIN:GetMeter("Item26Right")
TR27 = SKIN:GetMeter("Item27Right")
TR28 = SKIN:GetMeter("Item28Right")
TR29 = SKIN:GetMeter("Item29Right")
TR30 = SKIN:GetMeter("Item30Right")
TR31 = SKIN:GetMeter("Item31Right")
TR32 = SKIN:GetMeter("Item32Right")
TR33 = SKIN:GetMeter("Item33Right")
TR34 = SKIN:GetMeter("Item34Right")
TR35 = SKIN:GetMeter("Item35Right")
TR36 = SKIN:GetMeter("Item36Right")
TR37 = SKIN:GetMeter("Item37Right")
TR38 = SKIN:GetMeter("Item38Right")
TR39 = SKIN:GetMeter("Item39Right")
TR40 = SKIN:GetMeter("Item40Right")
TR41 = SKIN:GetMeter("Item41Right")
TR42 = SKIN:GetMeter("Item42Right")
TR43 = SKIN:GetMeter("Item43Right")
TR44 = SKIN:GetMeter("Item44Right")
TR45 = SKIN:GetMeter("Item45Right")
TR46 = SKIN:GetMeter("Item46Right")
TR47 = SKIN:GetMeter("Item47Right")
TR48 = SKIN:GetMeter("Item48Right")
TR49 = SKIN:GetMeter("Item49Right")
d0 = {}
d1 = {}
d2 = {}
d3 = {}
d4 = {}
d5 = {}
d6 = {}
E1 = {E1,E2,E3,E4,E5,E6,E7,E8,E9,E10,E11,E12,E13,E14,E15,E16,E17,E18,E19,E20,E21,E22,E23,E24,E25,E26,E27,E28,E29,E30,E31,E32,E33,E34,E35,E36,E37,E38,E39,E40,E41,E42,E43,E44,E45,E46,E47,E48,E49}
TL = {TL1,TL2,TL3,TL4,TL5,TL6,TL7,TL8,TL9,TL10,TL11,TL12,TL13,TL14,TL15,TL16,TL17,TL18,TL19,TL20,TL21,TL22,TL23,TL24,TL25,TL26,TL27,TL28,TL29,TL30,TL31,TL32,TL33,TL34,TL35,TL36,TL37,TL38,TL39,TL40,TL41,TL42,TL43,TL44,TL45,TL46,TL47,TL48,TL49}
TR = {TR1,TR2,TR3,TR4,TR5,TR6,TR7,TR8,TR9,TR10,TR11,TR12,TR13,TR14,TR15,TR16,TR17,TR18,TR19,TR20,TR21,TR22,TR23,TR24,TR25,TR26,TR27,TR28,TR29,TR30,TR31,TR32,TR33,TR34,TR35,TR36,TR37,TR38,TR39,TR40,TR41,TR42,TR43,TR44,TR45,TR46,TR47,TR48,TR49}
E = {}
end -- function Initialize
function Update()
a = 1
--[[
This block gathers the times from the 49 events gathered by the webparser, takes each one at a time, and substitutes the text months to the equivalent
numerical value for how many days have passed in the year. Then it substitutes the years to how many days have passed since the beginning of 2011, e.g.,
Jan 1, 2011 and Jan 1, 2012 have the values 0 + 1 + 0 and 0 + 1 + 365, respectively. Finally, 'f = loadstring("E[a] = "..E[a])' changes the string of
additions (^previous example^) and adds them together, creating 1 and 366.
--]]
repeat
E[a] = E1[a]:GetStringValue()
if string.match(E[a], '.*(2012).*') == '2012' then
E[a] = string.gsub(E[a], '.*(Jan) ', '000 + ', 1)
E[a] = string.gsub(E[a], '.*(Feb) ', '031 + ', 1)
E[a] = string.gsub(E[a], '.*(Mar) ', '060 + ', 1)
E[a] = string.gsub(E[a], '.*(Apr) ', '091 + ', 1)
E[a] = string.gsub(E[a], '.*(May) ', '121 + ', 1)
E[a] = string.gsub(E[a], '.*(Jun) ', '152 + ', 1)
E[a] = string.gsub(E[a], '.*(Jul) ', '182 + ', 1)
E[a] = string.gsub(E[a], '.*(Aug) ', '213 + ', 1)
E[a] = string.gsub(E[a], '.*(Sep) ', '244 + ', 1)
E[a] = string.gsub(E[a], '.*(Oct) ', '274 + ', 1)
E[a] = string.gsub(E[a], '.*(Nov) ', '305 + ', 1)
E[a] = string.gsub(E[a], '.*(Dec) ', '335 + ', 1)
elseif string.match(E[a], '.*(2016).*') == '2016' then
E[a] = string.gsub(E[a], '.*(Jan) ', '000 + ', 1)
E[a] = string.gsub(E[a], '.*(Feb) ', '031 + ', 1)
E[a] = string.gsub(E[a], '.*(Mar) ', '060 + ', 1)
E[a] = string.gsub(E[a], '.*(Apr) ', '091 + ', 1)
E[a] = string.gsub(E[a], '.*(May) ', '121 + ', 1)
E[a] = string.gsub(E[a], '.*(Jun) ', '152 + ', 1)
E[a] = string.gsub(E[a], '.*(Jul) ', '182 + ', 1)
E[a] = string.gsub(E[a], '.*(Aug) ', '213 + ', 1)
E[a] = string.gsub(E[a], '.*(Sep) ', '244 + ', 1)
E[a] = string.gsub(E[a], '.*(Oct) ', '274 + ', 1)
E[a] = string.gsub(E[a], '.*(Nov) ', '305 + ', 1)
E[a] = string.gsub(E[a], '.*(Dec) ', '335 + ', 1)
else
E[a] = string.gsub(E[a], '.*(Jan) ', '000 + ', 1)
E[a] = string.gsub(E[a], '.*(Feb) ', '031 + ', 1)
E[a] = string.gsub(E[a], '.*(Mar) ', '059 + ', 1)
E[a] = string.gsub(E[a], '.*(Apr) ', '090 + ', 1)
E[a] = string.gsub(E[a], '.*(May) ', '120 + ', 1)
E[a] = string.gsub(E[a], '.*(Jun) ', '151 + ', 1)
E[a] = string.gsub(E[a], '.*(Jul) ', '181 + ', 1)
E[a] = string.gsub(E[a], '.*(Aug) ', '212 + ', 1)
E[a] = string.gsub(E[a], '.*(Sep) ', '243 + ', 1)
E[a] = string.gsub(E[a], '.*(Oct) ', '273 + ', 1)
E[a] = string.gsub(E[a], '.*(Nov) ', '304 + ', 1)
E[a] = string.gsub(E[a], '.*(Dec) ', '334 + ', 1)
end
E[a] = string.gsub(E[a], ', (2011).*', ' + 0000', 1)
E[a] = string.gsub(E[a], ', (2012).*', ' + 0365', 1)
E[a] = string.gsub(E[a], ', (2013).*', ' + 0731', 1)
E[a] = string.gsub(E[a], ', (2014).*', ' + 1096', 1)
E[a] = string.gsub(E[a], ', (2015).*', ' + 1462', 1)
E[a] = string.gsub(E[a], ', (2016).*', ' + 1872', 1)
f = loadstring("E[a] = "..E[a])
f()
a = a + 1
until a == 50
--[[
Same formula from above, applied to the current date so that the event date can be compared to the current date.
--]]
curdate = os.date("%m %d %Y")
if string.match(curdate, '2012') == '2012' then
curdate = string.gsub(curdate, '(01) ', '000 + ', 1)
curdate = string.gsub(curdate, '(02) ', '031 + ', 1)
curdate = string.gsub(curdate, '(03) ', '060 + ', 1)
curdate = string.gsub(curdate, '(04) ', '091 + ', 1)
curdate = string.gsub(curdate, '(05) ', '121 + ', 1)
curdate = string.gsub(curdate, '(06) ', '152 + ', 1)
curdate = string.gsub(curdate, '(07) ', '182 + ', 1)
curdate = string.gsub(curdate, '(08) ', '213 + ', 1)
curdate = string.gsub(curdate, '(09) ', '244 + ', 1)
curdate = string.gsub(curdate, '(10) ', '274 + ', 1)
curdate = string.gsub(curdate, '(11) ', '305 + ', 1)
curdate = string.gsub(curdate, '(12) ', '335 + ', 1)
elseif string.match(curdate, '2016') == '2016' then
curdate = string.gsub(curdate, '(01) ', '000 + ', 1)
curdate = string.gsub(curdate, '(02) ', '031 + ', 1)
curdate = string.gsub(curdate, '(03) ', '060 + ', 1)
curdate = string.gsub(curdate, '(04) ', '091 + ', 1)
curdate = string.gsub(curdate, '(05) ', '121 + ', 1)
curdate = string.gsub(curdate, '(06) ', '152 + ', 1)
curdate = string.gsub(curdate, '(07) ', '182 + ', 1)
curdate = string.gsub(curdate, '(08) ', '213 + ', 1)
curdate = string.gsub(curdate, '(09) ', '244 + ', 1)
curdate = string.gsub(curdate, '(10) ', '274 + ', 1)
curdate = string.gsub(curdate, '(11) ', '305 + ', 1)
curdate = string.gsub(curdate, '(12) ', '335 + ', 1)
else
curdate = string.gsub(curdate, '(01) ', '000 + ', 1)
curdate = string.gsub(curdate, '(02) ', '031 + ', 1)
curdate = string.gsub(curdate, '(03) ', '059 + ', 1)
curdate = string.gsub(curdate, '(04) ', '090 + ', 1)
curdate = string.gsub(curdate, '(05) ', '120 + ', 1)
curdate = string.gsub(curdate, '(06) ', '151 + ', 1)
curdate = string.gsub(curdate, '(07) ', '181 + ', 1)
curdate = string.gsub(curdate, '(08) ', '212 + ', 1)
curdate = string.gsub(curdate, '(09) ', '243 + ', 1)
curdate = string.gsub(curdate, '(10) ', '273 + ', 1)
curdate = string.gsub(curdate, '(11) ', '304 + ', 1)
curdate = string.gsub(curdate, '(12) ', '334 + ', 1)
end
curdate = string.gsub(curdate, ' (2011)', ' + 0000', 1)
curdate = string.gsub(curdate, ' (2012)', ' + 0365', 1)
curdate = string.gsub(curdate, ' (2013)', ' + 0731', 1)
curdate = string.gsub(curdate, ' (2014)', ' + 1096', 1)
curdate = string.gsub(curdate, ' (2015)', ' + 1462', 1)
curdate = string.gsub(curdate, ' (2016)', ' + 1872', 1)
f = loadstring("curdate = "..curdate)
f()
c = 1
--[[
Here's the comparison! Takes each event date, figures out how close to the current date it is, and then sorts it appropriately:
if the event is tomorrow (one day away), the strings related to the event are sorted into the corresponding tables (d1, in this case).
If the event is seven days or more away (anytime past a week), the strings are hidden because there is no need for them.
--]]
repeat
if E[c] - curdate < 7 then
if E[c] - curdate == 0 then
table.insert(d0, TL[c])
table.insert(d0, TR[c])
elseif E[c] - curdate == 1 then
table.insert(d1, TL[c])
table.insert(d1, TR[c])
elseif E[c] - curdate == 2 then
table.insert(d2, TL[c])
table.insert(d2, TR[c])
elseif E[c] - curdate == 3 then
table.insert(d3, TL[c])
table.insert(d3, TR[c])
elseif E[c] - curdate == 4 then
table.insert(d4, TL[c])
table.insert(d4, TR[c])
elseif E[c] - curdate == 5 then
table.insert(d5, TL[c])
table.insert(d5, TR[c])
else
table.insert(d6, TL[c])
table.insert(d6, TR[c])
end
else
TL[c]:Hide()
TR[c]:Hide()
end
c = c + 1
until c == 50
return E[1]
--[[
There will be more to this, but until I can get this section working correctly to hide strings that are seven days away,
I don't really want to put more work into it.
--]]
end -- function Update