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

Quick Questions

Started by civilwargeeky, 02 November 2012 - 07:19 AM
civilwargeeky #1
Posted 02 November 2012 - 08:19 AM
So earlier today I was trying to design a system of mining turtles where when they received 2 different rednet signals, then they would all dig down a certain number of blocks, then come back up. All at the same time. So I have a few questions from my failed attempt.
1. Do turtles all share the same variables? (e.g. if two turtles had i=0, i=i+1 at the same time, would i == 2?)
2. How exactly do you make a variable local? ( I tried using for local i=1, var do unsuccessfully)
3. If two turtles are the same (computer ID copied in creative with Labels), are there any adverse effects to them running at the same time?
4. Is there anyway to transfer files to a turtle without using files on my actual computer?
KaoS #2
Posted 02 November 2012 - 08:47 AM
1: no. a variable is specific to the computer ID
2: you use local varname=value, if you are using a for loop then the value is always local to the loop so you do not include local
3: yes, their programming can get confused if they are run on the same computer as if a file is changed on one PC it changes on the other as well so storing your turtle position can be a problem. you cannot send rednet messages from one to another as it sends to all other IDs, you can get around this with signal bouncing posts but it is not easy to make perfect systems like this (it is great for long distance signal transfers though)
4: disk drives and rednet