In need of Turtle Programing Help.

  • 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

Ben Kimmich

New Member
Jul 29, 2019
2
0
0
I'm trying to use a turtle to do the following:
1. Remove a Redstone torch from a spot directly in front of the turtle.
2. Wait about 8 minutes and 20 seconds before it places a redstone torch.

3. Wait 6 minutes and 10 seconds then repeats Line item 1.

4. Loops indefinitely (or until runs out of fuel) :cool:

The purpose-

I am trying to use a turtle to place a redstone torch to power a EU Splitter so my MFE has time to regenerate between USE cycles. I have only a most basic understanding of how turtles work, like how they can move and what they can do, I just don't understand the coding well enough. I also assume just a basic turtle can do this or would it need to be a mining or other type? Any help would be great, and I will be sure to credit you in my YouTube FTB LP.

Thanks.
 

Silent_007

New Member
Jul 29, 2019
302
0
0
First, make sure that the redstone torch is in the turtle's very first inventory slot.
Also, just so you know, as long as the turtle doesn't have to move it will never run out of fuel. :D

Try this:
Code:
while true do
    turtle.select(1)
    turtle.place()
    turtle.sleep(500)
    turtle.dig()
    turtle.sleep(370)
end
(The "select(1)" line probably isn't necessary - just a little insurance.)

Should work forever!
Also, depending on how important it is for the turtle to be running all the time, you may want to place that code in a program called "startup" so that it will run every time the turtle/map is loaded. On top of that, a chunk loader may be good too of course.
 

ratchet freak

Well-Known Member
Nov 11, 2012
1,198
243
79
instead of placing a redstone torch just do

Code:
while true do
    redstone.setOutput("front",true)
    turtle.sleep(500)
    redstone.setOutput("front",false)
    turtle.sleep(370)
end

with the redstone API

you can replace front with whatever side the splitter cable is on
 
  • Like
Reactions: Silent_007

Ben Kimmich

New Member
Jul 29, 2019
2
0
0
Thanks for the help guys. I still don't have it working though.

I am using a turtle 1227.

I entered the codeing by doing "edit startup" and saved it.

Then I enter "startup" into the interface.

With Shadow_007's coding, the turtle places the redstone torch and says
>startup:4: attempt to call nil

With ratchet freak's coding, the turtle says
>startup
bios:338: [string "startup"]:4: ')' expected

---------------------------------------------------
I'm not sure if I am not using a turtle that can do the function or what. Is startup not the correct place to have it filed? Any ideas would be great.

Thanks!
 

Silent_007

New Member
Jul 29, 2019
302
0
0
Ah that's my bad.
"turtle.sleep" should just be "sleep".

So:
Code:
while true do
    turtle.select(1)
    turtle.place()
    sleep(500)
    turtle.dig()
    sleep(370)
end

Also, I'm guessing 1227 is a regular turtle, but I'm not positive. You will most likely need a mining turtle. (If you have both RP2 and Misc. Peripherals installed you can use a gem pickax instead of a diamond one to keep the cost down.)

EDIT:
Though I have to admit, ratchet's version is probably better because (a) you don't need your turtle to be a mining turtle, and (b) since it doesn't use a redstone torch, you don't have to worry about the torch getting washed away or destroyed.
The error you're getting with his code sounds like you're just missing a parentheses somewhere... (you'll also have to fix the "sleep" thing I would assume...)