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

4 melee turtle's for a 3X3 mobdrop farm

Started by LyG, 04 June 2014 - 08:31 AM
LyG #1
Posted 04 June 2014 - 10:31 AM
i have written a program for 4 turtle in my farm

my code:

function Left()
   turtle.turnLeft()
   turtle.forward()
   turtle.turnRight()
end

function Right()
   turtle.turnRight()
   turtle.forward()
   turtle.turnRight()
end

function row()
   turtle.attack()
   Left()
   turtle.attack()
   Right()
end

while true do
   evt, arg1 = os.pullEvent("redstone")
	  if rs.getInput(Bottom) then
	  row()
   end
end

when everytime i run it i get the error: attack:22: Expected string

i have put a screenshot of the turtle positioning. http://i.imgur.com/qbN6922.jpg
Bubba #2
Posted 04 June 2014 - 02:28 PM
Look at line 22:

if rs.getInput(Bottom) then
...

Bottom is not a variable, and rs.getInput takes a string. It should be:

if rs.getInput("bottom") then
...