05.04.2022, 06:31
Here's a universal solution that should work for any number of partition walls. Modify group addresses in the inputs, sensors and outputs tables as needed. All input objects should have a common tag to which this event script is attached.
Code:
inputs = {
'33/1/1',
'33/1/2',
'33/1/3',
'33/1/4',
'33/1/5',
}
sensors = {
'33/2/1',
'33/2/2',
'33/2/3',
'33/2/4',
}
outputs = {
'33/3/1',
'33/3/2',
'33/3/3',
'33/3/4',
'33/3/5',
}
value = event.getvalue()
for i, addr in ipairs(inputs) do
if addr == event.dst then
index = i
end
end
grp.write(outputs[ index ], value)
for i = index, #sensors do
if grp.getvalue(sensors[ i ]) then
break
end
grp.write(outputs[ i + 1 ], value)
end
for i = index - 1, 1, -1 do
if grp.getvalue(sensors[ i ]) then
break
end
grp.write(outputs[ i ], value)
end