Console
function RCmaster() while true do local sEvent, param = os.pullEvent("key") if(sEvent == "key") then if(param == 200) then rednet.broadcast("TS Forward") elseif (param == 208) then rednet.broadcast("TS Backward") elseif (param == 203) then rednet.broadcast("TS TurnLeft") elseif (param == 205) then rednet.broadcast("TS TurnRight") elseif (param == 28) then rednet.broadcast("TS PlaceBlock") end end end end print("What side is your modem on?") local modem = read() rednet.open(modem) term.clear() textutils.slowPrint("TurtleControl Initiated.") print ("Use arrow keys to move and Enter to place blocks.") RCmaster()
Turtle
function RCslave() while true do local scrap, message = rednet.receive() if message == "TS Forward" then print("Forward") if turtle.detect() == true then turtle.dig() end turtle.forward() elseif message == "TS Backward" then print("Backward") turtle.back() elseif message == "TS TurnLeft" then print("Turn Left") turtle.turnLeft() elseif message == "TS TurnRight" then print("Turn Right") turtle.turnRight() elseif message == "TS PlaceBlock" then if turtle.detect() == true then print("Block Present") else print("Place Block") turtle.place() end end end end rednet.open("right") textutils.slowPrint("TurtleReceive Initiated.") RCslave()
This is a very simple remote control turtle program, but I may try to implement a few fancy things. I'm using the Tekkit pack, so unfortunately I can't find the save files for the programs.
ToDo:
Vertical movement and actions
Possible warning if you are stretching the limit of signal range
Not allowing turtles to destroy one another
PS: I'm new to this forum />