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

cactus farm creation program help

Started by dragonist27, 20 March 2014 - 10:53 PM
dragonist27 #1
Posted 20 March 2014 - 11:53 PM
Hello all!

This is my first time programing and was wondering if I was missing anything of if their already was a program to do this.

I need a certain shape built, and it needs to make this exact shape. I have seen the schematic program, and I neither know to use this nor do I think it will fit my needs. There are a few unknown IDs that have to be placed in their connect positions and the sheer amount of blocks is too much for the simple turtle inventory.

to sum it all up, I need a program that builds a shape over and over again (stacked) and I need it to be able to restock from a chest and start again in the correct place.

If a few of you could point me in the correct direction or just show me an already-made program that does the job I need it to that would be great.
Csstform #2
Posted 21 March 2014 - 11:34 AM
What I would do:

Open a for loop.
 for i = 1, 9 do 

This will have the turtle build 9 layers.
Inside of that for loop, run commands to have the turtle move along the wall. Here are the commands to move a turtle:

turtle.forward()
turtle.right()
turtle.left()
turtle.back()
turtle.up()
turtle.down()

Use the forward, back, turn left, and turn right commands to to move him in front of where you want to place the block and use:
 turtle.place()

Continue the above until you have made a loop and have come back to where you started. Then, call the up command to move on to the next layer.

On the matter of checking the inventory, put a function outside of the for loop that can be called. Inside it, check a slot against nil, and if nil, have the turtle go to a chest and use this to pull it out:
turtle.suck()
Bomb Bloke #3
Posted 21 March 2014 - 12:17 PM
Need a looooot more context here. Linking to "the schematic program" would likely be a good start, as the exact skills required depend a little on the variety of blocks in use.

(Though I guess there'd just be, um, sand, cactus and dirt? Or is this some weird deal with pistons or somesuch?)
Edited on 21 March 2014 - 11:29 AM
dragonist27 #4
Posted 21 March 2014 - 02:42 PM
all i need it to do is something like this

looking from the side

stone bricks; x
sand: o
cactus: C

C C C C C C C C C C - the cactus is offset from the others.. (not to scale)
oooooooooooooooo
xxxxxxxxxxxxxxxxxx

I sounds and seems rather simple and more like "csstform's" idea.

Thanks for the feedback, anymore is highly appreciated!