Advertisement
Bloffel

Untitled

Feb 26th, 2015
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. monitor = peripheral.wrap("right")
  2. monitor.clear()
  3. monitor.setCursorPos(1, 1)
  4. monitor.setTextScale(1)
  5. rednet.close("back")
  6. rednet.open("back")
  7.  
  8. waitingForTurtle = true
  9. gpsBasement = 5
  10.  
  11. linePos = 2
  12.  
  13. jobAvailable = true
  14.  
  15. idTag = 1
  16.  
  17.  
  18.  
  19. function setSettings()
  20.  
  21. term.clear()
  22. term.setCursorPos(1,1)
  23. print("Terminal ID: "..os.computerID())
  24. print("Enter terminal ID for the Downstairs GPS Computer")
  25. gpsBasement = tonumber(read())
  26. local file = fs.open("Settings", "w")
  27. file.writeLine(gpsBasement)
  28. file.close()
  29. term.clear()
  30. term.setCursorPos(1,1)
  31. print("Terminal ID: "..os.computerID())
  32. end
  33.  
  34.  
  35.  
  36. function getSettings()
  37.  
  38. if not fs.exists("Settings") then
  39. setSettings()
  40. return
  41. end
  42.  
  43. local file = fs.open("Settings", "r")
  44. gpsBasement = (file.readLine())
  45. file.close()
  46.  
  47.  
  48. end
  49.  
  50.  
  51.  
  52. function start()
  53.  
  54. monitor.setCursorPos(1,1)
  55. monitor.clearLine()
  56. monitor.setTextColour(16)
  57. monitor.write("ID Status Location Fuel")
  58.  
  59.  
  60. while jobAvailable do
  61.  
  62. id, gpsString, dis = rednet.receive()
  63. recArray = {}
  64. sendString = (id.." "..gpsString)
  65. rednet.send(gpsBasement, sendString)
  66. sendString = (" ")
  67. for word in string.gmatch(gpsString, "([^%s]+)")do
  68. table.insert(recArray, word)
  69. end
  70.  
  71. idTag = tonumber(recArray[6])
  72. idDisplay = recArray[6]
  73.  
  74. linePos = idTag + 1
  75.  
  76. monitor.setCursorPos(1, linePos)
  77. monitor.clearLine()
  78. monitor.setTextColour(1)
  79. monitor.write(idDisplay)
  80. monitor.setCursorPos(7, linePos)
  81. if recArray[5] == "Home" then
  82. monitor.setTextColour(16384)
  83. end
  84.  
  85. if recArray[5] == "Transit" then
  86. monitor.setTextColour(2048)
  87. end
  88. if recArray[5] == "Onsite" then
  89. monitor.setTextColour(32)
  90. end
  91. monitor.write(recArray[5])
  92. monitor.setTextColour(1)
  93. monitor.setCursorPos(17, linePos)
  94. monitor.write("X: "..recArray[1])
  95. monitor.setCursorPos(25, linePos)
  96. monitor.write("Z: "..recArray[2])
  97. monitor.setCursorPos(33, linePos)
  98. monitor.write("Y: "..recArray[3])
  99. monitor.setCursorPos(41, linePos)
  100.  
  101. if tonumber(recArray[4]) < 400 then
  102. monitor.setTextColour(16384)
  103. end
  104. if tonumber(recArray[4]) > 400 then
  105. monitor.setTextColour(2)
  106. end
  107. if tonumber(recArray[4]) > 4500 then
  108. monitor.setTextColour(16)
  109. end
  110. if tonumber(recArray[4]) > 10000 then
  111. monitor.setTextColour(32)
  112. end
  113. monitor.write(recArray[4])
  114. recArray = {}
  115. sendString = {}
  116. end
  117. while not(jobAvailable) do
  118.  
  119.  
  120. end
  121.  
  122. end
  123.  
  124.  
  125. term.clear()
  126. term.setCursorPos(1,1)
  127. print("Terminal ID: "..os.computerID())
  128. getSettings()
  129. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement