Advertisement
JaMaNi133

Computer bundle remote

Nov 1st, 2023 (edited)
867
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. rednet.open("bottom")
  2. local outport = 0
  3. print(os.getComputerID())
  4.  
  5.    
  6. function setVal(mask,val)
  7.     local maskVal = mask * val
  8.     local maskedCurrent = bit.band(bit.bnot(mask),outport)
  9.     outport = maskVal + maskedCurrent
  10. end
  11.  
  12. while true do
  13.     local event, dist, message = os.pullEvent("rednet_message")
  14.     setVal(bit.band(message,65535),bit.band(message,65536)/65536)
  15.     print(string.format("msg : %d   b16 1: %d   b16 1 + 1: %d",message,bit.band(message,65535),bit.band(message,65536)/65536))
  16.     redstone.setBundledOutput("top",outport)
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement