Question about Turtles

  • Please make sure you are posting in the correct place. Server ads go here and modpack bugs go here

bigtwisty

New Member
Jul 29, 2019
164
0
0
Programming the computer would be even easier than getting the turtle working. How long do you want each piston to be on for? How many pistons? And do you want the pistons to turn on one right after the other?
 

Furious1964

Well-Known Member
Nov 10, 2012
1,436
70
63
They have to be on for 16 seconds, there are 32 pistons and at the start, the turtle powers something and stops powering it when it leaves. When it reaches the end, it moves forward one block to turn something on and off and then goes back to start. Any yes, pistons have to turn on right after the previous one turns off.
 

bigtwisty

New Member
Jul 29, 2019
164
0
0
So the order is this:

Power object for 16 seconds
Power piston 1 for 16 seconds
Power piston 2 for 16 seconds
.
.
.
Power piston 32 for 16 seconds
Start over
Right?
 

bigtwisty

New Member
Jul 29, 2019
164
0
0
while true do
for i=0,15 do
redstone.setBundledOutput("left",math.pow(2,i))
os.sleep(16)
end
redstone.setBundledOutput("left",0)
redstone.setOutput("back",true)
os.sleep(16)
redstone.setOutput("back",false)
for i=0,15 do
redstone.setBundledOutput("right",math.pow(2,i))
os.sleep(16)
end
redstone.setBundledOutput("right",0)
end
 

Furious1964

Well-Known Member
Nov 10, 2012
1,436
70
63
So the order is this:

Power object for 16 seconds
Power piston 1 for 16 seconds
Power piston 2 for 16 seconds
.
.
.
Power piston 32 for 16 seconds
Start over
Right?

After the last piston (the 32nd one), it pulses a signal to turn off Phase 2. You missed that last one.
 

Furious1964

Well-Known Member
Nov 10, 2012
1,436
70
63
Yes. First one shuts down the machine (and keeps it off as long as there's a redstone signal), 2nd to 32nd are pistons and last one shuts off Phase 2 of the build process.
 

bigtwisty

New Member
Jul 29, 2019
164
0
0
So you do the same kind of thing, but with colored bundled cable coming out of 3 sides of the computer.

Or make 34 computers with the following code and wrap a redstone signal around from the last back to the first. You can start the first cycle with a button press, or do some extra coding to the first computer to make it automatically start on load.

while true do
os.pullEvent("redstone")
if redstone.getInput("left") then
redstone.setOutput("back",true)
redstone.setOutput("right",false)
os.sleep(16)
redstone.setOutput("back",false)
redstone.setOutput("right",true)
end
end

Or just use 34 redstone repeaters.
 

Furious1964

Well-Known Member
Nov 10, 2012
1,436
70
63
Holy Crap, this is getting complicated.

Off-Topic: making a mob farm and I video posted by JRefleX93 gave the following code:

Code:
function dropItems()
    for num = 1, 16 do
      turtle.select(num)
      turtle.dropDown()
    end
    turtle.select(1)
end
 
count = 0
 
while (turtle.getItemCount(16) == 0) do
    turtle.attack()
    count = count + 1
    if(count % 10 == 0) then dropItems() end
    sleep(0.5)
end

I would like to have it run on start-up, but an augmented version of the start-up program for the Trenches Turtle doesn't work. How can I make this run when a redstone signal is applied to the left or right sides?
 

casilleroatr

New Member
Jul 29, 2019
1,360
0
0
Do you want to be able to control the turtle with redstone as a manual on off switch or is there going to be a continuous wave of redstone as an automatic feature? The best solution depends on exactly what you want it to do.
 

Furious1964

Well-Known Member
Nov 10, 2012
1,436
70
63
What I'm testing right now is renaming the program to startup so it starts on log on, but I want to see if it runs into any problems first.