kingculta

Engine On Code

Apr 18th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. monitor = peripheral.wrap("left")
  2. monitor.setTextScale(2)
  3. mx, my = monitor.getSize()
  4. posX = 7
  5. posY = 6
  6. boxX1 = 6
  7. boxX2 = 8
  8. boxY1 = 5
  9. boxY2 = 7
  10. monitor.setCursorPos(boxX1, boxY1)
  11. monitor.write("*")
  12. monitor.setCursorPos(boxX2, boxY1)
  13. monitor.write("*")
  14. monitor.setCursorPos(boxX1, boxY2)
  15. monitor.write("*")
  16. monitor.setCursorPos(boxX2, boxY2)
  17. monitor.write("*")
  18. monitor.setCursorPos(posX, posY)
  19. while true do
  20. os.pullEvent("redstone")
  21. if rs.getInput("front") then
  22.   monitor.setCursorPos(posX,posY)  
  23.   monitor.write("Engine is on")
  24.   event, side, touchX, touchY = os.pullEvent("monitor touch")
  25.   if touchX < boxX2 and touchX > boxX1 and touchY > boxY1 and touchY < boxY2 then
  26.     rs.setOutpout("front", false)
  27.     monitor.setCursorPos(posX, posY)
  28.     monitor.write("Engine is off")
  29.   end
  30. elseif not rs.getInput("front") then
  31.   monitor.setCursorPos(posX,posY)
  32.   monitor.write("Engine is off")
  33.   event, side, touchX, touchY = os.pullEvent("monitor touch")
  34.   if touchX > boxX1 and touchX < boxX2 and touchY > boxY1 and touchY < boxY2 then
  35.     rs.setOutput("front", true)
  36.     monitor.setCursorPos(posX, posY)
  37.     monitor.write("Engine is on")
  38.   end
  39. end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment