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

Problem with a program for a turtle.

Started by Delilahtw, 14 February 2013 - 09:30 AM
Delilahtw #1
Posted 14 February 2013 - 10:30 AM
Hello all, I'm new with this mod and I'm learning and trying to do a program
for a turtle, but I have a problem the program works ok sometimes but
sometimes don't work ok. I don't know what happen because if sometimes
works ok I don't understand why other times don't work so….
for the moment I can't continue so If anyone can help me, the help would be nice.

This is the link of pastebin:
http://pastebin.com/4V2TuJAs

And here is an image of the problem I hope that anyone can help me because it's
really strange that result.

Lyqyd #2
Posted 14 February 2013 - 10:32 AM
Split into new topic.

Edit: It looks like something may be obstructing its path when it is trying to back up. Were there any animals or mobs nearby?
Delilahtw #3
Posted 14 February 2013 - 10:55 AM
No no is in peaceful this world is a world for testing and as you can see there aren't mobs an animals in the photo.
Lyqyd #4
Posted 14 February 2013 - 11:11 AM
Aside from the village. The code, while very unwieldy, looks like it would do fine. I suspect something interfered with its rearward movement. Perhaps you stood in the way?

Either way, you could use something like this to move:


local dist = 0
repeat
  if turtle.back() then dist = dist + 1 end
until dist == 10

This will ensure that it only counts successful moves.
Delilahtw #5
Posted 14 February 2013 - 11:28 AM
It's really strange because there isn't anything that interfered with the machine.
Delilahtw #6
Posted 14 February 2013 - 09:21 PM
I don't understand that why that tartle have now hearts and why the code don't work ??
Anyone can help me ?


theoriginalbit #7
Posted 14 February 2013 - 09:24 PM
I don't understand that why that tartle have now hearts
-snip-
Have you looked at the date, there the turtles have hearts as an easter egg.
Shnupbups #8
Posted 14 February 2013 - 09:26 PM
I don't understand that why that tartle have now hearts and why the code don't work ??
Anyone can help me ?
<Snip>
I don't know why your code isn't working, but they have hearts because it's Valentine's Day, and they are not turtles today, they are Love machines.

EDIT: Ninja'd
hoanganhlam #9
Posted 14 February 2013 - 10:14 PM
local dist = 0
repeat
if turtle.back() then dist = dist + 1 end
until dist == 1
theoriginalbit #10
Posted 14 February 2013 - 10:33 PM
Like Lyqyd I cannot see any problems except that something might be getting in its way. Are you standing in its way?


local dist = 0
repeat
  if turtle.back() then dist = dist + 1 end
until dist == 1
firstly on these forums we have code tags please them :)/> [code][/code]
secondly if Lyqyd's solution doesn't work, neither would that.
Delilahtw #11
Posted 14 February 2013 - 10:37 PM
Ok thank you l'll try to use the Lyqyd's solution.
Delilahtw #12
Posted 14 February 2013 - 11:49 PM
Finally works perfect the soluction was :)/>

local dist = 11
repeat
if turtle.back() then
dist = dist - 1
end
until dist == 1
dist = 11

Thank you :)/>
Delilahtw #13
Posted 15 February 2013 - 10:01 AM
Thank you thank you thank you to all people of the forum that help to solve my problem :)/>

This is what happen when you have a turtle with a program that convert a turtle into a quarry system.
You only have to put coal (16 should be enough) in the first slot, one cobblestone in the second, one
dirt in the third and one gravel in the fourth and the turtle don't need anymore to do a 10x10 hole
because the program get more coal for the turtle and the program let the cobble, gravel and dirt in the
floor :)/>

This is the pastebin link to the program. If you want to continue o modify my code you have my permission.
http://t.co/wUhSCYS



Computercraft is amazing :)/>