3 posts
Posted 05 November 2012 - 06:55 AM
I want to make my Melee turtles attack when they detect redstone- please help, I need a step by step guide no 'Start writing a program' stuff because I dont know how to do that, Just tell me what I have to type EXACTLY please help, Thanks.
351 posts
Posted 05 November 2012 - 07:41 AM
SIDE = "back" -- options: front, back, left, right, top, bottom
while true do
os.pullEvent("redstone")
if redstone.getInput(SIDE) then
print("Die scoundrel")
turtle.attack()
end
end
I haven't exactly tested it, but it should work. :D/>/>
3 posts
Posted 05 November 2012 - 07:57 AM
comes Up with lua:1: attempt to index ? (a nil value)
351 posts
Posted 05 November 2012 - 08:07 AM
You probably put in the side without quotes?
3 posts
Posted 05 November 2012 - 08:11 AM
Nope did that too still came up
818 posts
Posted 05 November 2012 - 08:39 AM
direction.getInput()? That isn't a command is it?
521 posts
Location
Stockholm, Sweden
Posted 05 November 2012 - 09:03 AM
direction.getInput()? That isn't a command is it?
Nope it isn't, it's:
redstone.getInput("direction")
-- or in this case
redstone.getInput(SIDE)
-- you could even use the short version of the api
rs.getInput("direction")
rs.getInput(SIDE)
351 posts
Posted 05 November 2012 - 09:49 AM
My bad, haha, I wrote that in my head, but something else came out of the fingers… I edited my original post.