* to do *

Dieses Skript stammt aus meinem Lautstärkeregelungsskript (das ich noch nicht zum Wiki hinzugefügt habe). Im Wesentlichen zählt es die Anzahl der Zeichen in val und teilt dann jedes Zeichen (Anzahl) in eine separate Animation auf, deren Zahl (0 bis 9) bestimmt, welcher Frame für jede Animation aktiv sein soll; Wenn der Wert kleiner als 3 oder 2 ist, wird die Animation automatisch auf das letzte Bild gesetzt, das ein leeres Bild enthalten sollte, das zum Ausblenden der Animation/Ziffer auf dem Bildschirm verwendet wird. Für alle, die es bemerkt haben: die Highscore-Skript ist eigentlich eine modifizierte Version dieses Skripts.


Hauptskript

-- 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