Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i = require("internet")
- os = require("os")
- term = require("term")
- com = require("component")
- event = require("event")
- url = 'https://allremind.ru/roga/'
- dataRaw = ""
- tableScore = ""
- prog = true
- clearMon = false
- w,h = com.gpu.getResolution()
- crop = 0.25
- ww = 38
- hh = 15
- com.gpu.setResolution(ww, hh)
- function internetRequest(url)
- local success, response = pcall(com.internet.request, url)
- if success then
- local responseData = ""
- while true do
- local data, responseChunk = response.read()
- if data then
- responseData = responseData .. data
- else
- if responseChunk then
- return false
- else
- return responseData
- end
- end
- end
- else
- return false
- end
- end
- btn = {
- {
- x = ww-2,
- y = 1,
- action = function()
- event.ignore("touch", touch)
- prog = false
- clearMon = true
- end;
- }
- }
- function touch(_,_, x, y)
- for i = 1, #btn do
- if x == btn[i].x and y == btn[i].y or x >= btn[i].x + 1 and x < btn[i].x + 3 and y == btn[i].y then
- btn[i].action()
- break
- end;
- end;
- end;
- while prog == true do
- event.listen("touch", touch)
- os.sleep(2)
- dataRaw = internetRequest(url)
- if (dataRaw) then
- tableScore = dataRaw
- else
- tableScore = '\r\n\r\nИдёт получение данных...'
- end;
- if tableScore ~= txt then
- term.clear()
- term.setCursor(1,1)
- com.gpu.setForeground(0x000080)
- com.gpu.fill(1, 1, ww, 1, '█')
- com.gpu.setForeground(0xff0000)
- com.gpu.fill(ww-2, 1, 3, 1, '█')
- term.setCursor(ww-1,1)
- com.gpu.setBackground(0xff0000)
- com.gpu.setForeground(0xffffff)
- print("X")
- term.setCursor(1,1)
- com.gpu.setBackground(0x000080)
- print("ТАБЛИЦА РЕЗУЛЬТАТОВ SPLEEF НОЯБРЬ")
- term.setCursor(1,2)
- com.gpu.setBackground(0x000000)
- print(tableScore)
- end;
- txt = tableScore
- tableScore = ""
- if clearMon == true then
- term.setCursor(1, 1)
- term.clear()
- com.gpu.setBackground(0x000000)
- com.gpu.setForeground(0x000000)
- com.gpu.setResolution(w, h)
- com.gpu.fill(1, 1, w, h, '█')
- com.gpu.setForeground(0xFFFFFF)
- com.gpu.setBackground(0x000000)
- print("Выход...")
- end;
- end;
Add Comment
Please, Sign In to add comment