Guest User

Control Panel Alpha 0.5

a guest
May 7th, 2012
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.1")
  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 outputaus(testside)
  26.  
  27.         input = io.read()
  28.             if input == "1" then
  29.             removeoutput(testside, 1)
  30.        
  31.             elseif input == "2" then
  32.             removeoutput(testside, 2)
  33.            
  34.             elseif input == "3" then
  35.             removeoutput(testside, 4)
  36.            
  37.             elseif input == "4" then
  38.             removeoutput(testside, 8)
  39.            
  40.             elseif input == "5" then
  41.             removeoutput(testside, 16)
  42.            
  43.             elseif input == "6" then
  44.             removeoutput(testside, 32)
  45.            
  46.             elseif input == "7" then
  47.             removeoutput(testside, 64)
  48.            
  49.             elseif input == "8" then
  50.             removeoutput(testside, 128)
  51.            
  52.             elseif input == "9" then
  53.             removeoutput(testside, 256)
  54.            
  55.             elseif input == "10" then
  56.             removeoutput(testside, 512)
  57.            
  58.             elseif input == "11" then
  59.             removeoutput(testside, 1024)
  60.            
  61.             elseif input == "12" then
  62.             removeoutput(testside, 2048)
  63.            
  64.             elseif input == "13" then
  65.             removeoutput(testside, 4096)
  66.            
  67.             elseif input == "14" then
  68.             removeoutput(testside, 8192)
  69.            
  70.             elseif input == "15" then
  71.             removeoutput(testside, 16384)
  72.            
  73.             elseif input == "16" then
  74.             removeoutput(testside, 32768)
  75.            
  76.         end
  77.     end
  78.      
  79.     function testoutput(testside)
  80.      
  81.         while true do
  82.        
  83.         cl()
  84.         print("(q) Menu")    
  85.      
  86.         if rs.testBundledInput(testside, colors.white) then
  87.                 print("White    : (1) AN")
  88.             else
  89.                 print("White    : Aus")
  90.             end
  91.             if rs.testBundledInput(testside, colors.orange) then
  92.                 print("Orange   : (2) AN")
  93.             else
  94.                 print("Orange   : Aus")
  95.             end
  96.             if rs.testBundledInput(testside, colors.magenta) then
  97.                 print("Magenta  : (3) AN")
  98.             else
  99.                 print("Magenta  : Aus")
  100.             end
  101.             if rs.testBundledInput(testside, 8) then
  102.                 print("LightBlue: (4) AN")
  103.             else
  104.                 print("LightBlue: Aus")
  105.             end
  106.             if rs.testBundledInput(testside, colors.yellow) then
  107.                 print("Yellow   : (5) AN")
  108.             else
  109.                 print("Yellow   : Aus")
  110.             end
  111.         if rs.testBundledInput(testside, colors.lime) then
  112.                 print("Lime     : (6) AN")
  113.             else
  114.                 print("Lime     : Aus")
  115.             end
  116.             if rs.testBundledInput(testside, colors.pink) then
  117.                 print("Pink     : (7) AN")
  118.             else
  119.                 print("Pink     : Aus")
  120.             end
  121.             if rs.testBundledInput(testside, colors.gray) then
  122.                 print("Gray     : (8) AN")
  123.             else
  124.                 print("Gray     : Aus")
  125.             end
  126.             if rs.testBundledInput(testside, 256) then
  127.                 print("LightGray: (9) AN")
  128.             else
  129.                 print("LightGray: Aus")
  130.             end
  131.             if rs.testBundledInput(testside, colors.cyan) then
  132.                 print("Cyan     : (10) AN")
  133.             else
  134.                 print("Cyan     : Aus")
  135.             end
  136.             if rs.testBundledInput(testside, colors.purple) then
  137.                 print("Purple   : (11) AN")
  138.             else
  139.                 print("Purple   : Aus")
  140.             end
  141.             if rs.testBundledInput(testside, colors.blue) then
  142.                 print("Blue     : (12) AN")
  143.             else
  144.                 print("Blue     : Aus")
  145.             end
  146.             if rs.testBundledInput(testside, colors.brown) then
  147.                 print("Brown    : (13) AN")
  148.             else
  149.                 print("Brown    : Aus")
  150.             end
  151.             if rs.testBundledInput(testside, colors.green) then
  152.                 print("Green    : (14) AN")
  153.             else
  154.                 print("Green    : Aus")
  155.             end
  156.             if rs.testBundledInput(testside, colors.red) then
  157.                 print("Red      : (15) AN")
  158.             else
  159.                 print("Red      : Aus")
  160.             end
  161.             if rs.testBundledInput(testside, colors.black) then
  162.                 print("Black    : (16) AN")
  163.             else
  164.                 print("Black    : Aus")
  165.             end
  166.      
  167.     sleep(2.5)
  168.      
  169.      outputaus(testside)
  170.      
  171.         while true do
  172.             local e2, p2 = os.pullEvent()
  173.             if e2 == "char" and p2 == "q" then
  174.             sleep(0.5)
  175.             return menu()
  176.           end
  177.        end
  178.      end
  179.     end    
  180.      
  181.     function output()
  182.      
  183.         cl()
  184.         lane()
  185.         print("Output Seite waehlen")
  186.         l()                              -- 20
  187.         print("(1) back")
  188.         print("(2) right")
  189.         print("(3) left")
  190.         print("(4) top")
  191.         print("(5) bottom")
  192.      
  193.         while true do
  194.      
  195.             local e1, p1 = os.pullEvent()
  196.             if e1 == "char" and p1 == "1" then
  197.                 color("back")
  198.             elseif e1 == "char" and p1 == "2" then
  199.                 color("right")
  200.             elseif e1 == "char" and p1 == "3" then
  201.                 color("left")
  202.             elseif e1 == "char" and p1 == "4" then
  203.                 color("top")
  204.             elseif e1 == "char" and p1 == "5" then
  205.                 color("bottom")
  206.              end
  207.             end                        
  208.      
  209.     end
  210.      
  211.      
  212.     function color(side)
  213.         cl()
  214.         lane()
  215.         print("Ausgewaehlte Seite: " ..side)
  216.         print("Bitte Farbe eintippen")
  217.         farbe = io.read()
  218.         if farbe == "white" then
  219.             id = 1
  220.         elseif farbe == "orange" then
  221.             id = 2
  222.         elseif farbe == "magenta" then
  223.             id = 4
  224.         elseif farbe == "lightblue" then
  225.             id = 8
  226.         elseif farbe == "yellow" then
  227.             id = 16
  228.         elseif farbe == "lime" then
  229.             id = 32
  230.         elseif farbe == "pink" then
  231.             id = 64
  232.         elseif farbe == "gray" then
  233.             id = 128
  234.         elseif farbe == "lightgray" then
  235.             id = 256
  236.         elseif farbe == "cyan" then
  237.             id = 512
  238.         elseif farbe == "purple" then
  239.             id = 1024
  240.         elseif farbe == "blue" then
  241.             id = 2048
  242.         elseif farbe == "brown" then
  243.             id = 4096
  244.         elseif farbe == "green" then
  245.             id = 8192
  246.         elseif farbe == "red" then
  247.             id = 16384
  248.         elseif farbe == "black" then
  249.             id = 32768
  250.        end
  251.      
  252.         print(farbe.. " wurde ausgewaehlt")
  253.         sleep(2)
  254.         addoutput(side, id)
  255.         sleep(0.5)
  256.      
  257.        return menu()
  258.      
  259.     end
  260.      
  261.     function status()
  262.      
  263.         cl()
  264.         lane()
  265.         print("Output Seite waehlen")
  266.         l()                              
  267.         print("(1) back")
  268.         print("(2) right")
  269.         print("(3) left")
  270.         print("(4) top")
  271.         print("(5) bottom")
  272.      
  273.         while true do
  274.      
  275.             local e1, p1 = os.pullEvent()
  276.             if e1 == "char" and p1 == "1" then
  277.                 testoutput("back")
  278.             elseif e1 == "char" and p1 == "2" then
  279.                 testoutput("right")
  280.             elseif e1 == "char" and p1 == "3" then
  281.                 testoutput("left")
  282.             elseif e1 == "char" and p1 == "4" then
  283.                 testoutput("top")
  284.             elseif e1 == "char" and p1 == "5" then
  285.                 testoutput("bottom")
  286.                 end
  287.         end                          
  288.      
  289.        
  290.        
  291.     end
  292.      
  293.     function menu()
  294.         cl()  
  295.         lane()
  296.         print("(a) Output setzen")
  297.         print("(b) Status und Abschaltung")
  298.        
  299.         while true do
  300.      
  301.             local event, param = os.pullEvent()
  302.             if event == "char" and param == "a" then
  303.                 output()
  304.                
  305.             elseif event == "char" and param == "b" then
  306.                 status()
  307.             end
  308.         end
  309.     end
  310.      
  311.     menu()
Advertisement
Add Comment
Please, Sign In to add comment