Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- output = 0
- rednet.open('left')
- while true do
- -- get our message
- local sender, msg, dist = rednet.receive()
- if sender == 45 and #msg == 2 then
- -- get the first part of our message and convert it from hex (base16) to decimal (base10)
- local num = tonumber(msg:sub(1,1), 16)
- -- if it was not hexadecimal
- if num then
- -- decide which function we should use based on if the second character is a t (for true)
- action = (msg:sub(2,2) == 't') and colors.combine or colors.subtract
- -- call out action with the current output and the one we just got
- output = action(output, 2 ^ num)
- -- everything is valid now lets output
- rs.setBundledOutput('back', output)
- end
- end
- end
- rednet.close('left')f
Advertisement
Add Comment
Please, Sign In to add comment