Advertisement
Plazter

api

Sep 9th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. -- REDNET API --
  2. -- For personal use in ComputerCraft --
  3. -- You are welcome to download it and add to it --
  4. -- Plazter --
  5. -- there are commented out some of the auto, a comment that is, you can outcomment it again if u want the info--
  6. --2013--
  7.  
  8. -- Clear setting --
  9. term.clear()
  10. term.setCursorPos(1,1)
  11. -- Settings ended --
  12.  
  13.  
  14. -- simple shortcuts --
  15. open = rednet.open
  16. close = rednet.close
  17. cast = rednet.broadcast
  18. send = rednet.send
  19. output = rs.setOutput
  20. input = rs.getInput
  21. -- end of shortcuts --
  22.  
  23. -- functions --
  24.  
  25.  
  26. function center(text)
  27.     local x,y = mon.getSize()
  28.     local x2,y2 = mon.getCursorPos()
  29.    
  30.     mon.setCursorPos(math.ceil((x/2) - (text:len() / 2)),y2)
  31.     mon.write(text)
  32.  
  33.     end
  34.  
  35. function autoMon()
  36.     for a,b in pairs(rs.getSides()) do
  37.         if peripheral.getType(b) == 'monitor' then
  38.             mon = peripheral.wrap(b)
  39.             print("Wrapped Monitor on: ".. b)
  40.             break
  41.          end
  42.     end
  43. end
  44.  
  45. function autoModem()
  46.     for a,b in pairs(rs.getSides()) do
  47.          if peripheral.getType(b) == 'modem' then
  48.              rednet.open(b)
  49.             --print("Wrapped Modem on: ".. b)
  50.               break
  51.         end
  52.     end
  53. end
  54.  
  55. function rec()
  56.     local id, msg, dist = rednet.receive()
  57. end
  58.  
  59. function drive()
  60.     for a,b in pairs(rs.getSides()) do
  61.          if peripheral.wrap(b) == 'drive' then
  62.              drive = peripheral.wrap(b)
  63.              -- print("Wrapped Drive on: ".. b)  
  64.              break
  65.          end
  66.     end
  67. end
  68.  
  69. function clear()
  70.      term.clear()
  71.      term.setCursorPos(1,1)
  72. end
  73.  
  74. -- end of functions --
  75.  
  76.  
  77. print("ComputerID is: ".. os.getComputerID())
  78. print("Api loaded succesfull!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement