Advertisement
FNCxPro

Untitled

Nov 6th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.22 KB | None | 0 0
  1. local list1 = "CraftOS"
  2. local list1selected = true
  3. local list2 = "Reboot"
  4. local list2selected = false
  5. local list3 = "Shutdown"
  6. local list3selected = false
  7.  
  8. function redraw()
  9.  term.setBackgroundColor(colors.white)
  10.  term.setTextColor(colors.blue)
  11.  term.clear()
  12.  term.setCursorPos(1,1)
  13.  print("ComputerCraft Universal Bootloader")
  14.  term.setCursorPos(1,3)
  15. end
  16.  
  17. function countdown(startval)
  18.  for i = 1, startval, -1 do
  19.   term.clear()
  20.   redraw()
  21.   print("Computer is automatically starting in "..i)
  22.  end
  23. end
  24.  
  25. function rawread()
  26.   while true do
  27.   local sEvent, param = os.pullEvent("key")
  28.   if sEvent == "key" then
  29.    if param == 208 then
  30.     if list1selected == true then
  31.      term.clear()
  32.      redraw()
  33.      list2selected = true
  34.      list1selected = false
  35.     elseif list2selected == true then
  36.      term.clear()
  37.      redraw()
  38.      list1selected = true
  39.      list2selected = false
  40.     end
  41.    elseif param == 200 then
  42.     if list2selected == true then
  43.    
  44.      term.clear()
  45.      redraw()
  46.      list2selected = false
  47.      list1selected = true
  48.      
  49.    elseif list3selected == true then
  50.    
  51.     term.clear()
  52.     redraw()
  53.     list3selected = false
  54.     list2selected = true
  55.    
  56.    elseif param == 28 then
  57.     if list1selected == true then
  58.    
  59.      term.clear()
  60.      shell.run("shell")
  61.     elseif list2selected == true then
  62.      
  63.      os.reboot()
  64.      
  65.     elseif list3selected == true then
  66.      os.shutdown()
  67.      
  68.     end
  69.    end
  70.  end
  71. end
  72.  
  73.  
  74.    if list1selected == true then
  75.      term.clear()
  76.      redraw()
  77.      term.setBackgroundColor(128)
  78.      print(list1)
  79.      term.setBackgroundColor(256)
  80.      print(list2)
  81.      print(list3)
  82.      elseif list2selected == true then
  83.         term.clear()
  84.         redraw()
  85.         term.setBackgroundColor(256)
  86.         print(list1)
  87.         term.setBackgroundColor(128)
  88.         print(list2)
  89.         term.setBackgroundColor(256)
  90.         print(list3)
  91.             elseif list3selected == true then
  92.                 term.clear()
  93.                 redraw()
  94.                 term.setBackgroundColor(256)
  95.                 print(list1)
  96.                 print(list2)
  97.                 term.setBackgroundColor(128)
  98.                 print(list3)
  99.    end
  100. end
  101. end
  102.  
  103. rawread()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement