s = HC.GetCurrentSelectionSet(',')
-- find the max value
newhigh = 0
for fixture in string.gmatch(s,"%d+") do
if tonumber(HC.AttributeGetValue(fixture)) > newhigh then
newhigh = tonumber(HC.AttributeGetValue(fixture))
end
end
-- flip flop
for fixture in string.gmatch(s,"%d+") do
if tonumber(HC.AttributeGetValue(fixture)) > 0 then
HC.SetLevel(fixture,0)
else
HC.SetLevel(fixture,math.floor(2.55*newhigh))
end
end

Re: (LUA) FlipFlop levels

Posted: Mon Aug 03, 2009 10:10 am

by gooze

10.6.2001 I get an error while testing the script in the editor.

Re: (LUA) FlipFlop levels

Posted: Tue Aug 04, 2009 4:54 pm

by RobertBell

The error text would help here, but I figured it out - same as your other issue (I just posted):

s = HC.GetCurrentSelectionSet(',')
-- find the max value
newhigh = 0
for fixture in string.gmatch(s,"%d+") do
if tonumber(HC.AttributeGetValue(fixture,'intensity+V')) > newhigh then
newhigh = tonumber(HC.AttributeGetValue(fixture,'intensity+V'))
end
end
-- flip flop
for fixture in string.gmatch(s,"%d+") do
if tonumber(HC.AttributeGetValue(fixture,'intensity+V')) > 0 then
HC.SetLevel(fixture,0)
else
HC.SetLevel(fixture,math.floor(2.55*newhigh))
end
end

Re: (LUA) FlipFlop levels

s = HC.GetCurrentSelectionSet(',')
-- find the max value
newhigh = 0
for fixture in string.gmatch(s,"%d+") do
if tonumber(HC.AttributeGetValue(fixture,'intensity+V')) > newhigh then
newhigh = tonumber(HC.AttributeGetValue(fixture,'intensity+V'))
end
end
-- flip flop
for fixture in string.gmatch(s,"%d+") do
if tonumber(HC.AttributeGetValue(fixture,'intensity+V')) > 0 then
HC.AttributeFade(fixture,0)
else
HC.AttributeFade(fixture,newhigh)
end
end