Advertisement
blackrabt

BigReactors Monitor Pocket

Feb 28th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. wirelessSide = "back" --the pocket computer modem is always on the back
  2. local wireless = peripheral.wrap(wirelessSide)
  3. rednet.open(wirelessSide)
  4. print("Opened modem on "..wirelessSide.." side")
  5. wireless.open(65535) -- adding this channel will allow rednet repeaters to send the message farther
  6. rednet.send(9, "request") --put then ID of your reactor linked computer (the one running the server code) where 9 is.
  7. if rednet.receive(2) then --wait 2 seconds to get a reply from the reactor server or assume it is busy
  8.    id, message = rednet.receive()
  9.   print ("Reactor Computer " .. id .. " answered")
  10.   print ("-" .. message .. " ")
  11.   i, m = rednet.receive() --shouldn't this be id not i?
  12.   print ("-" .. m .. " ")
  13.   id2, m2 = rednet.receive()
  14.   print ("-" .. m2 .. " ")
  15.   os.sleep(3) --give the user 3 seconds to read the information before clearing and returning to the main shell
  16.   term.clear()
  17.   term.setCursorPos(1,1)
  18.   --error()
  19.   --os.reboot()
  20.   return
  21. else
  22.   print("The reactor was busy, please try again.")
  23.   sleep(1)
  24.   return
  25. end
  26. return
  27.  
  28.  
  29.  
  30. -- The Server computer program is at /AGq32UqZ
  31. -- Original code by Dukrobber
  32. -- Updates by blackrabt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement