Advertisement
Guest User

transmit.lua

a guest
Apr 5th, 2020
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. tape = peripheral.wrap("bottom")
  2. modem = peripheral.wrap("left")
  3.  
  4. tape.seek(-tape.getPosition())
  5.  
  6. singleBlankByte = string.char(170)
  7. blankChunk = string.char(170)
  8. for i=1,250 do
  9.     blankChunk = blankChunk .. singleBlankByte
  10. end
  11. blankMessage = {}
  12. for i=1,60 do
  13.     blankMessage[i] = singleBlankByte
  14.     os.queueEvent("randomEvent")
  15.     os.pullEvent()
  16. end
  17.  
  18. --while true do
  19. --    time = os.time()
  20. --    if time%0.1 == 0 then
  21. --        print("Time satisfied")
  22. --        os.sleep(1)
  23. --        break
  24. --    end
  25. --end
  26.  
  27. while true do
  28.     os.startTimer(2.5)
  29.     rs.setOutput("right",true)
  30.     os.sleep(0.5)
  31.     rs.setOutput("right",false)
  32.     chonker = {}
  33.     if tape.isReady() then
  34.         print("Tape drive full, transmitting contents")
  35.         for i=1,60 do
  36.             chonker[i] = tape.read(250)
  37.         end
  38.     else
  39.         --print("Tape drive empty, transmitting blank")
  40.         --chonker = blankMessage
  41.     end
  42.     os.pullEvent("timer")
  43.     if tape.isReady() then
  44.         modem.transmit(1337,1338,chonker)
  45.     end
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement