tomtrein

Untitled

Jul 23rd, 2016
94
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. centerText("Ready")
  16. os.sleep(120)
  17. elseif direction == "w" then
  18. rednet.send(699,"on")
  19. rednet.send(700,"on")
  20. centerText("Ready")
  21. os.sleep(120)
  22. rednet.send(699,"off")
  23. rednet.send(700,"off")
  24. elseif direction == "a"
  25. rednet.send(699,"on")
  26. centerText("Ready")
  27. os.sleep(120)
  28. rednet.send(699,"off")
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment