Spoiler
2
Turtle Invintory Management and Lava Problem
Started by Almerish, Jan 14 2013 02:46 PM
6 replies to this topic
#1
Posted 14 January 2013 - 02:46 PM
I am working on making a simple branch mining program (as shown below), however i seem to be having two problems. First is i am not sure how i am going to handle invintory. I want to make it so that when the turtle's slots get full it gose back to the start of the mine and drops off its invintory in a chest. I already put a code in to drop its invintory at the start of the program, but this is a temporary part of the coding. Second when my turtle hit lava it stoped its script completly. I know this for when i found it in the middle of a lava lake the script was off (it still had about 25,000 fuel if you were wondering). Any help would be apreciated (i do know i haven't put in the coding for gravle yet, but i do know how to do that coding so please don't put a post about it).
#2
Posted 14 January 2013 - 02:57 PM
I usually run a check that says if slot 16 has something in it, go back to the start, unload, and then go back to the position it left off. (actually I say if it's full, drop an enderchest, unload, then pick the enderchest back up).
To go back to the home position, you'll have to keep track of it's position every time it moves in variables like currentX and currentZ and currentY. Then when you need to reload, you go from the currentX to the chestX, then the currentZ to the chestZ, then y... and then back to where you were by doing the reverse.
With the lava problem, I'm not sure why this would be happening to you. I've never had a problem with my turtles in lava. My guess is there is some other factor causing it to stop. Possibly because you only move and dig forward if you detect something.
To go back to the home position, you'll have to keep track of it's position every time it moves in variables like currentX and currentZ and currentY. Then when you need to reload, you go from the currentX to the chestX, then the currentZ to the chestZ, then y... and then back to where you were by doing the reverse.
With the lava problem, I'm not sure why this would be happening to you. I've never had a problem with my turtles in lava. My guess is there is some other factor causing it to stop. Possibly because you only move and dig forward if you detect something.
#3
Posted 14 January 2013 - 03:32 PM
I know how to do the programing for the returning to starting pos and return to the last spot dug. What i don't know is how to make it check to see if slot 16 has something in it. I put in the scripte that it only digs when it detects a block so that it will stop when it finds a cave.
#4
Posted 14 January 2013 - 03:37 PM
if turtle.getItemCount( 16 ) > 0 then print( "There is something in the slot" ) else print( "There isn't" ) end
#7
Posted 14 January 2013 - 04:07 PM
Lol could not resist the urge!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users