ComputerCraft Archive

RoxRC - Remote control turtle program

turtle networking unknown forum

Description

Set ID of turtle ------

Installation

Copy one of these commands into your ComputerCraft terminal:

Pastebin:pastebin get d4dEZM62 roxrc_-_remote_control_turtle_program
wget:wget https://pastebin.com/raw/d4dEZM62 roxrc_-_remote_control_turtle_program
Archive:wget https://cc.shobie.xyz/cc/get/pb-d4dEZM62 roxrc_-_remote_control_turtle_program
Quick Install: wget https://cc.shobie.xyz/cc/get/pb-d4dEZM62 RoxRC - Remote control turtle program

Usage

Run the program after downloading

Tags

turtlenetworkingforumpocket-programs

Source

View Original Source

Code Preview

------ Set ID of turtle ------
t=1
------ ------

local function RoxMaster()
  local run = 1
  while run == 1 do
        local sEvent, param = os.pullEvent("key")
        if sEvent == "key" then
          if param == 17 then
                rednet.send(t, "MoveForward")
          elseif param == 30 then
                rednet.send(t, "MoveLeft")
          elseif param == 31 then
                rednet.send(t, "MoveBack")
          elseif param == 32 then
                rednet.send(t, "MoveRight")
          elseif param == 18 then
                rednet.send(t, "MoveUp")
          elseif param == 16 then
                rednet.send(t, "MoveDown")
          elseif param == 33 then
                rednet.send(t, "DigForward")
          elseif param == 19 then
                rednet.send(t, "DigUp")
          elseif param == 46 then
                rednet.send(t, "DigDown")
------ Dav's additions for place, suck, and select -----
          elseif param == 13 then
                print("Which slot?")
                sleep(0.5)
                local selectslot = read()
                selectslot = tonumber(selectslot)
                if (selectslot~=nil) and (selectslot>0) and (selectslot<17) then
                  rednet.send(t, "Select,"..selectslot)
                else
                  print("Error: Must be number 1-16")
                  sleep(2)
                end
                Menu()
          elseif param == 34 then
                rednet.send(t, "SuckForward")
          elseif param == 20 then
                rednet.send(t, "SuckUp")
          elseif param == 48 then
                rednet.send(t, "SuckDown")
          elseif param == 35 then
                rednet.send(t, "DropForward")
          elseif param == 21 then
                rednet.send(t, "DropUp")
          elseif param == 49 then
                rednet.send(t, "DropDown")
          elseif param == 36 then
                rednet.send(t, "PlaceForward")
          elseif param == 22 then
                rednet.send(t, "PlaceUp")
          elseif param == 50 then
                rednet.send(t, "PlaceDown")
------------------
          elseif param == 45 then
                rednet.send(t, "EndTurtle")
                textutils.slowPrint("Ended program on the")
                textutils.slowPrint("current Turtle and closed")
                textutils.slowPrint("it\'s Rednet connection.")
                print("--------------------------")
          elseif param == 44 then
                rednet.send(t, "EndBoth")
                run = 0
                rednet.close("back")
                textutils.slowPrint("Ended program on both")
                textutils.slowPrint("machines.")
                sleep(0.75)
                textutils.slowPrint("Closed rednet connection.")
          end
        end
  end
end
rednet.open("back")
function Menu()
term.clear()
print("--------------------------")
print("WASD to move.")
print("E to rise.")
print("Q to fall.")
print("F to dig forward.")
print("R to dig up.")
print("C to dig down.")
----- Dav's Additions ---
print("= to select slot.")
print("G to suck forward.")
print("T to suck up.")
print("B to suck down.")
print("H to drop forward.")
print("Y to drop up.")
print("N to drop down.")
print("J to place forward.")
print("U to place up.")
print("M to place down.")
----------------
print("X to stop current Turtle.")
print("Z to exit.")
end
Menu()
RoxMaster()