Don't like ads? PRO users don't see any ads ;-)
Guest

Control Panel Alpha 0.7

By: a guest on May 7th, 2012  |  syntax: Lua  |  size: 7.72 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function l()
  2.         print("")
  3.     end
  4.      
  5.     function cl()
  6.         term.setCursorPos(1,1)
  7.         term.clear()
  8.     end
  9.      
  10.     function lane()
  11.         print("Control Panel Alpha 0.7")
  12.         l()
  13.     end
  14.      
  15.     local function addoutput(sside, ...)
  16.         local c = colors.combine(rs.getBundledOutput(sside), ...)
  17.         rs.setBundledOutput(sside, c)
  18.     end
  19.      
  20.     local function removeoutput(sside, ...)
  21.        local c = colors.subtract(rs.getBundledOutput(sside), ...)    
  22.        rs.setBundledOutput(sside, c)
  23.     end
  24.      
  25.         function outputanaus(testside)
  26.  
  27.         input = io.read()
  28.                     if input == "1" and rs.testBundledInput(testside, 1) then
  29.                     removeoutput(testside, 1)
  30.                
  31.                     elseif input == "2" and rs.testBundledInput(testside, 2) then
  32.                         removeoutput(testside, 2)
  33.                    
  34.                     elseif input == "3" and rs.testBundledInput(testside, 4) then
  35.                         removeoutput(testside, 4)
  36.                        
  37.                     elseif input == "4" and rs.testBundledInput(testside, 8) then
  38.                         removeoutput(testside, 8)
  39.                        
  40.                     elseif input == "5" and rs.testBundledInput(testside, 16) then
  41.                         removeoutput(testside, 16)
  42.                        
  43.                     elseif input == "6" and rs.testBundledInput(testside, 32) then
  44.                         removeoutput(testside, 32)
  45.                        
  46.                     elseif input == "7" and rs.testBundledInput(testside, 64) then
  47.                         removeoutput(testside, 64)
  48.                        
  49.                     elseif input == "8" and rs.testBundledInput(testside, 128) then
  50.                         removeoutput(testside, 128)
  51.                        
  52.                     elseif input == "9" and rs.testBundledInput(testside, 256) then
  53.                         removeoutput(testside, 256)
  54.                        
  55.                     elseif input == "10" and rs.testBundledInput(testside, 512) then
  56.                         removeoutput(testside, 512)
  57.                        
  58.                     elseif input == "11" and rs.testBundledInput(testside, 1024) then
  59.                         removeoutput(testside, 1024)
  60.                        
  61.                     elseif input == "12" and rs.testBundledInput(testside, 2048) then
  62.                         removeoutput(testside, 2048)
  63.                        
  64.                     elseif input == "13" and rs.testBundledInput(testside, 4096) then
  65.                         removeoutput(testside, 4096)
  66.                        
  67.                     elseif input == "14" and rs.testBundledInput(testside, 8192) then
  68.                         removeoutput(testside, 8192)
  69.                        
  70.                     elseif input == "15" and rs.testBundledInput(testside, 16384) then
  71.                         removeoutput(testside, 16384)
  72.                        
  73.                     elseif input == "16" and rs.testBundledInput(testside, 32768) then
  74.                         removeoutput(testside, 32768)
  75.                        
  76.                         elseif input == "1" then
  77.                     addoutput(testside, 1)
  78.                
  79.                     elseif input == "2" then
  80.                         addoutput(testside, 2)
  81.                    
  82.                     elseif input == "3" then
  83.                         addoutput(testside, 4)
  84.                        
  85.                     elseif input == "4" then
  86.                         addoutput(testside, 8)
  87.                        
  88.                     elseif input == "5" then
  89.                         addoutput(testside, 16)
  90.                        
  91.                     elseif input == "6" then
  92.                         addoutput(testside, 32)
  93.                        
  94.                     elseif input == "7" then
  95.                         addoutput(testside, 64)
  96.                        
  97.                     elseif input == "8" then
  98.                         addoutput(testside, 128)
  99.                        
  100.                     elseif input == "9" then
  101.                         addoutput(testside, 256)
  102.                        
  103.                     elseif input == "10" then
  104.                         addoutput(testside, 512)
  105.                        
  106.                     elseif input == "11" then
  107.                         addoutput(testside, 1024)
  108.                        
  109.                     elseif input == "12" then
  110.                         addoutput(testside, 2048)
  111.                        
  112.                     elseif input == "13" then
  113.                         addoutput(testside, 4096)
  114.                        
  115.                     elseif input == "14" then
  116.                         addoutput(testside, 8192)
  117.                        
  118.                     elseif input == "15" then
  119.                         addoutput(testside, 16384)
  120.                        
  121.                     elseif input == "16" then
  122.                         addoutput(testside, 32768)
  123.                        
  124.                         elseif input == "q" then
  125.                         sleep(0.5)
  126.                         return menu()
  127.                        
  128.                 end    
  129.         end
  130.          
  131.        
  132.            
  133.                        
  134.                 end    
  135.         end
  136.          
  137.     function testoutput(testside)
  138.      
  139.         while true do
  140.        
  141.         cl()
  142.         print("(q) Menu")    
  143.      
  144.         if rs.testBundledInput(testside, colors.white) then
  145.                 print("White    : (1) AN")
  146.             else
  147.                 print("White    : Aus")
  148.             end
  149.             if rs.testBundledInput(testside, colors.orange) then
  150.                 print("Orange   : (2) AN")
  151.             else
  152.                 print("Orange   : Aus")
  153.             end
  154.             if rs.testBundledInput(testside, colors.magenta) then
  155.                 print("Magenta  : (3) AN")
  156.             else
  157.                 print("Magenta  : Aus")
  158.             end
  159.             if rs.testBundledInput(testside, 8) then
  160.                 print("LightBlue: (4) AN")
  161.             else
  162.                 print("LightBlue: Aus")
  163.             end
  164.             if rs.testBundledInput(testside, colors.yellow) then
  165.                 print("Yellow   : (5) AN")
  166.             else
  167.                 print("Yellow   : Aus")
  168.             end
  169.         if rs.testBundledInput(testside, colors.lime) then
  170.                 print("Lime     : (6) AN")
  171.             else
  172.                 print("Lime     : Aus")
  173.             end
  174.             if rs.testBundledInput(testside, colors.pink) then
  175.                 print("Pink     : (7) AN")
  176.             else
  177.                 print("Pink     : Aus")
  178.             end
  179.             if rs.testBundledInput(testside, colors.gray) then
  180.                 print("Gray     : (8) AN")
  181.             else
  182.                 print("Gray     : Aus")
  183.             end
  184.             if rs.testBundledInput(testside, 256) then
  185.                 print("LightGray: (9) AN")
  186.             else
  187.                 print("LightGray: Aus")
  188.             end
  189.             if rs.testBundledInput(testside, colors.cyan) then
  190.                 print("Cyan     : (10) AN")
  191.             else
  192.                 print("Cyan     : Aus")
  193.             end
  194.             if rs.testBundledInput(testside, colors.purple) then
  195.                 print("Purple   : (11) AN")
  196.             else
  197.                 print("Purple   : Aus")
  198.             end
  199.             if rs.testBundledInput(testside, colors.blue) then
  200.                 print("Blue     : (12) AN")
  201.             else
  202.                 print("Blue     : Aus")
  203.             end
  204.                         if rs.testBundledInput(testside, colors.brown) then
  205.                 print("Brown    : (13) AN")
  206.             else
  207.                 print("Brown    : Aus")
  208.             end
  209.             if rs.testBundledInput(testside, colors.green) then
  210.                 print("Green    : (14) AN")
  211.             else
  212.                 print("Green    : Aus")
  213.             end
  214.             if rs.testBundledInput(testside, colors.red) then
  215.                 print("Red      : (15) AN")
  216.             else
  217.                 print("Red      : Aus")
  218.             end
  219.             if rs.testBundledInput(testside, colors.black) then
  220.                 print("Black    : (16) AN")
  221.             else
  222.                 print("Black    : Aus")
  223.             end
  224.      
  225.     sleep(1)
  226.      
  227.          outputanaus(testside)
  228.          
  229.         sleep(1.5)
  230.  
  231.     return testoutput(testside)
  232.  
  233.      end
  234.     end    
  235.    
  236.  
  237.     function status()
  238.      
  239.         cl()
  240.         lane()
  241.         print("Output Seite waehlen")
  242.         l()                              
  243.         print("(1) back")
  244.         print("(2) right")
  245.         print("(3) left")
  246.         print("(4) top")
  247.         print("(5) bottom")
  248.      
  249.         while true do
  250.      
  251.             local e1, p1 = os.pullEvent()
  252.             if e1 == "char" and p1 == "1" then
  253.                 testoutput("back")
  254.             elseif e1 == "char" and p1 == "2" then
  255.                 testoutput("right")
  256.             elseif e1 == "char" and p1 == "3" then
  257.                 testoutput("left")
  258.             elseif e1 == "char" and p1 == "4" then
  259.                 testoutput("top")
  260.             elseif e1 == "char" and p1 == "5" then
  261.                 testoutput("bottom")
  262.                 end
  263.         end                          
  264.      
  265.        
  266.        
  267.     end
  268.      
  269.     function menu()
  270.         cl()  
  271.         lane()
  272.         print("(a) Status AN/AUS")
  273.        
  274.         while true do            
  275.                 if event == "char" and param == "a" then
  276.                 status()
  277.             end
  278.         end
  279.     end
  280.      
  281.     menu()