Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon1 = term
- local mon2 = term
- --local mon1 = peripheral.wrap("front")
- --local mon2 = peripheral.wrap("back")
- local x, y = mon1.getSize()
- local text = ""
- local tpsNo = 20
- --### useful functions ###--
- function getSeconds()
- text=http.get("http://www.simmi.ovh/date.txt").readAll()
- local seconds = tonumber(string.sub(text,7,8))
- print("Time get: "..text)
- print("Seconds: "..seconds)
- return seconds
- end
- function monitorWrite(xPos, yPos, fColor, bColor, text)
- mon1.setCursorPos(xPos,yPos)
- mon1.setTextColor(fColor)
- mon1.setBackgroundColor(bColor)
- mon1.write(text)
- mon2.setCursorPos(xPos,yPos)
- mon2.setTextColor(fColor)
- mon2.setBackgroundColor(bColor)
- mon2.write(text)
- end
- function drawBackground()
- mon.setBackgroundColor(colors.lightGray)
- for i=1,y do
- mon.setCursorPos(1,i)
- for j=1,x do
- mon.write(" ")
- end
- end
- end
- --### time function ### --
- function time()
- while true do
- monitorWrite(math.floor(x/2)-math.floor(9/2), 1, colors.yellow, colors.blue, "TPS-o-Mat")
- getSeconds()
- monitorWrite(3, 3, colors.blue, colors.lightGray, "Time: ")
- monitorWrite(x-#text, 3, colors.blue, colors.lightGray, text)
- monitorWrite(3, 5, colors.blue, colors.lightGray, "TPS: ")
- local color, position
- if tpsNo<10 then color = colors.red elseif tpsNo<15 then color = colors.orange else color = colors.green end
- if tpsNo<10 then position = x-1 else position = x-2 end
- monitorWrite(x-#tpsNp, 3, color, colors.lightGray, text)
- sleep(1)
- print("TPS: "..tpsNo)
- end
- end
- --### tps function ### --
- function tps()
- while true do
- local vorher = getSeconds()
- sleep(10)
- local nachher = getSeconds()
- local timeChange = 0
- if nachher<vorher then timeChange = nachher-vorher+60 else timeChange = nachher-vorher end
- tpsNo = 20.5*(10/timeChange)
- end
- end
- parallel.waitForAll(tps(),time())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement