Turtle.attack no such program

  • 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

Gijoel

New Member
Jul 29, 2019
5
0
0
Hey there, probably a totally noob question here, but here it goes. Whenever I try to run turtle.attack() on my melee turtle it comes back with no such program.

I've searched around but can't find an answer anywhere. Any help, please?
 
That default command screen is used to run pre-existing programs that you have saved on your turtle. The reason it's saying that is because there is no program on that turtle called turtle.attack().

You need to create a program, and then run it by entering the name of the program on the default screen. If I remember correctly, you make a new program by going like...

Code:
 edit name

and replace 'name' with whatever program name you want.

Of course, I'm probably one of least informed people on these forums in regards to ComputerCraft. Someone more educated on that particular mod will inevitably stumble across this thread.
 
That default command screen is used to run pre-existing programs that you have saved on your turtle. The reason it's saying that is because there is no program on that turtle called turtle.attack().

You need to create a program, and then run it by entering the name of the program on the default screen. If I remember correctly, you make a new program by going like...

Code:
 edit name

and replace 'name' with whatever program name you want.

Of course, I'm probably one of least informed people on these forums in regards to ComputerCraft. Someone more educated on that particular mod will inevitably stumble across this thread.

Jerome, Adeptcraft's owner is pretty knowledgeable about ComputerCraft, he's the one who got me started using turtles. :)

I just don't know how to quote him and give him the "you have been quoted" alert.
 
  • Like
Reactions: Mash
either go to lua, by typing "lua"
and then you can put your command: turtle.attack()

or create a program: edit program_name
write down the commands you want (move, attack , kill & tbag.. :) ), save and exit
and then run you progam by typing his name directly: program_name
 
Also, one easy way to make sure that your program runs all the time (IF that's what you want) is to use "edit startup" to create the program. The startup program will run any time your turtle is rebooted, or the chunk it is in gets reloaded, etc.
 
If you want a continuous attack loop do

"
while true do
turtle.attack()
end
"

Sent from my HTC Desire X using Tapatalk 2
 
  • Like
Reactions: Grydian2
You may want to modify the infinite attack loop so that it only attacks when it detects something to attack (Otherwise it will literally attack all the time). Also you may want to add a sleep command in as well, heard of others having issues when they haven't included it:

I'm at work so not entirely sure if this works (I'll check when I get home), but something like this:
while true do
if turtle.detect() == true then
turtle.attack()
end
sleep(2)
end
 
Oh really? Always thought it did both. I guess I'll be rewriting a couple of programs tonight then...
 
Don't forget, to stop a rogue program, hold Ctrl + T, that is if the program doesn't block it.
 
Yeah, turtle.attack() returns true for attacking mobs only. So while turtle.attack is true do

Sent from my HTC Desire X using Tapatalk 2
 
Oh, I was going to ask "did you forget the sword?" but apparently everyone here knows a lot about turtles. Well, I learned something new as well!
Sent from my Moon Base using a Pair of Cans and a REALLY long piece of string.
 
If you want a continuous attack loop do

"
while true do
turtle.attack()


Sent from my HTC Desire X using Tapatalk 2
I always add a:

turtle.select(1)
turtle.drop()

In the loop. That way it drops what ever it picks up. Its better than filling the turtle with cobble stone or something. If you get a bunch of random drops at a time, I also add in a loop to select slots 1-4 and drop the contents from them.
 
could always be extra lazy and just sit the turtle atop an me import bus. the real trick is ensuring you use some turtle.suck as conveyors and a few other things can get items stuck just in front of the poor turtle at times.
 
Just do:

Lua

then

* commands *

An automatic attack command should be:

edit startup

Then write:

while true do
turtle.attack(side)
end
 
Turtle can only attack in front. What I do is just stick some transposers down, picks up all the drops.

Sent from my HTC Desire X using Tapatalk 2