Posted 25 February 2015 - 11:50 PM
The preamble:
I am very new to computer craft and decided to take it on this last week. I took my usual approach to just about everything and found something that kinda worked for what I wanted and started reverse engineering and modifying it. Due to using this approach, I don't know if what I'm experiencing is a bug with the mod, an error with the original LUA or something I messed up in the modification.
I basically wanted a turtle that would plant a single tree, and harvest/replant in a loop until I either stopped it or it ran out of resources. I found such a beast in: http://turtlescripts.com/file/gjdhn6
Of course me being me, I decided I wanted it to be able to do a bit more, so I added in a few new steps and a function, basically allowing it to refresh it's resources as it went along as well as ending up where it started no matter why it needed to backtrack, ending up with this: http://pastebin.com/T6fgFah8
The difference from the original being an optional chest on either side of the planted sapling each one carrying one or the other of more saplings or more bonemeal, with a mandatory 3rd chest empty on the opposite side of the sapling from the turtle as a dumping ground for slot #2 so that it would never over fill on logs. The only way I could make this work (with my very limited skill set at this point) beyond the initial setup was to fill all the slots from 1 to 13 with a log of the tree/sapling type (though really it could be anything, so long as #1 is of appropriate tree type). leaving 14 filled with bonemeal, 15 filled with the saplings and 16 filled with fuel.
The problem:
Everything goes off without a hitch but I find that if an entity of any type passes underneath the turtle while it's on either it's ascent or descent it will stop in mid air once it's done harvesting. The 1st time this happened I had thought I'd lost my turtle someplace - having wandered off due to some poor programming on my part, only to spot it sometime later hovering about 15 or so blocks in the air (pine is my current tree of choice for its ROI). After some testing to try to replicate what happened, it seems to be entity related, be it me, a zombie or even a fallen sapling.
I've managed to get it to park where it starts no matter the reason for it backtracking (out of bonemeal and waiting for the tree to pop or out of a critical resource). It's just the freezing in mid air that bugs me. The only thing I'd really like to add is a way to interrupt the program when this happens in hopes of resetting it back down to the ground without having to break it and physically set it on the ground at the starting point. This would allow me to run some kind of secondary reset program so it continues on it's merry way down the the ground and back into position, but that's for me to figure out at this stage :blink:/>. Of course it would all be unnecessary if I can find out what it is (possibly in my code) that causes the stoppage and what the work around is, if there is one.
I am very new to computer craft and decided to take it on this last week. I took my usual approach to just about everything and found something that kinda worked for what I wanted and started reverse engineering and modifying it. Due to using this approach, I don't know if what I'm experiencing is a bug with the mod, an error with the original LUA or something I messed up in the modification.
I basically wanted a turtle that would plant a single tree, and harvest/replant in a loop until I either stopped it or it ran out of resources. I found such a beast in: http://turtlescripts.com/file/gjdhn6
Of course me being me, I decided I wanted it to be able to do a bit more, so I added in a few new steps and a function, basically allowing it to refresh it's resources as it went along as well as ending up where it started no matter why it needed to backtrack, ending up with this: http://pastebin.com/T6fgFah8
The difference from the original being an optional chest on either side of the planted sapling each one carrying one or the other of more saplings or more bonemeal, with a mandatory 3rd chest empty on the opposite side of the sapling from the turtle as a dumping ground for slot #2 so that it would never over fill on logs. The only way I could make this work (with my very limited skill set at this point) beyond the initial setup was to fill all the slots from 1 to 13 with a log of the tree/sapling type (though really it could be anything, so long as #1 is of appropriate tree type). leaving 14 filled with bonemeal, 15 filled with the saplings and 16 filled with fuel.
The problem:
Everything goes off without a hitch but I find that if an entity of any type passes underneath the turtle while it's on either it's ascent or descent it will stop in mid air once it's done harvesting. The 1st time this happened I had thought I'd lost my turtle someplace - having wandered off due to some poor programming on my part, only to spot it sometime later hovering about 15 or so blocks in the air (pine is my current tree of choice for its ROI). After some testing to try to replicate what happened, it seems to be entity related, be it me, a zombie or even a fallen sapling.
I've managed to get it to park where it starts no matter the reason for it backtracking (out of bonemeal and waiting for the tree to pop or out of a critical resource). It's just the freezing in mid air that bugs me. The only thing I'd really like to add is a way to interrupt the program when this happens in hopes of resetting it back down to the ground without having to break it and physically set it on the ground at the starting point. This would allow me to run some kind of secondary reset program so it continues on it's merry way down the the ground and back into position, but that's for me to figure out at this stage :blink:/>. Of course it would all be unnecessary if I can find out what it is (possibly in my code) that causes the stoppage and what the work around is, if there is one.