Posted 23 March 2013 - 08:56 PM
Ok so what I have going is a line of 17 turtles running the same program on the command of a computer. I want the turtles to send a rednet message to the computer modifying an array key to true each turtle having it's own key. I'm unsure how to send a rednet message to the computer to modify it's specific array key.
So then on the master computer I was trying to get the following to work
I tried doing the program in lua before actually building the program. I was able to set all 17 entries of the array to false but when trying to get the following command to work
for i = 1, 17 do if a = "false" then print("success") end
but it keeps giving me
lua:36: [string "lua"]:1: 'then' expected
So then on the master computer I was trying to get the following to work
a = {} --creates array
for i = 1, 17 do --creates 17 entries into array
a[i] = "false" --sets all 17 entries to false
end
if recieving redstone signal from wireless transmitter(i dont know how to code that) then
for i = 1, 17 do
if a[i] = "true" then
shell.run("move")
sleep(5)
shell.run("dig")
else
sleep(5)
end
end
end
Once all keys in the array are true then the computer moves everything sleeps and runs the dig program on all the computers which is the following
rednet.open("right")
for i = 4, 20 --IDs of the turtles
rednet.send(i, "cycle")
end
I tried doing the program in lua before actually building the program. I was able to set all 17 entries of the array to false but when trying to get the following command to work
for i = 1, 17 do if a = "false" then print("success") end
but it keeps giving me
lua:36: [string "lua"]:1: 'then' expected