Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local MSG_CODE = 'm'
- -- Update this script
- fs.delete( "startup-update" )
- shell.run( "pastebin get DUv0cGQv startup-update" )
- if fs.exists( "startup-update" ) then
- fs.delete( "startup" )
- fs.move( "startup-update", "startup" )
- print( "Startup program updated!\n" )
- end
- local id, msg
- local lbl = os.getComputerLabel()
- local rec_id = tonumber(string.sub(lbl,4,lbl:len()))
- print("Listening for position: ", rec_id)
- rec_id = rec_id + 1
- rednet.open("top")
- while true do
- id, msg = rednet.receive(nil,5)
- if (id == nil or string.sub(msg,1,1) ~= MSG_CODE) then
- -- Ignore
- elseif (string.sub(msg,rec_id,rec_id) == '1') then
- redstone.setOutput("back", true)
- else
- redstone.setOutput("back", false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment