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

Semi-Automatic Arboretum/Logger Program

Started by JustPingo, 02 January 2013 - 02:25 AM
JustPingo #1
Posted 02 January 2013 - 03:25 AM
Hi everyone !

Of course, I will say the classic : "Sorry for my english, I'm French". :P/>
I created a nice arboretum/logger program, semi automatic, works without Forestry (or with, if you want) !

Features :
Spoiler- Plant tree like a arboretum, without humus.
- Cut trees like a logger (only for snow biome trees).
- Compatible with Forestry loggers.
- Rebootable.
- Can take fuel, sapling and put wood to some differents points.
- The course size and figure is fully configurable.

How to use :
SpoilerFirst, if you use the logger function, you must use snow biome wood. Without, it will work but often, oak wood has strange figures.
Next, config your turtle like this if you use the logger function :



Or like this if you don't use the logger function :



You must configure the course of the turtle, example :



Sand = Tree at right
Gravel = Turn right
Sandstone = Turn left
Wood plank = Take fuel from right
Glass = Take sapling from right
Stone = Put wood to right (only if the logger function is enabled)
Cobblestone = Course, put it to go along the course by the left.

If, at a point, you can't place cobble to the left, put dirt where the turtle won't walk (see the screenshot).

Of course, you can change the type of blocs used, so you must also change the blocs in the turtle. But I thinks my blocs are very easy to have.

Next, edit the program, and set the config. The logger mode doesn't take sapling from the ground, if you don't use this function, use a Forestry logger.

Fuel the turtle one time, then put it next to cobble, in your course. Give it some sapling in the slot to, start the program and enjoy !

Download :
Spoilerpastebin get qLLMdrgp arboretum

http://www.pastebin.com/qLLMdrgp

Script :
Spoiler

-- "OH MY GOD ! A French program ! I didn't know that there is civilised French guys !" you are saying :D/>/>
-- (don't worry, the text is in English and in French)'

-- Config
  -- Quantité de fuel minimale avant refuel
  -- Minimal quantity of fuel before refuel
  fueltorefuel = 500
  -- Utiliser la fonction logger ?
  -- Use the logger function ?
  uselogger = false

-- Fonctions
function checkLoggerChest()
turtle.select(9)
if turtle.compareDown() == true then
turtle.select(3)
quantite = turtle.getItemCount(3) - 1
if not quantite == 0 then
turtle.turnRight()
turtle.drop(quantite)
turtle.turnLeft()
end
end
end

function checkPlant(logger)
turtle.select(15)
local comparaison
comparaison = turtle.compareDown()
if comparaison == true then
if turtle.getItemCount(2) >= 2 then
turtle.turnRight()
if turtle.detect() == false then
turtle.select(2)
turtle.place()
end
if logger == true then
turtle.select(10)
if turtle.compare() == true then
turtle.select(3)
while turtle.detect() do
turtle.dig()
if turtle.detectUp() == true then
turtle.digUp()
end
turtle.up()
end
while turtle.down() do
end
end
end
turtle.turnLeft()
end
end
end

function checkSapling()
turtle.select(14)
local comparaison
comparaison = turtle.compareDown()
if comparaison == true then
turtle.select(2)
turtle.turnRight()
turtle.suck()
turtle.turnLeft()
end
end

function checkTurnLeft()
turtle.select(11)
local comparation
comparation = turtle.compareDown()
if comparation == true then
turtle.turnLeft()
end
end

function checkTurnRight()
turtle.select(12)
local comparation
comparation = turtle.compareDown()
if comparation == true then
turtle.turnRight()
end
end

function checkDirection()
turtle.select(16)
if turtle.compare() == true then
turtle.turnRight()
else
turtle.turnLeft()
if turtle.compare() == true then
turtle.turnRight()
else
turtle.turnLeft()
if turtle.compare() == true then
turtle.turnRight()
else
turtle.turnLeft()
if turtle.compare() == true then
turtle.turnRight()
else
while true do
turtle.turnLeft()
if turtle.detect() == false then
turtle.forward()
if turtle.compare() == true then
turtle.turnRight()
break
else
turtle.turnLeft()
if turtle.compare() == true then
turtle.turnRight()
break
else
turtle.turnLeft()
if turtle.compare() == true then
turtle.turnRight()
break
else
turtle.turnLeft()
if turtle.compare() == true then
turtle.turnRight()
break
else
print("Erreur lors de la detection du chemin.")
shell.run("lnerkelnbel")
end
end
end
end
end
end
end
end
end
end
end

function checkFuel(minfuel)
turtle.select(13)
local comparation
comparation = turtle.compareDown()
if comparation == true then
if turtle.getFuelLevel() <= minfuel then
turtle.turnRight()
turtle.select(1)
turtle.suck()
turtle.refuel(63)
print("Refueled ! Current fuel level : "..turtle.getFuelLevel())
turtle.turnLeft()
end
end
end


-- Programme
print("Working...")
checkDirection()
while true do
checkTurnLeft()
checkTurnRight()
checkFuel(fueltorefuel)
checkSapling()
checkPlant(uselogger)
if uselogger == true then
checkLoggerChest()
end
turtle.forward()
end

-- By pingoleon60
-- You can distribute the program if you say that the creator is pingoleon60.
-- All of the code here is by me.

-- Par pingoleon60
-- Vous pouvez distribuer le programme si vous dites que le createur est pingoleon60.
-- Tous les codes ici présents sont de moi.


Related bugs :
SpoilerNothing

Enjoy !
abculatter_2 #2
Posted 02 January 2013 - 01:24 PM
http://www.computercraft.info/forums2/index.php?/topic/7712-rebootable-turtle-arboretum-replacement-and-rp2-automated-flax-farmer/

(Sorry for self-plug, but yeah, pretty sure mine should do it better.)
Doyle3694 #3
Posted 02 January 2013 - 01:41 PM
abculatter, it isn't a competion about which program is the best on doing this or that. If he has made a program, and you already have a similar program, then great! Means the consumer can pick between 2 programs and choose the one fitting him or her the best.

Now to not make yourself look like a total douche, I recommend you should take away the link from the post.
Leo Verto #4
Posted 02 January 2013 - 02:15 PM
(Sorry for self-plug, but yeah, pretty sure mine should do it better.)
But this one does not require any other mods.
JustPingo #5
Posted 02 January 2013 - 05:05 PM
http://www.computerc...ed-flax-farmer/

(Sorry for self-plug, but yeah, pretty sure mine should do it better.)

I saw your program, but my program don't need other mods. And, maybe yours is better than mine, but I made this program to improve myself and post it here to have the opinion of more exprienced coders. And, it's an other program, it works differently, with advantage and disadvantage compared to yours.