So, as the title suggests, I'm looking to have a skin that puts a specific quotes up on specific dates, and I know this could be done with 366 IfCondition statements, but that would just turn into a tedious hassle, so I'm looking to have it pull the data from a spreadsheet or text document. I've seen from other posts that I've searched up that there is a quotes plugin, but that selects randomly, and I don't want it to be random. I've also seen that approaches with both WebParser and Lua are often used, and that Lua is probably better for this project, given the hardships with WebParser explained
here. I also found the Lua date system
here, but I am not sure as to how to integrate it into a Lua script like this one: (found under the first link)
Code: Select all
function Initialize()
CURRENTPATH = SKIN:GetVariable('CURRENTPATH')
Quotes = {}
Authors = {}
i = 0
for line in io.lines(CURRENTPATH..'Listofquotes.txt') do
if string.sub(line, 1, 7) == '<quote>' then
i = i + 1
Quotes[i] = string.sub(line, 8)
elseif string.sub(line, 1, 8) == '<author>' then
Authors[i] = string.sub(line, 9)
else
Quotes[i] = Quotes[i]..'#CRLF#'..line
end
end
end -->Initialize
function Update()
rand = math.random(1, #Quotes)
SKIN:Bang('!SetOption', 'MeterQuote', 'Text', Quotes[rand])
SKIN:Bang('!SetOption', 'MeterAuthor', 'Text', Authors[rand])
return 'Quote number: '..rand
end -->Update
So this is where I am at right now with this problem. Any help given is appreciated.
You do not have the required permissions to view the files attached to this post.