23.05.2022, 10:06
(23.05.2022, 09:51)admin Wrote: Add to common functions:
Code:function rgbdim(config)
local red = grp.getvalue(config.in_red)
local green = grp.getvalue(config.in_green)
local blue = grp.getvalue(config.in_blue)
local level = grp.getvalue(config.in_level)
local max = math.max(1, red, green, blue)
local mult = level / max
red = math.round(red * mult)
green = math.round(green * mult)
blue = math.round(blue * mult)
grp.write(config.out_red, red, dt.scale)
grp.write(config.out_green, green, dt.scale)
grp.write(config.out_blue, blue, dt.scale)
end
Add a common tag to 4 input objects (red, green, blue, level) and attach event script to this tag. Change group addresses as needed. Make sure that output objects are not tagged with the same tag or you will get an infinite loop. All objects should have 1 byte scaled data type.
Code:rgbdim({
in_red = '32/1/12',
in_green = '32/1/13',
in_blue = '32/1/14',
in_level = '32/1/15',
out_red = '32/1/16',
out_green = '32/1/17',
out_blue = '32/1/18',
})
Incredible! Thank you so much!