Guest User

Untitled

a guest
Jul 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.88 KB | None | 0 0
  1. function scrollDown(plc, mx, num)
  2.  plc[num] = 0
  3.  if num < mx then
  4.   num = num + 1
  5.  end
  6.  plc[num] = 1
  7.  return num
  8. end
  9.  
  10. function scrollUp(plc, mx, num)
  11.  plc[num] = 0
  12.  if num > 1 then
  13.   num = num - 1
  14.  end
  15.  plc[num] = 1
  16.  return num
  17. end
  18.  
  19. function draw(plc, mx, lst)
  20.  term.clear()
  21.  
  22.  term.setCursorPos(1, 1)
  23.  term.write("=====================OSX=========================")
  24.  --Insert all other draws here
  25.  
  26.  i = 1
  27.  
  28.  while i <= mx do
  29.   term.setCursorPos(2, (i + 3))
  30.   term.write(lst[i])
  31.   if plc[i] == 1 then
  32.    term.write(" <<<")
  33.   end
  34.   i = i + 1
  35.  end
  36. end
  37.  
  38. a = {1, 0, 0, 0}
  39. list = {"Programs", "Fari", "About", "Quit"}
  40. max = 4
  41. arrow = 1
  42.  
  43. while true do
  44.  draw(a, max, list)
  45.  
  46.  e, r = os.pullEvent()
  47.  
  48.  if r == "w" then
  49.   arrow = scrollUp(a, max, arrow)
  50.  end
  51.  
  52.  if r == "s" then
  53.   arrow = scrollDown(a, max, arrow)
  54.  end
  55.  
  56.  if r == 28 then
  57.  
  58.  end
  59.  
  60. end
Add Comment
Please, Sign In to add comment