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

turtle.attack() reading false

Started by Nighthawk08, 14 April 2013 - 08:33 PM
Nighthawk08 #1
Posted 14 April 2013 - 10:33 PM
What a post to start my membership. There I was, upgrading my xp farm. I replace my melee turtle and type in the familiar command:

if true do
turtle.attack()
sleep(1)
end

Then low and behold, it does not attack. I tried running the API from lua and it just tells me false. I tried attackup and attack down. Ran all around it and even called it bad names, but still no luck.

Any help is appreciated
Cloudy #2
Posted 14 April 2013 - 10:47 PM
What is in front of it when attacking?
superaxander #3
Posted 14 April 2013 - 10:48 PM
It is:
while true do
turtle.attack()
sleep(1)
end
Also you might want to decrease the sleep to like 0.5 or at max 0.05
Dlcruz129 #4
Posted 15 April 2013 - 05:59 AM
It is:
while true do
turtle.attack
sleep(1)
end
Also you might want to decrease the sleep to like 0.5 or at max 0.05

You need parentheses after turtle.attack. .-.
superaxander #5
Posted 15 April 2013 - 07:46 AM
It is:
while true do
turtle.attack
sleep(1)
end
Also you might want to decrease the sleep to like 0.5 or at max 0.05

You need parentheses after turtle.attack. .-.
Oops xD
Nighthawk08 #6
Posted 15 April 2013 - 07:48 AM
Whether I am in front of it or a mob is in front, it does not attack. I tried it with sleep not part of the program, I tried it with (1), (.1)(.2) and nothing changes as the turtle does not even initiate the attack. Attack, attackUp, and attackDown all show false when typed in lua.
Cloudy #7
Posted 15 April 2013 - 08:40 AM
Are you in creative mode or survival? Is the mob directly adjacent? What version of CC?
Nighthawk08 #8
Posted 15 April 2013 - 10:43 AM
*facepalm* I am in survival mode, however the issue was I kept on putting "if true do" instead of "while true do". This can be chalked up to a newb getting confused with coding :-\