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.

Logic script
#5
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: 

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

Added bonus here is that you also get a count of how many windows that are open.
Reply


Messages In This Thread
Logic script - by tlandeka - 13.08.2015, 10:42
RE: Logic script - by Pawel - 13.08.2015, 19:04
RE: Logic script - by tlandeka - 14.08.2015, 13:18
RE: Logic script - by gtsamis - 14.08.2015, 23:31
RE: Logic script - by Sandstrand - 17.08.2015, 15:58
RE: Logic script - by admin - 18.08.2015, 06:04
RE: Logic script - by Sandstrand - 18.08.2015, 09:25
RE: Logic script - by admin - 18.08.2015, 10:17

Forum Jump: