This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
TyDoesMC's profile picture

RC turtle

Started by TyDoesMC, 15 February 2014 - 05:51 PM
TyDoesMC #1
Posted 15 February 2014 - 06:51 PM
Hello, Toxic is back!, today I made a remote control turtle program.
To use it place a turtle and a computer and install, then use (arrow keys and r - backspace)
arrow keys to move and r for redstone on and backspace to turn it off.
It will automaticly mine when its blocked.
I might update it more if you want me to.
btw enter to place blocks!

Video by me:
http://www.youtube.com/watch?v=M7vec2MO21M

program

Console:

function remote()
while true do
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if (param == 200) then
rednet.broadcast("forward")
elseif (param == 208) then
rednet.broadcast("backward")
elseif (param == 203) then
rednet.broadcast("left")
elseif (param == 205) then
rednet.broadcast("right")
elseif (param == 28) then
rednet.broadcast("place")
elseif (param == 19) then
rednet.broadcast("rs")
elseif (param == 14) then
rednet.broadcast("rsoff")
end
end
end
end
print("what side is your modem on?")
local side = read()
rednet.open(side)
term.clear()
textutils.slowPrint("Connection success!")
print("use arrow keys to move and r - backspace for movment and redstone on off.")\
remote()
Turtle:

function car()
while true do
local scrap, message = rednet.receive()
if message == "forward" then
print("forward")
if turtle.detect() == true then
turtle.dig()
end
turtle.forward()
elseif message == "backward" then
print("back")
turtle.back()
elseif message == "left" then
print("left")
turtle.turnLeft()
elseif message == "right" then
turtle.turnRight()
elseif message == "place" then
if turtle.detect() == true then
print("no where to place")
else
print("block placed")
turtle.place()
end
elseif message == "rs" then
rs.setOutput("front", true)
elseif message == "rsoff" then
rs.setOutput("front", false)
end
end
end
rednet.open("right")
textutils.slowPrint("Controller connected.")
car()
thankyou.
Edited on 18 February 2014 - 03:24 PM
Lyqyd #2
Posted 15 February 2014 - 08:45 PM
Moved to Turtle Programs.
unobtanium #3
Posted 16 February 2014 - 01:53 PM
Would be cool if you can select the turtle slots from 1-9 with your keys on the keyboard :)/>
TyDoesMC #4
Posted 17 February 2014 - 01:59 PM
@UNOBTANIUM If you would like ill update this I got good ideas for it :D/>, keep telling me what to add and ill try my best.
TyDoesMC #5
Posted 17 February 2014 - 02:33 PM
Updated! now has slot selection and up and down movement!!!
keys:
number 1 moves up and number 2 moves down (the 1-2 keys are the numbers above the letters)
the number pad to the right is for slot selection, im sorry I dont have time I only added up to slot 4 (can only select 1234)

Console:

--[[ Console ]]--
function remote()
while true do
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if (param == 200) then
rednet.broadcast("forward")
elseif (param == 208) then
rednet.broadcast("backward")
elseif (param == 203) then
rednet.broadcast("left")
elseif (param == 205) then
rednet.broadcast("right")
elseif (param == 28) then
rednet.broadcast("place")
elseif (param == 19) then
rednet.broadcast("rs")
elseif (param == 14) then
rednet.broadcast("rsoff")
elseif (param == 79) then
rednet.broadcast("select1")
elseif (param == 80) then
rednet.broadcast("select2")
elseif (param == 81) then
rednet.broadcast("select3")
elseif (param == 75) then
rednet.broadcast("select4")
elseif (param == 2) then
rednet.broadcast("up")
elseif (param == 3) then
rednet.broadcast("down")
end
end
end
end
print("what side is your modem on?")
local side = read()
rednet.open(side)
term.clear()
textutils.slowPrint("Connection success!")
print("use arrow keys to move and r - backspace for movment and redstone on off.")\
remote()

Turtle:

--[[ Turtle ]]--
function car()
while true do
local scrap, message = rednet.receive()
if message == "forward" then
print("forward")
if turtle.detect() == true then
turtle.dig()
end
turtle.forward()
elseif message == "backward" then
print("back")
turtle.back()
elseif message == "left" then
print("left")
turtle.turnLeft()
elseif message == "right" then
turtle.turnRight()
elseif message == "place" then
if turtle.detect() == true then
print("no where to place")
else
print("block placed")
turtle.place()
end
elseif message == "rs" then
rs.setOutput("front", true)
elseif message == "rsoff" then
rs.setOutput("front", false)
elseif message == "select1" then
turtle.select(1)
elseif message == "select2" then
turtle.select(2)
elseif message == "select3" then
turtle.select(3)
elseif message == "select4" then
turtle.select(4)
elseif message == "up" then
turtle.up()
elseif message == "down" then
turtle.down()
end
end
end
rednet.open("right")
textutils.slowPrint("Controller connected.")
car()

Im planing to add a function to place a sign with text on it meaning: push a button "f1" ect. and it brings a gui and you type then the turtle place's it infront!
keep in mind Im new to lua and this may take awhile, Im working on mini updates untill I get a good Non buggy version of the sign placing!.
thanks for the awesome nice support and polite criticism!
Edited on 18 February 2014 - 03:21 PM
TyDoesMC #6
Posted 18 February 2014 - 03:38 PM
Updated! now have diging up and down!
use 3-4 3=down 4=up
new function!
ctrl + f1 now shuts off the turtle

console:

--[[ Console ]]--
function remote()
while true do
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if (param == 200) then
rednet.broadcast("forward")
elseif (param == 208) then
rednet.broadcast("backward")
elseif (param == 203) then
rednet.broadcast("left")
elseif (param == 205) then
rednet.broadcast("right")
elseif (param == 28) then
rednet.broadcast("place")
elseif (param == 19) then
rednet.broadcast("rs")
elseif (param == 14) then
rednet.broadcast("rsoff")
elseif (param == 79) then
rednet.broadcast("select1")
elseif (param == 80) then
rednet.broadcast("select2")
elseif (param == 81) then
rednet.broadcast("select3")
elseif (param == 75) then
rednet.broadcast("select4")
elseif (param == 2) then
rednet.broadcast("up")
elseif (param == 3) then
rednet.broadcast("down")
elseif (param == 4) then
rednet.broadcast("digdown")
elseif (param == 5) then
rednet.broadcast("digup")
elseif (param == 29) and (param == 59) then
rednet.broadcast("shutdown")
end
end
end
end
print("what side is your modem on?")
local side = read()
rednet.open(side)
term.clear()
textutils.slowPrint("Connection success!")
print("use arrow keys to move and r - backspace for movment and redstone on off.")\
remote()

turtle:

--[[ Turtle ]]--
function car()
while true do
local scrap, message = rednet.receive()
if message == "forward" then
print("forward")
if turtle.detect() == true then
turtle.dig()
end
turtle.forward()
elseif message == "backward" then
print("back")
turtle.back()
elseif message == "left" then
print("left")
turtle.turnLeft()
elseif message == "right" then
turtle.turnRight()
elseif message == "place" then
if turtle.detect() == true then
print("no where to place")
else
print("block placed")
turtle.place()
end
elseif message == "rs" then
rs.setOutput("front", true)
elseif message == "rsoff" then
rs.setOutput("front", false)
elseif message == "select1" then
turtle.select(1)
elseif message == "select2" then
turtle.select(2)
elseif message == "select3" then
turtle.select(3)
elseif message == "select4" then
turtle.select(4)
elseif message == "up" then
turtle.up()
elseif message == "down" then
turtle.down()
elseif message == "digdown" then
turtle.digDown()
elseif message == "digup" then
turtle.digUp()
elseif message == "shutdown" then
rednet.close("right")
os.shutdown()
end
end
end
rednet.open("right")
textutils.slowPrint("Controller connected.")
car()
Edited on 18 February 2014 - 03:21 PM
TyDoesMC #7
Posted 18 February 2014 - 04:19 PM
now updated!! placing signs now Added!!!!!!!!!!!!!!!!!
please note this is buggy still, please report any bugs!
known bugs:
doesn't place with text sometimes.
Im working on an update ASAP!

console:

--[[ Console ]]--
function remote()
while true do
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if (param == 200) then
rednet.broadcast("forward")
elseif (param == 208) then
rednet.broadcast("backward")
elseif (param == 203) then
rednet.broadcast("left")
elseif (param == 205) then
rednet.broadcast("right")
elseif (param == 28) then
rednet.broadcast("place")
elseif (param == 19) then
rednet.broadcast("rs")
elseif (param == 14) then
rednet.broadcast("rsoff")
elseif (param == 79) then
rednet.broadcast("select1")
elseif (param == 80) then
rednet.broadcast("select2")
elseif (param == 81) then
rednet.broadcast("select3")
elseif (param == 75) then
rednet.broadcast("select4")
elseif (param == 2) then
rednet.broadcast("up")
elseif (param == 3) then
rednet.broadcast("down")
elseif (param == 4) then
rednet.broadcast("digdown")
elseif (param == 5) then
rednet.broadcast("digup")
elseif (param == 29) and (param == 59) then
rednet.broadcast("shutdown")
end
end
end
end
print("what side is your modem on?")
local side = read()
rednet.open(side)
term.clear()
textutils.slowPrint("Connection success!")
print("use arrow keys to move and r - backspace for movment and redstone on off.")\
remote()

turtle:

--[[ Turtle ]]--
function car()
while true do
local scrap, message = rednet.receive()
if message == "forward" then
print("forward")
if turtle.detect() == true then
turtle.dig()
end
turtle.forward()
elseif message == "backward" then
print("back")
turtle.back()
elseif message == "left" then
print("left")
turtle.turnLeft()
elseif message == "right" then
turtle.turnRight()
elseif message == "place" then
if turtle.detect() == true then
print("no where to place")
else
print("block placed")
turtle.place(message)
end
elseif message == "rs" then
rs.setOutput("front", true)
elseif message == "rsoff" then
rs.setOutput("front", false)
elseif message == "select1" then
turtle.select(1)
elseif message == "select2" then
turtle.select(2)
elseif message == "select3" then
turtle.select(3)
elseif message == "select4" then
turtle.select(4)
elseif message == "up" then
turtle.up()
elseif message == "down" then
turtle.down()
elseif message == "digdown" then
turtle.digDown()
elseif message == "digup" then
turtle.digUp()
elseif message == "shutdown" then
rednet.close("right")
end
end
end
write("Custom message: ")
message = read()
cmessage = message
rednet.open("right")
textutils.slowPrint("Controller connected.")
car()
Edited on 18 February 2014 - 03:20 PM
Agoldfish #8
Posted 21 February 2014 - 12:45 PM
Can you please put that code in spoliers or something everytime you update!

Besides that, I was gonna do this. Darn. D:
TyDoesMC #9
Posted 27 February 2014 - 05:53 PM
Updated! now can drop items with "Q"

SpoilerConsole:
–[[ Console ]]–
function remote()
while true do
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if (param == 200) then
rednet.broadcast("forward")
elseif (param == 208) then
rednet.broadcast("backward")
elseif (param == 203) then
rednet.broadcast("left")
elseif (param == 205) then
rednet.broadcast("right")
elseif (param == 28) then
rednet.broadcast("place")
elseif (param == 19) then
rednet.broadcast("rs")
elseif (param == 14) then
rednet.broadcast("rsoff")
elseif (param == 79) then
rednet.broadcast("select1")
elseif (param == 80) then
rednet.broadcast("select2")
elseif (param == 81) then
rednet.broadcast("select3")
elseif (param == 75) then
rednet.broadcast("select4")
elseif (param == 2) then
rednet.broadcast("up")
elseif (param == 3) then
rednet.broadcast("down")
elseif (param == 4) then
rednet.broadcast("digdown")
elseif (param == 5) then
rednet.broadcast("digup")
elseif (param == 29) and (param == 59) then
rednet.broadcast("shutdown")
elseif (param == 16) then
rednet.broadcast("dropItem")
end
end
end
end
print("what side is your modem on?")
local side = read()
rednet.open(side)
term.clear()
textutils.slowPrint("Connection success!")
print("use arrow keys to move and r - backspace for movment and redstone on off.")
remote()
Turtle:
–[[ Turtle ]]–
function car()
while true do
local scrap, message = rednet.receive()
if message == "forward" then
print("forward")
if turtle.detect() == true then
turtle.dig()
end
turtle.forward()
elseif message == "backward" then
print("back")
turtle.back()
elseif message == "left" then
print("left")
turtle.turnLeft()
elseif message == "right" then
turtle.turnRight()
elseif message == "place" then
if turtle.detect() == true then
print("no where to place")
else
print("block placed")
turtle.place(message)
end
elseif message == "rs" then
rs.setOutput("front", true)
elseif message == "rsoff" then
rs.setOutput("front", false)
elseif message == "select1" then
turtle.select(1)
elseif message == "select2" then
turtle.select(2)
elseif message == "select3" then
turtle.select(3)
elseif message == "select4" then
turtle.select(4)
elseif message == "up" then
turtle.up()
elseif message == "down" then
turtle.down()
elseif message == "digdown" then
turtle.digDown()
elseif message == "digup" then
turtle.digUp()
elseif message == "shutdown" then
rednet.close("right")
elseif message == "dropItem" then
turtle.drop()
end
end
end
write("Custom message: ")
message = read()
cmessage = message
rednet.open("right")
textutils.slowPrint("Controller connected.")
car()
SherlockHolmes #10
Posted 03 March 2014 - 03:08 AM
This is great! Just one suggestion here, with my experience in Python, I would suggest cleaning up the code a bit (i.e, Adding more functions, add comments, etc). A fantastic way to do this is https://github.com. You can upload your code there and then edit the code, you will have previous versions to refer to. :)/> Awesome work!
Mackan90096 #11
Posted 05 March 2014 - 09:42 PM
Pastebin it. PLEASE
TyDoesMC #12
Posted 07 March 2014 - 06:11 PM
Update! now you can attack and, updater.
bugs:
updater might not work! (sometimes does)

Updater:


--[[ RC Turtle Updater ]]--
consolePastebin = "vKYCszFw"
turtlePastebin = "5Z60wbDj"
programName = "startup"
print("What OS is this? (Turtle, Computer)")
input = read()
if input == "Computer" then
print("Getting Computer OS files...")
shell.run("pastebin get "..consolePastebin.." RC")
elseif input == "Turtle" then
print("Getting Turtle OS files...")
shell.run("pastebin get "..turtlePastebin.." RC")
else
print("[Console] Unkown OS")
end

Spoiler

--[[ Console ]]--
function remote()
  while true do
  local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if (param == 200) then
rednet.broadcast("forward")
elseif (param == 208) then
rednet.broadcast("backward")
elseif (param == 203) then
rednet.broadcast("left")
elseif (param == 205) then
rednet.broadcast("right")
elseif (param == 28) then
rednet.broadcast("place")
elseif (param == 19) then
rednet.broadcast("rs")
elseif (param == 14) then
rednet.broadcast("rsoff")
elseif (param == 79) then
rednet.broadcast("select1")
elseif (param == 80) then
rednet.broadcast("select2")
elseif (param == 81) then
rednet.broadcast("select3")
elseif (param == 75) then
rednet.broadcast("select4")
elseif (param == 2) then
rednet.broadcast("up")
elseif (param == 3) then
rednet.broadcast("down")
elseif (param == 4) then
rednet.broadcast("digdown")
elseif (param == 5) then
rednet.broadcast("digup")
elseif (param == 29) and (param == 59) then
rednet.broadcast("shutdown")
elseif (param == 16) then
rednet.broadcast("dropItem")
elseif (param == 30) then
rednet.broadcast("attack")
end
end
end
end
print("what side is your modem on?")
local side = read()
rednet.open(side)
term.clear()
textutils.slowPrint("Connection success!")
print("use arrow keys to move and r - backspace for movment and redstone on off.")
remote()

Spoiler

--[[ Turtle ]]--
function car()
while true do
local scrap, message = rednet.receive()
if message == "forward" then
print("forward")
if turtle.detect() == true then
turtle.dig()
end
turtle.forward()
elseif message == "backward" then
print("back")
turtle.back()
elseif message == "left" then
print("left")
turtle.turnLeft()
elseif message == "right" then
turtle.turnRight()
elseif message == "place" then
if turtle.detect() == true then
print("no where to place")
else
print("block placed")
turtle.place(message)
end
elseif message == "rs" then
rs.setOutput("front", true)
elseif message == "rsoff" then
rs.setOutput("front", false)
elseif message == "select1" then
turtle.select(1)
elseif message == "select2" then
turtle.select(2)
elseif message == "select3" then
turtle.select(3)
elseif message == "select4" then
turtle.select(4)
elseif message == "up" then
turtle.up()
elseif message == "down" then
turtle.down()
elseif message == "digdown" then
turtle.digDown()
elseif message == "digup" then
turtle.digUp()
elseif message == "shutdown" then
rednet.close("right")
elseif message == "dropItem" then
turtle.drop()
elseif message == "attack" then
turtle.attack()
end
end
end
write("Custom message: ")
message = read()
cmessage = message
rednet.open("right")
textutils.slowPrint("Controller connected.")
car()
TyDoesMC #13
Posted 11 March 2014 - 06:47 PM
Please note: I recently gave permission to daman4567 to add features to RC turtle, any updates from him are his responsability. don't come to me asking for help or reporting bugs to me, if there is a update from him with a bug/error pm him not me otherwise enjoy!
please also note you can ask him for suggestions but I will be making my own version (I dont know atm) Im hoping to have our updates start from the latest Version!.
Ill reply with more info :)/> keep enjoying my program! (our).

-toxic

Bump
Just wanted to say that 1.5_0.1A Is not coming, (the next update) my computer was restored to may 19th 2010 :(/> so Ill have to re-write it and it was over 500 lines long :(/>, Im sorry for those who were looking forward to it.