View difference between Paste ID: V7Vt8cD8 and DMJZ6fSb
SHOW: | | - or go back to the newest paste.
1
os.loadAPI("button")
2
local m = peripheral.wrap("back")
3
local mx, my = m.getSize()
4
function getClick()
5
  local event, side, x, y = os.pullEvent()
6
  if event == "monitor_touch" then
7
    button.checkxy(x, y)
8
  end
9
end
10-
function slime()
10+
function kuh()
11-
  button.toggleButton("Slime")    
11+
  button.toggleButton("Kuh")    
12-
  if button.active("Slime") then
12+
  if button.active("Kuh") then
13
   -- print("now on")
14
    rs.setOutput("right", false)
15
  else
16
   -- print("now off")
17
    rs.setOutput("right", true)
18
  end
19
  button.save()
20
  addText()      
21
end
22-
function skelette()
22+
function enderman()
23-
  button.toggleButton("Skelette")
23+
  button.toggleButton("Enderman")
24-
  if button.active("Skelette") then
24+
  if button.active("Enderman") then
25
  --  print("now on")
26
    rs.setOutput("left", false)
27
  else
28
  --  print("now off")
29
    rs.setOutput("left", true)
30
  end
31
  button.save()
32
  addText()
33
end      
34
function fillMainTable()
35
  m.clear()
36
  button.clearTable()
37
  button.setTable("Slime", slime, "", 2, mx/2, 2, my-1)
38
  button.setTable("Skelette", skelette, "", (mx/2)+2, mx-0.5, 2, my-1)
39
                                          --2,mx/2-1 -- mx/2+2, mx-0.5                    
40
  button.screen()
41
end
42
function addText()
43
  for i = 1,2 do
44
    m.setTextColor(colors.white)
45
    if i == 1 then
46
      local textr = "Mass"
47
      if button.active("Slime") then
48
        m.setBackgroundColor(colors.lime)
49
      else
50
        m.setBackgroundColor(colors.red)
51
      end
52
      m.setCursorPos(mx/4-#textr/2+1.75, my/2+1)    
53
      m.write(textr)
54
    else
55
      local textr = "MFSU's"
56
      if button.active("Skelette") then
57
        m.setBackgroundColor(colors.lime)
58
      else
59
        m.setBackgroundColor(colors.red)
60
      end
61
      m.setCursorPos(mx*0.75-#textr/2+1, my/2+1)      
62
      m.write(textr)
63
    end
64
  end  
65
end 
66
function addText()
67
  local text = "AUTO-MOBFARM"
68
  local mx, my = m.getSize()
69
  m.setBackgroundColor(colors.black)
70
  m.setCursorPos((mx/2-#text/2)+1 , 1)
71
  m.write(text)
72
end   
73
fillMainTable()
74
button.load()
75
addText()
76
while true do
77
  getClick()
78
end