Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local C1, C2, C3, C4, C5, C6, C7, C8 = 96, 97, 99, 100, 101, 102, 103, 104
- local C1v, C2v, C3v, C4v, C5v, C6v, C7v, C8v = "No Data", "No Data", "No Data", "No Data", "No Data", "No Data", "No Data", "No Data"
- local compID, value, distance = "No Data", "No Data", "No Data"
- local m = peripheral.wrap("back")
- function white()
- term.setTextColor(colors.white)
- end
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function netClose()
- rednet.close("right")
- end
- function netOpen()
- netClose()
- rednet.open("right")
- end
- function getData()
- compID, value, distance = rednet.receive()
- end
- function assignData()
- netOpen()
- getData()
- if compID == C1 then
- C1v = value
- elseif compID == C2 then
- C2v = value
- elseif compID == C3 then
- C3v = value
- elseif compID == C4 then
- C4v = value
- elseif compID == C5 then
- C5v = value
- elseif compID == C6 then
- C6v = value
- elseif compID == C7 then
- C7v = value
- elseif compID == C8 then
- C8v = value
- end
- end
- while true do
- assignData()
- term.redirect(m)
- clear()
- term.setTextColor(colors.lightBlue)
- print("Charging Station Status:") print("________________________")
- term.setTextColor(colors.white)
- print("")
- term.write("Station 1: ")
- if C1v == "Charging" then term.setTextColor(colors.red)
- elseif C1v == "Full" then term.setTextColor(colors.lime)
- elseif C1v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C1v)
- white()
- term.write("Station 2: ")
- if C2v == "Charging" then term.setTextColor(colors.red)
- elseif C2v == "Full" then term.setTextColor(colors.lime)
- elseif C2v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C2v)
- white()
- term.write("Station 3: ")
- if C3v == "Charging" then term.setTextColor(colors.red)
- elseif C3v == "Full" then term.setTextColor(colors.lime)
- elseif C3v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C3v)
- white()
- term.write("Station 4: ")
- if C4v == "Charging" then term.setTextColor(colors.red)
- elseif C4v == "Full" then term.setTextColor(colors.lime)
- elseif C4v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C4v)
- white()
- term.write("Station 5: ")
- if C5v == "Charging" then term.setTextColor(colors.red)
- elseif C5v == "Full" then term.setTextColor(colors.lime)
- elseif C5v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C5v)
- white()
- term.write("Station 6: ")
- if C6v == "Charging" then term.setTextColor(colors.red)
- elseif C6v == "Full" then term.setTextColor(colors.lime)
- elseif C6v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C6v)
- white()
- term.write("Station 7: ")
- if C7v == "Charging" then term.setTextColor(colors.red)
- elseif C7v == "Full" then term.setTextColor(colors.lime)
- elseif C7v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C7v)
- white()
- term.write("Station 8: ")
- if C8v == "Charging" then term.setTextColor(colors.red)
- elseif C8v == "Full" then term.setTextColor(colors.lime)
- elseif C8v == "Absent" then term.setTextColor(colors.orange)
- else term.setTextColor(colors.lightGray) end
- print(C8v)
- white()
- term.restore()
- end
Advertisement
Add Comment
Please, Sign In to add comment