tomtrein

Untitled

Jul 15th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. local pullEvent = os.pullEvent
  2. os.pullEvent = os.pullEventRaw
  3.  
  4. local function centerText(text)
  5. local x,y = term.getSize()
  6. local x2,y2 = term.getCursorPos()
  7. term.setTextColor(colors.red)
  8. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  9. write(text)
  10. end
  11.  
  12. hello=true
  13. while hello==true do
  14. term.clear()
  15. centerText("Press Enter for emergency:")
  16. input = read()
  17. if input == "terminate" then
  18. os.pullEvent = pullEvent
  19. hello=false
  20. term.clear()
  21. term.setCursorPos(1, 1)
  22. elseif input == "" then
  23. redstone.setOutput("bottom", true)
  24. sleep(0.1)
  25. redstone.setOutput("bottom", false)
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment