What have i done wrong? - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: What have i done wrong? (/showthread.php?tid=5734) |
What have i done wrong? - Rauschentofft - 11.11.2024 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 RE: What have i done wrong? - admin - 12.11.2024 Use true/false instead of 1/0 for booleans. RE: What have i done wrong? - JMemphix - 12.11.2024 Putting Log(variable_name1, variable_name2) etc is great to verify whats happening. Then just click the Logs button when in the script editor. RE: What have i done wrong? - Erwin van der Zwart - 12.11.2024 Use lowercase log(…) RE: What have i done wrong? - Rauschentofft - 12.11.2024 Thank you very much Erewin for your help. |