I have a (probably simple) issue with the Lua script I'm writing for my skin. All it is right now is a black square .png image that I'm attempting to change the tint of. So I wrote this:
function Initialize()
sMeterToSetValue = SELF:GetOption('MeterToSetValue')
mtMeterToSetValue = SKIN:GetMeter(sMeterToSetValue)
SKIN:GetVariable('Alpha')
end
function Update()
iCurrentAlpha = tonumber(SKIN:GetVariable("Alpha"))
if iCurrentAlpha > 1 then
iNewAlpha = iCurrentAlpha - 1
else
iNewAlpha = iCurrentAlpha
end
SKIN:Bang('!SetVariable Alpha iNewAlpha')
return(iNewAlpha)
end
it runs through with no problems, except after the first time through, my Alpha changes to nil. From there it obviously can't fade the box anymore. Seems like my setVariable bang might be wrong from the log, or maybe I'm just forgetting something in my .ini . It's probably something simple I'm missing but I literally just started Lua today and I can't figure it out. It'd be great if someone could help me out, and thanks in advance.
Ah, that's it! I was following some older example code and got it confused. I will definitely go to the manual to make sure my syntax is right next time. Thanks!!! Now to make skins do neat things...