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

Wireless

Started by shipmaster4000, 22 May 2012 - 02:02 AM
shipmaster4000 #1
Posted 22 May 2012 - 04:02 AM
Hello, could some one give me a short tut on how to make a computer contact a wireless mining bot? I want to make it so then i can make ti tunnel and turn right from my house. Could some one give me a short list of commands?
Luanub #2
Posted 22 May 2012 - 04:10 AM
You have to create your own commands. Here's a small example of what you need to do.

From your computer:

rednet.open("side") -- set to the side of your computer modem is on
rednet.send(turtleID, "forward") -- change turtleID to the turtles computer ID number, "forward" can be anything

The turtle:

local id, msg = rednet.receive() -- wait for an incomming rednet message
if msg == "forward" then -- if message is forward go forward
   turtle.forward()
end
Dirkus7 #3
Posted 22 May 2012 - 08:04 PM
I would put the turtle program in a while loop, so you don't have to restart the program all the time. And you forgot rednet.open("right") on the turtle. So that would be:

rednet.open("right") --a turtle's modem is always on the right side
while true do
local id, msg = rednet.receive() -- wait for an incomming rednet message
if msg == "forward" then -- if message is forward go forward
   turtle.forward()
end
end
for the turtle, and

rednet.open("side") -- set to the side of your computer modem is on
while true do
event, key = os.pullEvent("key")
if key == 200 then -- the up key
rednet.send(turtleID, "forward") -- change turtleID to the turtles computer ID number, "forward" can be anything
end
end
for your computer. Now try making a full remote-control program :P/>/>