10.11.2022, 12:49
You can use tables for this. If event value is 1 then value of 1/1/2 will be written to 1/1/1, if event value is 2 then value of 1/1/4 will be written to 1/1/3. For all other event values nothing will happen.
Code:
dstaddrs = { '1/1/1', '1/1/3' }
valaddrs = { '1/1/2', '1/1/4' }
index = event.getvalue()
dstaddr = dstaddrs[ index ]
if dstaddr then
value = grp.getvalue(valaddrs[ index ])
grp.write(dstaddr, value)
end