Advertisement
44shades44

Computer Craft RCT v1.0a - Turtle

Mar 27th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function RCT()
  2.  while true do
  3.   local scrap, msg = rednet.receive()
  4.   if msg == "RCF" then
  5.    if turtle.detect() == false then
  6.     turtle.forward()
  7.    end
  8.   elseif msg == "RCMF" then
  9.    if turtle.detect() then
  10.     turtle.dig()
  11.    end
  12.   elseif msg == "RCGF" then
  13.    if turtle.detect() then
  14.     turtle.dig()
  15.    end
  16.    turtle.forward()
  17.   elseif msg == "RCPF" then
  18.    if turtle.detect() == false then
  19.     turtle.place()
  20.    end
  21.   elseif msg == "RCAF" then
  22.    turtle.attack()
  23.   elseif msg == "RCB" then
  24.    turtle.back()
  25.   elseif msg == "RCL" then
  26.    turtle.turnLeft()
  27.   elseif msg == "RCR" then
  28.    turtle.turnRight()
  29.   elseif msg == "RCU" then
  30.    if turtle.detectUp() == false then
  31.     turtle.up()
  32.    end
  33.   elseif msg == "RCMU" then
  34.    if turtle.detectUp() then
  35.     turtle.digUp()
  36.    end
  37.   elseif msg == "RCGU" then
  38.    if turtle.detectUp() then
  39.     turtle.digUp()
  40.    end
  41.    turtle.up()
  42.   elseif msg == "RCPU" then
  43.    if turtle.detectUp() ==false then
  44.     turtle.placeUp()
  45.    end
  46.   elseif msg == "RCAU" then
  47.    turtle.attackUp()
  48.   elseif msg == "RCD" then
  49.    if turtle.detectDown() == false then
  50.     turtle.down()
  51.    end
  52.   elseif msg == "RCMD" then
  53.    if turtle.detectDown() then
  54.     turtle.digDown()
  55.    end
  56.   elseif msg == "RCGD" then
  57.    if turtle.detectDown() then
  58.     turtle.digDown()
  59.    end
  60.    turtle.down()
  61.   elseif msg == "RCPD" then
  62.    if turtle.detectDown() == false then
  63.     turtle.placeDown()
  64.    end
  65.   elseif msg == "RCAD" then
  66.    turtle.attackDown()
  67.   elseif msg == "RC1" then
  68.    turtle.select(1)
  69.   elseif msg == "RC2" then
  70.    turtle.select(2)
  71.   elseif msg == "RC3" then
  72.    turtle.select(3)
  73.   elseif msg == "RC4" then
  74.    turtle.select(4)
  75.   elseif msg == "RC5" then
  76.    turtle.select(5)
  77.   elseif msg == "RC6" then
  78.    turtle.select(6)
  79.   elseif msg == "RC7" then
  80.    turtle.select(7)
  81.   elseif msg == "RC8" then
  82.    turtle.select(8)
  83.   elseif msg == "RCRF" then
  84.    if turtle.getItemCount(16) == 0 then
  85.     sleep(0)
  86.     --(Add): Send message to computer: No fuel available!
  87.    elseif turtle.getItemCount(16) > 0 then
  88.     if turtle.getFuelLevel() > 64 then
  89.      sleep(0)
  90.      --(ADD): Send to computer: No need to refuel!
  91.     elseif turtle.getFuelLevel() < 64 then
  92.      if turtle.refuel(0) == false then
  93.       sleep(0)
  94.       --(ADD): Send to computer: Item in slot 16 is not a valid fuel!
  95.      elseif turtle.refuel(0) == true then
  96.       turtle.refuel(16)
  97.       --(ADD): Send to computer: Refuel successful!
  98.      end
  99.     end
  100.    end
  101.   end
  102.  end
  103. end
  104.  
  105. rednet.open("right")
  106. term.clear()
  107. term.setCursorPos(1,1)
  108. print[[Remote Controlled Turtle Initiated!
  109.  - This turtle is being controlled from a remote location
  110. Program by 44shades44]]
  111.  
  112. RCT()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement