Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local comp_faces = {"Front","Back","Left","Right","Top","Bottom"}
- local mon = nil
- for i=1,#comp_faces do
- if peripheral.getType(string.lower(comp_faces[i])) == "monitor" then
- mon = peripheral.wrap( string.lower(comp_faces[i]))
- end
- end
- function getTime()
- http.request("http://alienmc.co/checkTPS.php")
- local requesting = true
- local valid = false
- local respondedText = ""
- while requesting do
- local event, url, sourceText = os.pullEvent()
- if event == "http_success" then
- respondedText = sourceText.readAll()
- valid = true
- requesting = false
- elseif event == "http_failure" then
- requesting = false
- end
- end
- return tonumber(string.match(respondedText,"(%d+).%d+")) +tonumber(string.match(respondedText,"%d+.(%d+)"))/10
- end
- while true do
- local currTick = getTime()
- if mon ~= nil then
- mon.clear()
- mon.setTextScale(2)
- mon.setTextColor(colors.white)
- local x,y = mon.getSize()
- mon.setCursorPos(x/2 - 3,y/2)
- mon.write("TPS: ")
- if currTick < 6 then
- mon.setTextColor(colors.red)
- elseif currTick >= 6 and currTick < 15 then
- mon.setTextColor(colors.yellow)
- else
- mon.setTextColor(colors.green)
- end
- mon.write(currTick)
- else
- print("TPS: "..currTick)
- end
- sleep(20)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement