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.

Or logic gate
#1
Hi. I have 5 1bit inputs and I want a logic or gate that converts the output to byte. 
False = 0%
True =100%
How will the code look like?
Reply
#2
Add or_gate tag to each input object. Add an event script mapped to or_gate tag. Change 32/1/4 to your output object address.

Code:
value = false

objects = grp.tag('or_gate')
for _, object in ipairs(objects) do
  value = value or object.value
end

grp.checkwrite('32/1/4', value and 100 or 0)
Reply


Forum Jump: