This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

What have i done wrong?
#1
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
Reply


Messages In This Thread
What have i done wrong? - by Rauschentofft - 11.11.2024, 20:42
RE: What have i done wrong? - by admin - 12.11.2024, 06:19
RE: What have i done wrong? - by JMemphix - 12.11.2024, 08:17

Forum Jump: