17.08.2015, 15:58
(This post was last modified: 17.08.2015, 16:00 by Sandstrand.
Edit Reason: *spelling
)
This is a perfect use case for TAGS in LogicMachine
For every window you have assign a tag to it, then set a resident script that checks the tags and performs some logic on it.
example:
The above scripts checks every n seconds boolean group adresses with the tag ABC, then sets 1/1/1 to true if one of the tags are true.
No need to create a huge script with declarations for each and every group address, just tag the object and this will fix it.
There are most likely other ways to do this, but I'm still learning LUA and would love to see other implementations![Smile Smile](https://forum.logicmachine.net/images/smilies/smile.png)
Added bonus here is that you also get a count of how many windows that are open.
For every window you have assign a tag to it, then set a resident script that checks the tags and performs some logic on it.
example:
Code:
myobjects = grp.tag('ABC')
myobject = '1/1/1'
a = 0
for index, value in ipairs(myobjects) do
if (value.data) then
a = a + 1
end
end
if (a > 0) then
grp.write(myobject, true, dt.bool)
else
grp.write(myobject, false, dt.bool)
end
The above scripts checks every n seconds boolean group adresses with the tag ABC, then sets 1/1/1 to true if one of the tags are true.
No need to create a huge script with declarations for each and every group address, just tag the object and this will fix it.
There are most likely other ways to do this, but I'm still learning LUA and would love to see other implementations
![Smile Smile](https://forum.logicmachine.net/images/smilies/smile.png)
Added bonus here is that you also get a count of how many windows that are open.