21.09.2018, 10:04
Use this event script to get specific bits from an integer value. Make sure to create bit objects manually before running it.
Code:
function getbit(value, nr)
value = bit.rshift(value, nr)
return bit.band(value, 1) == 1
end
value = event.getvalue()
grp.checkupdate('1/1/1', getbit(value, 0))
grp.checkupdate('1/1/2', getbit(value, 1))
grp.checkupdate('1/1/3', getbit(value, 2))
grp.checkupdate('1/1/4', getbit(value, 3))
grp.checkupdate('1/1/5', getbit(value, 4))
grp.checkupdate('1/1/6', getbit(value, 5))