Advertisement
ccraftersanonmoose

turtlecontroller

Mar 2nd, 2023
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | Gaming | 0 0
  1. -- Script for turtles
  2. -- written by craftersanonmoose
  3. --version history
  4. -- version 0.1 2-27-23
  5. -- receive message via rednet and allow control of the turtle
  6. -- certain messages can trigger predefined tasks
  7. --------------------------------------------------------
  8.  
  9. rednet.open("right")
  10. id, message = rednet.receive()
  11.  
  12. function receiveCommand()
  13.     if message == "a" then
  14.         turtle.turnLeft()
  15.     elseif message == "w" then
  16.         turtle.forward()
  17.     elseif message == "s" then
  18.         turtle.back()
  19.     elseif message == "d" then
  20.         turtle.turnRight()
  21.     else
  22.         term.write("invalid command sent")
  23. end
  24.  
  25.  
  26.  
  27.  
  28. while true do
  29.     receiveCommand()
  30. end
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement