Advertisement
Guest User

Menu

a guest
May 26th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.44 KB | None | 0 0
  1. function run(pgrm)
  2.   shell.run(pgrm)
  3.  
  4. end
  5. function pos(x, y)
  6.   term.setCursorPos(x, y)
  7.  
  8. end
  9. function pixel(a, b, color)
  10.   paintutils.drawPixel(a, b, color)
  11.  
  12. end
  13. function background(color)
  14.   term.setBackgroundColor(color)
  15.  
  16. end
  17. function clear(x, y)
  18.   term.clear()
  19.   pos(x, y)
  20.  
  21. end
  22. function horLine(x, length, y)
  23.   for i=x, x+length-1, 1 do
  24.     pos(i, y)
  25.     print('-')
  26.    
  27.   end
  28.  
  29. end
  30. function vertLine(y, length, x)
  31.   for i=y, y+length-1, 1 do
  32.     pos(x, i)
  33.     print('|')
  34.    
  35.   end
  36.  
  37. end
  38. function findPeripheral( kind )
  39.   for _, v in pairs( rs.getSides() ) do
  40.         if peripheral.isPresent( v ) and peripheral.getType( v ) == kind then
  41.           return v
  42.         end
  43.   end
  44.   return nil
  45. end
  46.  
  47. run('cd /.aOS')
  48. clear(1, 1)
  49.  
  50. --List Of Stuff to do
  51.     pixel(51, 19, colors.red)
  52.     background(colors.black)
  53.     pos(1, 1)
  54.     print(' Shell                    | Shutdown')
  55.     pixel(1, 1, colors.lime)
  56.     pixel(28, 1, colors.red)
  57.     pos(1, 2)
  58.     background(colors.black)
  59.     print(' rReceive                 | Reboot')
  60.     pixel(1, 2, colors.lime)
  61.     pixel(28, 2, colors.red)
  62.     pos(1, 3)
  63.     background(colors.black)
  64.     print(' rSend                    | rLookupHost')
  65.     pixel(1, 3, colors.lime)
  66.     pixel(28, 3, colors.lime)
  67.     pos(1, 4)
  68.     background(colors.black)
  69.     print(' Lua                      | rLookupProtocol')
  70.     pixel(1, 4, colors.lime)
  71.     pixel(28, 4, colors.lime)
  72.     pos(1, 5)
  73.     background(colors.black)
  74.     print(' Edit                     | FTPSend')
  75.     pixel(1, 5, colors.lime)
  76.     pixel(28, 5, colors.lime)
  77.     pos(1, 6)
  78.     background(colors.black)
  79.     print(' FTPReceive               |')
  80.     pixel(1, 6, colors.lime)
  81.     pos(1, 7)
  82.     background(colors.black)
  83.  
  84. --Detect Click
  85.     local event, button, x, y = os.pullEvent('mouse_click')
  86.  
  87. --Do Stuff with Click
  88.     if x == 1 and y == 1 then
  89.         run('shell')
  90.    
  91.     elseif x == 28 and y == 1 then
  92.         os.shutdown()
  93.    
  94.     elseif x == 1 and y == 2 then
  95.         run('rReceive')
  96.    
  97.     elseif x == 28 and y == 2 then
  98.         os.reboot()
  99.    
  100.     elseif x == 1 and y == 3 then
  101.         run('rSend')
  102.    
  103.     elseif x == 28 and y == 3 then
  104.         run('rLookupHost')
  105.    
  106.     elseif x == 1 and y == 4 then
  107.         run('runLua')
  108.    
  109.     elseif x == 28 and y == 4 then
  110.         run('rLookupProtocol')
  111.    
  112.     elseif x == 1 and y == 5 then
  113.         run('runEdit')
  114.        
  115.     elseif x == 1 and y == 6 then
  116.         run('FTPReceive')
  117.        
  118.     elseif x == 28 and y == 5 then
  119.         run('FTPSend')
  120.        
  121.     elseif x == 51 and y == 19 then
  122.         clear(1, 1)
  123.         error()
  124.        
  125.     else
  126.         run('menu')
  127.        
  128.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement