Percentage Display (CMS)
From The Official Visionaire Studio: Adventure Game Engine Wiki
* to do *
Main Script
-- to do...
function setPerc(val)
if string.len(val) < 3 then -- check digit value less than 3 & if so, hide the invalid digits
for i = (string.len(val) + 1), 3 do -- actual digit value (+1) to max digit value
getObject("ActiveAnimations[percVal_" .. i .. "]"):setValue(VAnimationFirstFrame, 11) -- blank animation frame
getObject("ActiveAnimations[percVal_" .. i .. "]"):setValue(VAnimationLastFrame, 11) -- blank animation frame
end
end
for i = 1, string.len(val) do -- set the frame value to match the digit number
getObject("ActiveAnimations[percVal_" .. i .. "]"):setValue(VAnimationFirstFrame, string.sub(val, i, i) + 1) -- set animation frame to digit value (+1)
getObject("ActiveAnimations[percVal_" .. i .. "]"):setValue(VAnimationLastFrame, string.sub(val, i, i) + 1) -- set animation frame to digit value (+1)
end
end