Advertisement
Guest User

RC Turtle Server

a guest
Aug 1st, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. rednet.open("left")
  2. for i = 1, 16 do -- loop through the slots
  3.   turtle.select(i) -- change to the slot
  4.   if turtle.refuel(0) then -- if it's valid fuel
  5.     local halfStack = math.ceil(turtle.getItemCount(i)/2) -- work out half of the amount of fuel in the slot
  6.     turtle.refuel(halfStack) -- consume half the stack as fuel
  7.   end
  8. end
  9. print("This turtle is under my control!")
  10. while true do
  11.   id, msg = rednet.receive()
  12.   if msg == "w" then
  13.     turtle.forward()
  14.   end
  15.   if msg == "a" then
  16.     turtle.turnLeft()
  17.   end
  18.   if msg == "s" then
  19.     turtle.back()
  20.   end
  21.   if msg == "d" then
  22.     turtle.turnRight()
  23.   end
  24.   if msg == "e" then
  25.     turtle.up()
  26.   end
  27.   if msg == "q" then
  28.     turtle.down()
  29.   end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement