Advertisement
Guest User

awsome

a guest
Jan 26th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. local function openRednet()
  2. local listOfSides = rs.getSides()
  3. local listofPossibles = {}
  4. local counter1 = 0
  5. while true do
  6. counter1 = counter1 +1
  7.  
  8. if peripheral.isPresent(tostring(listOfSides[counter1])) and peripheral.getType(listOfSides[counter1]) == "modem" then
  9. table.insert(listofPossibles,tostring(listOfSides[counter1]))
  10. end
  11.  
  12. if counter1 == 6 and table.maxn(listofPossibles) == 0 then
  13. print("no modem present")
  14. return nil
  15. end
  16.  
  17. if counter1 == 6 and table.maxn(listofPossibles) ~= 0 then
  18. rednet.open(listofPossibles[1])
  19. return listofPossibles[1]
  20. end
  21. end
  22. end
  23. modemOn = openRednet()
  24. if modemOn == nil then
  25. print("You are dumb (:")
  26. print("Will shutdown in 3 seconds")
  27. sleep(3)
  28. os.shutdown()
  29. else
  30. print("Opened modem on "..modemOn.." side")
  31. end
  32.  
  33. rednet.send(19, "request")
  34. id, message = rednet.receive()
  35. print ("Reactor Computer " .. id .. " answered")
  36. print ("-" .. message .. " ")
  37. i, m = rednet.receive()
  38. print ("-" .. m .. " ")
  39. id2, m2 = rednet.receive()
  40. print ("-" .. m2 .. " ")
  41. os.sleep(4)
  42. term.clear()
  43. term.setCursorPos(1,1)
  44. error()
  45.  
  46. -- This is some simple code i made to get information about a Big Reactor wireless using a Pocket computer.
  47. -- Place a computer with a wireless modem on the left side and the Computercraft Big Reactor port right behind it.
  48. -- UPDATE! you need to input the right computer IDs in both programs respectivly
  49. -- The Server computer program is at /AGq32UqZ
  50. -- Made by Dukrobber
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement