Using a turtle to place an Enderquarry fence

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here
  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Cougar281

New Member
Jul 29, 2019
167
0
0
I've been looking to see if I could find a good way to use a turtle to place an ender quarry boundry fence, and I'm sure it's possible, but I have zero CC skills and what I've found doesn't work.

I found a post that referenced this shape builder code that near as I can tell is supposed to be able to do it. Maybe I'm doing something wrong, but it just didn't work.

What happened was I filled it up with about 10 stacks of fence and one stack of coal - I ran 'Builder', told it I wanted a square, and that I wanted it to be 150 (from what I gather this is supposed to make a 150x150 square one block high) I also tried '10' in case for some reason 150 was too much. What happened was it moved once, ate the entire stack of coal and then just started dropping all the fence out by the stack, then complained that it was empty. I tried this in MP and in SP, both with fence and cobble, both having the same result.

Does anyone have any simple code that would allow a turtle to lay out a square area of fence, even if the size was hardcoded into the program and required editing it to change? And if there was a program that could be run to reclaim the fence afterwards, that would be awesome...
 

Hambeau

Over-Achiever
Jul 24, 2013
2,598
1,531
213
I believe Direwolf did this in either his current "Let's Play" single-player or his Server play series.

I'll look for the episode and edit a link into this reply.

[Edit] I seem to have misremembered. He manually built the fence in Server Play s6e17, unless he moved it in a later episode.
 
Last edited:

kittle

New Member
Jul 29, 2019
229
0
0
Simple UNTESTED program I whipped up
Code:
local width=20
local depth=20

turtle.select(1)
turtle.refuel(1)
turtle.up()
turtle.select(2)

for a=1,2 do
  for x=1,width do
    while turtle.getFuleLevel() < 1
      turtle.select(1)
      turtle.refuel(1)
      turtle.select(2)
    end
    turtle.placeDown()
    while not turtle.forward() do
    end
  end
  turtle.turnRight()

  for x=1,length do
    while turtle.getFuleLevel() < 1
      turtle.select(1)
      turtle.refuel(1)
      turtle.select(2)
    end
    turtle.placeDown()
    while not turtle.forward() do
    end
  end
  turtle.turnRight()

end

put a stack of fuel in slot 1
put a stack of fences in slot 2
and run.. you will need to watch it and refill the fences as it runs out. It will stop if it runs into something.
 

Cougar281

New Member
Jul 29, 2019
167
0
0
I must be the most retarded person alive when it comes to CC - I tried the code from 'Lyqyd' and the modified code from 'Zaflis' on the CC link - with both of those, the turtle just sat there placing and breaking fenceposts. never moved a block. From Narny's reply, it seems that program should work.

Lyqyd's code:
Code:
local selection = 1
turtle.select(1)

local function placeFence()
  turtle.digDown()
  turtle.placeDown()
  if turtle.getItemCount(selection) == 0 then
  selection = selection + 1
  turtle.select(selection)
  end
end

placeFence()
for i = 1, 4 do
  for i = 1, 63 do
  turtle.dig()
  turtle.forward()
  placeFence()
  end
  turtle.turnLeft()
end

Zaflis' code:
Code:
local size = 64

local index = 1
turtle.select(1)
local function place()
  while turtle.detectUp() do
  turtle.digUp()
  end
  turtle.digDown()
  turtle.placeDown()
  if turtle.getItemCount(index) == 0 then
  index = index + 1
  if index > 16 then index = 1 end
  turtle.select(index)
  end
end

place()
for i = 1, 4 do
  for j = 1, size-1 do
  while turtle.detect() do
  turtle.dig()
  end
  turtle.forward()
  place()
  end
  turtle.turnRight() -- Goes clockwise
end
Kittle, I tried your code and that didn't seem to work - there were a few typos that I corrected (turtle.getFuleLevel() <1), but I get
Code:
bios:339: [string "fence3"]:11: 'do'
expected

Thoughts?
 

Geometry

New Member
Jul 29, 2019
468
0
1
I found a handy turtle program on the CC Forums that you can use to place down fences for you. It can also build other various things. Here is the link:
http://www.computercraft.info/forums2/index.php?/topic/11520-the-versatile-shape-builder-updated-260214-now-with-enderchest-refill-mode/page__hl__ block placer

You can use a regular turtle to place down the blocks, but if you have a mining turtle, it will also clear out any blocks in the way. For the people that are unfamiliar with turtles, just type in " pastebin get rahj4r2k Builder " on your turtle and it will download it. Then run the program by typing in " Builder " or whatever you named it. Then type in "square" when it asks you what shape you want it to build, and then after a few other options, type in the area of the square (ex: typing in "8" will do an 8x8). The turtle should start placing down fences after that, and it places the fences underneath itself. Be sure to label your turtle by typing " label set (name you want to set) " and to refuel it by placing fuel in the 1st slot and typing " refuel". I just wanted to throw this out there since most Minecraft players tend to be lazy and find the task of setting some fences down to be painfully tedious :D
 

Cougar281

New Member
Jul 29, 2019
167
0
0
I found a handy turtle program on the CC Forums that you can use to place down fences for you. It can also build other various things. Here is the link:
http://www.computercraft.info/forums2/index.php?/topic/11520-the-versatile-shape-builder-updated-260214-now-with-enderchest-refill-mode/page__hl__ block placer

You can use a regular turtle to place down the blocks, but if you have a mining turtle, it will also clear out any blocks in the way. For the people that are unfamiliar with turtles, just type in " pastebin get rahj4r2k Builder " on your turtle and it will download it. Then run the program by typing in " Builder " or whatever you named it. Then type in "square" when it asks you what shape you want it to build, and then after a few other options, type in the area of the square (ex: typing in "8" will do an 8x8). The turtle should start placing down fences after that, and it places the fences underneath itself. Be sure to label your turtle by typing " label set (name you want to set) " and to refuel it by placing fuel in the 1st slot and typing " refuel". I just wanted to throw this out there since most Minecraft players tend to be lazy and find the task of setting some fences down to be painfully tedious :D

That was actually the first one I tried that ate the entire stack of coal (twice) and just puked the stacks of fence out on the ground... and yes, placing the fences is a pain in the neck - especially when they are up in the air. Picking them up is almost worse.
 

Geometry

New Member
Jul 29, 2019
468
0
1
That was actually the first one I tried that ate the entire stack of coal (twice) and just puked the stacks of fence out on the ground...
That was just a copy and paste since I'm lazy :p If you follow my instructions, it should work without any problems.
 

Mirality

New Member
Jul 29, 2019
62
0
0
If you don't label your turtles they'll lose their fuel and programs if you break them. They might also lose them if the chunk unloads (but I don't think that's the case).

If it's not moving it's a pretty good sign that it's out of fuel. You can check how much it has by using the "refuel" command with the currently selected inventory slot empty.
 

Cougar281

New Member
Jul 29, 2019
167
0
0
If you don't label your turtles they'll lose their fuel and programs if you break them. They might also lose them if the chunk unloads (but I don't think that's the case).

If it's not moving it's a pretty good sign that it's out of fuel. You can check how much it has by using the "refuel" command with the currently selected inventory slot empty.

Well, when it wasn't working before, I had placed a stack of coal into slot 1 and then ran the program - it sucked up the entire stack and then just spit all the fences out by the stack. This time, same turtle and program (I hadn't broken or moved it since my last attempt) worked after I labeled it - that was the only change.

I saw people were using extended drawbridge to place fences.

I had played with the drawbridge - problem there is the extended one only will go out 64 blocks - the others are less.
 

Cougar281

New Member
Jul 29, 2019
167
0
0
I'm Baaaaack! :)

So the 'Builder program ended up working well to put the fence up. I then tried the follwoing code to remove the fence:

local size = 64
turtle.digDown()
for i = 1, 4 do
for j = 1, size-1 do
turtle.dig()
turtle.forward()
turtle.digDown()
end
turtle.turnRight()
end

I had left the turtle right where it had stopped after building the fence, which was where it was started - The remove program took up the first two sides - Heading South, then heading west. Then it turned right one block before the other side of the fence heading North so it missed that side entirely, then it turned right and got all of the fence heading East, and proceeded to overshoot the x-axis that it started on by one block and turn right one block too far east and stopped right next to where it started. Any thoughts as to why it did this?
 

XLT_Frank

New Member
Jul 29, 2019
157
0
0
Here is my turtle code and is tested. It is designed to have three Ender chests. The first has fuel, the second has fences, and the third is your quarry output. The first few lines of code will tell you where to place them. The reason I do this is it will also clean up the fences when told. I don't have Cc 1.6 so I don't have a turtle that can equip a wrench for picking up a tesseract, so you must do that part manually.

The reason why I use Ender chests is because I use more than one quarry and I use translocation to keep the chests loaded.

http://pastebin.com/AZKgWLtu

Feel free to share. If you modify/improve, please share back.

Sent from my Galaxy Nexus using Tapatalk
 

Cougar281

New Member
Jul 29, 2019
167
0
0
Here is my turtle code and is tested. It is designed to have three Ender chests. The first has fuel, the second has fences, and the third is your quarry output. The first few lines of code will tell you where to place them. The reason I do this is it will also clean up the fences when told. I don't have Cc 1.6 so I don't have a turtle that can equip a wrench for picking up a tesseract, so you must do that part manually.

The reason why I use Ender chests is because I use more than one quarry and I use translocation to keep the chests loaded.

http://pastebin.com/AZKgWLtu

Feel free to share. If you modify/improve, please share back.

Sent from my Galaxy Nexus using Tapatalk


Cool, thanks Frank - I'll give it a shot when my current ender quarry run is done. From looking at the code, it looks like when you run the program, it asks you if you want to place or pick up the quarry, then it asks the size - I'm assuming that when you run 'Place Quarry', it does its thing then comes back to where it started, so when you want to pick it all up, you just run it again, telling it to pick up and it'll go around and pick it all up?
 

XLT_Frank

New Member
Jul 29, 2019
157
0
0
Cool, thanks Frank - I'll give it a shot when my current ender quarry run is done. From looking at the code, it looks like when you run the program, it asks you if you want to place or pick up the quarry, then it asks the size - I'm assuming that when you run 'Place Quarry', it does its thing then comes back to where it started, so when you want to pick it all up, you just run it again, telling it to pick up and it'll go around and pick it all up?

That is correct! For placement or pickup, you specify the size. The other thing it does not do is handle mobs being in the way.
 

casilleroatr

New Member
Jul 29, 2019
1,360
0
0
That is correct! For placement or pickup, you specify the size. The other thing it does not do is handle mobs being in the way.
To fix this you could use this code

Code:
while turtle.forward() == false do
end
a movement failure caused by mobs will result in the loop continuing, but the loop will end when the movement is successful.
I haven't actually read your code yet, sorry, I plan to but I am having a hectic evening. I am interested though