tomtrein

Untitled

Aug 1st, 2016
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. p=0
  2. scroll = function()
  3. local event, scrollDirection, x, y = os.pullEvent("mouse_scroll")
  4. p = p+scrollDirection
  5. term.setCursorPos(1, 5)
  6. term.write(tostring(i))
  7. drawjobs(p)
  8. end
  9.  
  10. drawjobs = function(start)
  11. term.clear()
  12. for i=1, 19 do
  13. term.setCursorPos(1, i)
  14. curjob = jobs[start+i]
  15. if curjob then
  16. code = curjob:sub(1, 10)
  17. codes[start+i] = code
  18. text = curjob:sub(11, #curjob)
  19. term.write(text)
  20. else
  21. break
  22. end
  23. end
  24. end
  25.  
  26.  
  27.  
  28. file = fs.open("job", "r")
  29. jobs = {}
  30. codes = {}
  31. while true do
  32. line = file.readLine()
  33. if line then
  34. table.insert(jobs, line)
  35. else
  36. break
  37. end
  38. end
  39. drawjobs(0)
  40. while true do
  41. parallel.waitForAny(scroll())
  42. parallel.waitForAny(scroll())
  43. end
Advertisement
Add Comment
Please, Sign In to add comment