Advertisement
Guest User

startup

a guest
Sep 29th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.63 KB | None | 0 0
  1. os.loadAPI("button")
  2. os.loadAPI("varRegister")
  3. m = peripheral.wrap("monitor_11")
  4. m.clear()
  5.  
  6. function fillTable()
  7.    button.setTable("Wither", s1, 3,16,2,4)
  8.    button.setTable("Enderman", s2, 3,16,6,8)
  9.    button.setTable("Witch", s3, 3,16,10,12)
  10.    button.setTable("Wisp", s4, 3,16,14,16)
  11.    button.setTable("Guardian", s5,3,16,18,20)
  12.    button.setTable("bla", s6,3,16,22,24)
  13.    button.screen()
  14. end
  15.  
  16. function getClick()
  17.    event,side,x,y = os.pullEvent("monitor_touch")
  18.    button.checkxy(x,y)
  19. end
  20.  
  21. function s1()
  22.    button.flash("Wither")
  23.    if varRegister.loadVar("s1") == "off" then
  24.    varRegister.saveVar("s1", "on")
  25.    else
  26.    varRegister.saveVar("s1", "off")
  27.    end
  28.    check()
  29. end
  30.  
  31. function s2()
  32.    button.flash("Enderman")
  33.    if varRegister.loadVar("s2") == "off" then
  34.    varRegister.saveVar("s2", "on")
  35.    else
  36.    varRegister.saveVar("s2", "off")
  37.    end
  38.    check()
  39. end
  40.  
  41. function s3()
  42.    button.flash("Witch")
  43.    if varRegister.loadVar("s3") == "off" then
  44.    varRegister.saveVar("s3", "on")
  45.    else
  46.    varRegister.saveVar("s3", "off")
  47.    end
  48.    check()
  49. end
  50.  
  51. function s4()
  52.    button.flash("Wisp")
  53.    if varRegister.loadVar("s4") == "off" then
  54.    varRegister.saveVar("s4", "on")
  55.    else
  56.    varRegister.saveVar("s4", "off")
  57.    end
  58.    check()
  59.    
  60. end
  61.  
  62. function s5()
  63.    button.flash("Guardian")
  64.    if varRegister.loadVar("s5") == "off" then
  65.    varRegister.saveVar("s5", "on")
  66.    else
  67.    varRegister.saveVar("s5", "off")
  68.    end
  69.    check()
  70.    
  71. end
  72.  
  73. function s6()
  74.    button.flash("bla")
  75.    if varRegister.loadVar("s6") == "off" then
  76.    varRegister.saveVar("s6", "on")
  77.    else
  78.    varRegister.saveVar("s6", "off")
  79.    end
  80.    check()  
  81. end
  82.  
  83. fillTable()
  84.  
  85. while true do
  86. function check()  
  87.    
  88.    if varRegister.loadVar("s1") == "on" then
  89.    c1 = 1
  90.    ss1 = 1
  91.    else
  92.    c1 = 2
  93.    ss1 = 0
  94.    end
  95.    
  96.    if varRegister.loadVar("s2") == "on" then
  97.     ss2 = 4
  98.     c2 = 1
  99.     else
  100.     c2 = 2
  101.     ss2 = 0
  102.    end
  103.    
  104.    if varRegister.loadVar("s3") == "on" then
  105.     ss3 = 2048
  106.     c3 = 1
  107.     else
  108.     c3 = 2
  109.     ss3 = 0
  110.    end
  111.    
  112.    if varRegister.loadVar("s4") == "on" then
  113.     ss4 = 8192
  114.     c4 = 1
  115.     else
  116.     c4 = 2
  117.     ss4 = 0
  118.    end
  119.    
  120.    if varRegister.loadVar("s5") == "on" then
  121.     ss5 = 16384
  122.     c5 = 1
  123.     else
  124.     c5 = 2
  125.     ss5 = 0
  126.    end
  127.    
  128.    if varRegister.loadVar("s6") == "on" then
  129.     ss6 = 32768
  130.     c6 = 1
  131.     else
  132.     c6 = 2
  133.     ss6 = 0
  134.    end
  135.    
  136.   bc = ss1 + ss2 + ss3 + ss4 + ss5 + ss6
  137.   redstone.setBundledOutput("back", bc)
  138.  
  139.  
  140.   m.setCursorPos(21, 3)  
  141.   if c1 == 1 then
  142.    m.setTextColor(colors.green)
  143.    else
  144.    m.setTextColor(colors.red)
  145.   end
  146.   m.write(varRegister.loadVar("s1").. " ")
  147.  
  148.  
  149.   m.setCursorPos(21, 7)
  150.   if c2 == 1 then
  151.    m.setTextColor(colors.green)
  152.    else
  153.    m.setTextColor(colors.red)
  154.   end
  155.   m.write(varRegister.loadVar("s2").. " ")
  156.  
  157.  
  158.   if c3 == 1 then
  159.    m.setTextColor(colors.green)
  160.    else
  161.    m.setTextColor(colors.red)
  162.   end
  163.   m.setCursorPos(21, 11)
  164.   m.write(varRegister.loadVar("s3").. " ")
  165.  
  166.  
  167.   if c4 == 1 then
  168.    m.setTextColor(colors.green)
  169.    else
  170.    m.setTextColor(colors.red)
  171.   end
  172.   m.setCursorPos(21, 15)
  173.   m.write(varRegister.loadVar("s4").. " ")
  174.  
  175.  
  176.   if c5 == 1 then
  177.   m.setTextColor(colors.green)
  178.   else
  179.   m.setTextColor(colors.red)
  180.   end
  181.   m.setCursorPos(21, 19)
  182.   m.write(varRegister.loadVar("s5").. " ")
  183.  
  184.  
  185.   if c6 == 1 then
  186.   m.setTextColor(colors.green)
  187.   else
  188.   m.setTextColor(colors.red)
  189.   end
  190.   m.setCursorPos(21, 23)
  191.   m.write(varRegister.loadVar("s6").. " ")
  192.  
  193.  
  194.   m.setTextColor(colors.white)    
  195.  end  
  196.  
  197.   check()
  198.   getClick()
  199. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement