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

Mining Turtle Will Not Use The Shutdown Code

Started by cmckain14, 21 August 2013 - 07:47 PM
cmckain14 #1
Posted 21 August 2013 - 09:47 PM
Hi. Mining code was working until if stopped turning itself off after a inputted number of digs. And yes this is a very basic code but it is the best I got. Also if anyone has an suggestions for my code, please tell me.
http://pastebin.com/QScsh6S4
DaGamer12345 #2
Posted 21 August 2013 - 10:37 PM
If you need to shutdown a turtle you can use this:

if i == 0 then
 --Code (to return to the top maybe?)
 os.shutdown()
end
cmckain14 #3
Posted 21 August 2013 - 10:40 PM
It is not as much a shutdown code but a code that after a sequence of events shuts it down. Sorry for not making that clear.
Last1Here #4
Posted 21 August 2013 - 10:46 PM
It is not as much a shutdown code but a code that after a sequence of events shuts it down. Sorry for not making that clear.

Would you not just put

os.shutdown()
where you want the computer to shut down….? After the 'sequence of events'
cmckain14 #5
Posted 21 August 2013 - 11:01 PM
The problem is not the shutdown itself but the sequence of events before it. Please check the code, I am still VERY new at this(which is why I really can't explain the problem) , so I have not been able to find the problem.
cmckain14 #6
Posted 22 August 2013 - 01:09 AM
Updated code:
Main Turtle: http://pastebin.com/2FAzXh6q
Other Turtles: http://pastebin.com/WrUU807N
Now the problem is the main one is unable to control the other ones and the main one still has the earlier problem. Any help someone could provide could be very helpful.
Thanks,
Noob
Last1Here #7
Posted 22 August 2013 - 06:52 AM
Updated code:
Main Turtle: http://pastebin.com/2FAzXh6q
Other Turtles: http://pastebin.com/WrUU807N
Now the problem is the main one is unable to control the other ones and the main one still has the earlier problem. Any help someone could provide could be very helpful.
Thanks,
Noob

I think the problem you are talking about its with rednet.recieve()


you have
  message = rednet.recieve()
should be
  local senderId, message, distance = rednet.receive()
cmckain14 #8
Posted 22 August 2013 - 07:19 PM
Updated code:
Main Turtle: http://pastebin.com/2FAzXh6q
Other Turtles: http://pastebin.com/WrUU807N
Now the problem is the main one is unable to control the other ones and the main one still has the earlier problem. Any help someone could provide could be very helpful.
Thanks,
Noob

I think the problem you are talking about its with rednet.recieve()


you have
  message = rednet.recieve()
should be
  local senderId, message, distance = rednet.receive()
Tried that, did not work. But it still is not stopping via the "if h <= 1 then", it just keeps on moving even through h does = 1.