Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- local m = peripheral.wrap("back")
- local mx, my = m.getSize()
- function getClick()
- local event, side, x, y = os.pullEvent()
- if event == "monitor_touch" then
- button.checkxy(x, y)
- end
- end
- function kuh()
- button.toggleButton("Kuh")
- if button.active("Kuh") then
- -- print("now on")
- rs.setOutput("right", false)
- else
- -- print("now off")
- rs.setOutput("right", true)
- end
- button.save()
- addText()
- end
- function enderman()
- button.toggleButton("Enderman")
- if button.active("Enderman") then
- -- print("now on")
- rs.setOutput("left", false)
- else
- -- print("now off")
- rs.setOutput("left", true)
- end
- button.save()
- addText()
- end
- function fillMainTable()
- m.clear()
- button.clearTable()
- button.setTable("Slime", slime, "", 2, mx/2, 2, my-1)
- button.setTable("Skelette", skelette, "", (mx/2)+2, mx-0.5, 2, my-1)
- --2,mx/2-1 -- mx/2+2, mx-0.5
- button.screen()
- end
- function addText()
- for i = 1,2 do
- m.setTextColor(colors.white)
- if i == 1 then
- local textr = "Mass"
- if button.active("Slime") then
- m.setBackgroundColor(colors.lime)
- else
- m.setBackgroundColor(colors.red)
- end
- m.setCursorPos(mx/4-#textr/2+1.75, my/2+1)
- m.write(textr)
- else
- local textr = "MFSU's"
- if button.active("Skelette") then
- m.setBackgroundColor(colors.lime)
- else
- m.setBackgroundColor(colors.red)
- end
- m.setCursorPos(mx*0.75-#textr/2+1, my/2+1)
- m.write(textr)
- end
- end
- end
- function addText()
- local text = "AUTO-MOBFARM"
- local mx, my = m.getSize()
- m.setBackgroundColor(colors.black)
- m.setCursorPos((mx/2-#text/2)+1 , 1)
- m.write(text)
- end
- fillMainTable()
- button.load()
- addText()
- while true do
- getClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement