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

Using Advanced Wireless Pocket Computer to send a Turtle commands

Started by Ajax, 30 May 2015 - 03:31 AM
Ajax #1
Posted 30 May 2015 - 05:31 AM
So I'm trying to make a neat program that will allow me to tell my wireless turtle commands using my pocket computer to make my turtle to do stuff. Here is what I have written out to make it mine downward in a stair-like way (Mining down and forward, etc)

function getMessage(x)
if x == "stairs" then
  local running = true
  if turtle.getFuelLevel() == 0 then
   running = fales
  end
  if turtle.digDown() then
   turtle.down()
   if turtle.dig() then
	turtle.forward()
   end
  end
  while running do
   if turtle.digDown() then
	turtle.dig()
	turtle.down()
	turtle.dig()
	while not turtle.forward() do
	 turtle.dig()
	end
   end
   if turtle.getFuelLevel == 0 then
	running = false
   end
  end
end  
end

rednet.open("right")
while true do
id, message = rednet.receive()
if id == 7 then
  getMessage(message)
end
end

The issue I'm having with this is it doesnt do anything whenever I run this and use a rednet.send([id of turtle], "stairs") message on my pocket computer. Doesn't pull up an error for my code whenever I execute it and it doesn't pull an error for my rednet.send(). I honestly do not know where to go from this.
Bomb Bloke #2
Posted 30 May 2015 - 07:24 AM
Possibilities you haven't reported as ruled out:

The pocket computer's ID might not be 7.

The turtle might not be fuelled.

There might not be any blocks under the turtle (it'll only continue so long as turtle.digDown() keeps returning true, and you can't dig what isn't there).

Although it won't trigger an error, you've also got a misspelt "false" in there.

Still stuck? Put some print statements in so you can figure out which lines are being executed.