tomtrein

Untitled

Jul 23rd, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. local function centerText(text)
  2. local x,y = term.getSize()
  3. local x2,y2 = term.getCursorPos()
  4. term.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  5. print(text)
  6. end
  7.  
  8. rednet.open("bottom")
  9.  
  10. while true do
  11. term.clear()
  12. centerText("Direction (wasd):")
  13. direction = read()
  14. if direction == "d" then
  15. rednet.send(700,"on")
  16. centerText("Ready")
  17. os.sleep(120)
  18. rednet.send(700,"off")
  19. elseif direction == "w" then
  20. centerText("Ready")
  21. os.sleep(120)
  22. elseif direction == "a"
  23. rednet.send(696,"on")
  24. rednet.send(698,"on")
  25. centerText("Ready")
  26. os.sleep(120)
  27. rednet.send(696,"off")
  28. rednet.send(698,"off")
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment