Advertisement
ezotose

Turtle Redstone Elevator

Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. -- set redstone back and left and right
  2. -- back floor 1
  3. -- right floor 2
  4. function Menu()
  5. term.clear()
  6. local n=1
  7. while true do
  8. local x, y=term.getCursorPos()
  9. term.clearLine()
  10. if n==1 then write(">APPELER ASCENSEUR< DESCENDRE") else write (" APPELER ASCENSEUR >DESCENDRE<") end
  11. term.setCursorPos(x, y)
  12. a, b=os.pullEvent()
  13. while a~="key" do a, b=os.pullEvent() end
  14. if b==203 and n==2 then n=1 end
  15. if b==205 and n==1 then n=2 end
  16. if b==28 then print("") break end
  17. end
  18. if n==1 then
  19. redstone.setOutput("right", false)
  20. redstone.setOutput("back", true)
  21. end
  22. if n==2 then
  23. redstone.setOutput("back", false)
  24. redstone.setOutput("right", true)
  25. end
  26. return false
  27.  
  28. end
  29.  
  30.  
  31. Menu()
  32. os.sleep(6)
  33. os.shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement