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.

Conference room with 2 partition walls
#2
There used to be a universal script but I can't find it.
Here's a working solution for any data type. Tag all input objects with the same tag and add an event script to it. Change group addresses as needed. You might need to remove two "not" statements before grp.getvalue depending on how open/closed status works. Right now it assumed that true means that the wall is closed.
Code:
inputs = { '32/1/1', '32/1/2', '32/1/3' }
status = { '32/1/7', '32/1/8' }
outputs = { '32/1/4', '32/1/5', '32/1/6' }

for i, addr in ipairs(inputs) do
  if addr == event.dst then
    index = i
  end
end

value = event.getvalue()

writes = {}
writes[ index ] = true

open12 = not grp.getvalue(status[ 1 ])
open23 = not grp.getvalue(status[ 2 ])

if index == 1 then
  if open12 then
    writes[ 2 ] = true
    writes[ 3 ] = open23
  end
elseif index == 2 then
  writes[ 1 ] = open12
  writes[ 3 ] = open23
elseif index == 3 then
  if open23 then
    writes[ 2 ] = true
    writes[ 1 ] = open12
  end
end

for i, addr in ipairs(outputs) do
  if writes[ i ] then
    grp.write(addr, value)
  end
end
Reply


Messages In This Thread
RE: Conference room with 2 partition walls - by admin - 11.05.2021, 08:02

Forum Jump: