392 posts
Posted 04 November 2012 - 02:22 PM
So I have made a pretty good quarry program, and there are no bugs with it at all as far as I have found. Now I tried to run two turtle with the same program at the same time (program transferred via disk drive), and the first one went off without a hitch, but the second one just got stuck on the fueling stage. I then waited until the other turtle was done and then this turtle worked just fine. Now this program uses all global variables, so are global variables set for all separate computers and turtles? Because that would be the only reason I could think of…
Also, no it does not interact with rednet.
839 posts
Location
England
Posted 04 November 2012 - 02:51 PM
Yes, global variables are separate for each turtle/computer. Each computer/turtle has it's own global environment, otherwise a global variable could be accessed across all turtles/computers, which isn't very good if you are on a server with lots of people.
If you want the turtles to communicate with each other, you'll need to use rednet and modems.
392 posts
Posted 04 November 2012 - 02:56 PM
No you see the problem is that they do not run when the program is run separately on each turtle at the same time. They do both work when the other isn't running though.
From what you've said though, I don't understand what is wrong.
If it helps, here is the refueling code.
--Getting Fuel
while fuel < volume do
print("Fuel Needed")
print("Put Fuel in Bottom Right")
print("Press any key when placed")
os.pullEvent("char")
screen(1,1)
turtle.select(16)
Nfuel = turtle.getItemSpace(16)
for i = 1, Nfuel do
fuel = turtle.getFuelLevel()
if fuel < volume+100 then
turtle.refuel(1)
else
i = 65 --Breaks the for
end
end
end