11.11.2024, 20:42
(This post was last modified: 11.11.2024, 20:43 by Rauschentofft.)
I have made 3 virtual group addresses named button 1-3 starting with 32/1/1-32/1/3.
Then i have 3 virtual addresses called Light 1-3 starting with 32/1/4-32/1/6.
My virtual trigger button has address 32/1/10 and the event script in it.
My function i´ll trying to achive is:
If any of the buttons true then and my trigger button is true then i should write
button 1 value to Light 1 and etc, etc.
Nothing happens when i run the script, no errors and i can log the value from buttons.
My script:
buttons_objects = grp.tag({'Lights_On'}, 'any')
light_objects = grp.tag({'Light'}, 'any')
base_address = "32/1/4" -- This is the address for the first light
for index, button in ipairs(buttons_objects) do
if button.data == 1 then
local light_address = string.format("32/1/%d", 4 + index) -- increment starting from 4
grp.write(light_address, 1)
end
end
//MR
Then i have 3 virtual addresses called Light 1-3 starting with 32/1/4-32/1/6.
My virtual trigger button has address 32/1/10 and the event script in it.
My function i´ll trying to achive is:
If any of the buttons true then and my trigger button is true then i should write
button 1 value to Light 1 and etc, etc.
Nothing happens when i run the script, no errors and i can log the value from buttons.
My script:
buttons_objects = grp.tag({'Lights_On'}, 'any')
light_objects = grp.tag({'Light'}, 'any')
base_address = "32/1/4" -- This is the address for the first light
for index, button in ipairs(buttons_objects) do
if button.data == 1 then
local light_address = string.format("32/1/%d", 4 + index) -- increment starting from 4
grp.write(light_address, 1)
end
end
//MR