Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i=0
- jobsmin = 0
- scroll = function()
- 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
- 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
- end
- click = function()
- local event, button, x, y = os.pullEvent( "mouse_click" )
- thejobcodeid = y + i
- thejobcode = codes[thejobcodeid]
- print(thejobcode)
- print(thejobcodeid)
- seejob(thejobcode, jobs[thejobcodeid])
- end
- seejob = function(thecodeid, jobname)
- 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
- while true do
- local event, button, x, y = os.pullEvent( "mouse_click" )
- if y == 19 then
- newfile = fs.open(filename, "a")
- newfile.writeLine(jobname)
- term.clear()
- term.setCursorPos(10, 10)
- term.write("Your name: ")
- term.clear()
- term.setCursorPos(10, 10)
- term.write("username: ")
- username = read()
- passfile = fs.open(username.."pass", "r")
- thepass = passfile.readLine()
- passfile.close()
- term.clear()
- term.setCursorPos(10, 10)
- term.write("password: ")
- password = read()
- os.loadAPI("crypt")
- password = crypt.run(password, password)
- if password == thepass then
- newfile.writeLine(username)
- newfile.close()
- end
- else
- break
- 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