Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i=0
- jobsmin = 0
- scroll = function()
- local event, scrollDirection, x, y = os.pullEvent("mouse_scroll")
- term.clear()
- i = i+scrollDirection
- if i==-1 then
- i=0
- elseif i>jobsmin then
- i=jobsmin
- end
- for Py = 1, 19 do
- term.setCursorPos(1, Py)
- towriteid = i + Py
- if towriteid > #jobs then
- break
- end
- towrite = jobs[towriteid]
- term.write(towrite)
- end
- end
- click = function()
- local event, button, x, y = os.pullEvent( "mouse_click" )
- thejobcodeid = y + i
- thejobcode = codes[thejobcodeid]
- print(thejobcode)
- print(thejobcodeid)
- seejob(thejobcode)
- end
- seejob = function(thecodeid)
- local http1 = http.get("http://www.hastebin.com/raw/"..thecodeid)
- local http2 = http1.readAll()
- shell.run("delete", "message")
- local file = fs.open("message", "w")
- file.write(http2)
- file.close()
- local file = fs.open("message", "r")
- filename = file.readLine()
- term.clear()
- for i=1, 19 do
- line = file.readLine()
- term.setCursorPos(1, i)
- if line then
- term.write(line)
- end
- end
- end
- file = fs.open("job", "r")
- jobs = {}
- codes = {}
- while true do
- line = file.readLine()
- if line then
- table.insert(jobs, line:sub(11, #line))
- table.insert(codes, line:sub(1, 10))
- else
- break
- end
- end
- jobsmin = #jobs-1
- while true do
- parallel.waitForAny(scroll, click)
- end
Advertisement
Add Comment
Please, Sign In to add comment