local monitor = peripheral.wrap("front") local kill = false term.redirect(monitor) term.setBackgroundColor(colors.black) monitor.clear() term.setCursorPos(3, 6) print("Blaze farm") monitor.setTextScale(0.5) function killBtn(color) paintutils.drawFilledBox(2, 2, 7, 4, color) term.setCursorPos(3,3) print("kill") end killBtn(colors.green) function nextBtn(color) paintutils.drawFilledBox(9, 2, 14, 4, color) term.setCursorPos(10,3) print("next") end nextBtn(colors.green) function Damage(crusher, dropper) redstone.setOutput("top",true) term.setCursorPos(3, 9) term.setBackgroundColor(colors.black) print("Waiting ...") sleep(dropper) redstone.setOutput("top",false) redstone.setOutput("right",true) redstone.setOutput("bottom",true) update(crusher) redstone.setOutput("right",false) redstone.setOutput("bottom",false) paintutils.drawFilledBox(0, 8, 15, 10, colors.black) end function update(count) local total = count while count > 0 do count = count - 0.5 paintutils.drawFilledBox(0, 8, 15 - count / total * 15, 10, colors.gray) sleep(0.5) end end while true do event, side, xPos, yPos = os.pullEvent("monitor_touch") if yPos >= 2 and yPos <= 4 then if xPos >= 2 and xPos <= 7 then kill = not kill if kill then killBtn(colors.red) nextBtn(colors.gray) else killBtn(colors.green) nextBtn(colors.green) end Damage(9, 5) elseif (kill == false) and (xPos >= 9 and xPos <= 14) then Damage(8.5, 5) end end if kill == true then Damage(9, 5) end end
Edited by Akxe, 02 May 2015 - 10:58 AM.