[Variables]
;Tween goes from 0 to 1 through lua but you can emulate using action timer if want to
Tween=0
XC=(140-(20*[#Tween])*cos(rad(([#Tween]*360/3)+[&Str:MtrIndx('[#*CURRENTSECTION*]')]*360/3)))
YC=(140-(20*[#Tween])*sin(rad(([#Tween]*360/3)+[&Str:MtrIndx('[#*CURRENTSECTION]*')]*360/3)))
[Shape1]
Meter=Shape
Shape=Ellipse #XC#,#YC#,20,20
Now if I only use XC as a variable and hard code the YC value in Ellipse, it works fine, but if I use both as variables, it doesn't work.
function SectionIndex(section, occurrence, formula)
local indexes = {}
for index in section:gmatch('%d+') do table.insert(indexes, index) end
if occurrence == 'first' then occurrence = 1 elseif occurrence == 'last' then occurrence = #indexes end
return tostring(SKIN:ParseFormula(string.gsub(formula, '<x>', tostring(indexes[tonumber(occurrence)] or '0')))) or '0'
end
function MtrIndx(k)
local a = string.gsub(k, '^%D+(%d+)$', '%1')
a = tonumber(a)
return a-1
end
-- function SectionIndex(section, occurrence, formula)
-- local indexes = {}
-- for index in section:gmatch('%d+') do table.insert(indexes, index) end
-- if occurrence == 'first' then occurrence = 1 elseif occurrence == 'last' then occurrence = #indexes end
-- return tostring(SKIN:ParseFormula(string.gsub(formula, '<x>', tostring(indexes[tonumber(occurrence)] or '0')))) or '0'
-- end
[Variables]
;Tween goes from 0 to 1 through lua but you can emulate using action timer if want to
Tween=0
XC=(140-(20*[#Tween])*cos(rad(([#Tween]*360/3)+[&Script:MtrIndx('[#*CURRENTSECTION*]')]*360/3)))
YC=(140-(20*[#Tween])*sin(rad(([#Tween]*360/3)+[&Script:MtrIndx('[#*CURRENTSECTION*]')]*360/3)))
; XC=(140-(20*[#Tween])*cos(rad(([#Tween]*360/3)+[&Script:SectionIndex('[#*CURRENTSECTION*]','last','(<x>-1)')]*360/3)))
; YC=(140-(20*[#Tween])*sin(rad(([#Tween]*360/3)+[&Script:SectionIndex('[#*CURRENTSECTION*]','last','(<x>-1)')]*360/3)))
[Script]
Measure=Script
ScriptFile=#@#Scripts\Script.lua
UpdateDivider=-1
DynamicVariables=1
[Shape1]
Meter=Shape
Shape=Ellipse #XC#,#YC#,20,20
DynamicVariables=1
Just switch/swap comments in both the script (function vs function) and the skin (XC & YC pair vs XC & YC pair) to compare the results from his implementation vs mine.
That, if I correctly understood what he wanted to do and accurately replicated his code...
EDIT: It was my mistake earlier, both codes work - edited my rushed reply accordingly. I forgot to change death.crafter's Script measure name to Script instead of Str, so that both scripts can run properly on switching/swapping the comments.