Posted 16 October 2012 - 08:35 PM
I've made code to keep track of my nuclear reactor and my mfsu's on a monitor, that's all and fine.
Problem is, the code I made targets …say… a MFSU as a target, not filtering it out as an MFSU first.
So if I got the sensorprobe with like 240 targets due to alot of cables and stuff laying around (this is actually the case right now and it's a nightmare), then stuff is prone to go bad fast.
Meaning if I remove or add a cable or similar object, I can (and have…several times) screwed up the program.
You will obviously see the program ending itself, due to the fact that by removing or adding an object similar to the one placed before, the target I made in the code has changed place in the table.
I've tried to read up on some "find" and such for tables, but the examples seem to be very vague..
Can someone help me filter out the targets correctly?
Problem is, the code I made targets …say… a MFSU as a target, not filtering it out as an MFSU first.
So if I got the sensorprobe with like 240 targets due to alot of cables and stuff laying around (this is actually the case right now and it's a nightmare), then stuff is prone to go bad fast.
Meaning if I remove or add a cable or similar object, I can (and have…several times) screwed up the program.
You will obviously see the program ending itself, due to the fact that by removing or adding an object similar to the one placed before, the target I made in the code has changed place in the table.
I've tried to read up on some "find" and such for tables, but the examples seem to be very vague..
Can someone help me filter out the targets correctly?
ctrl = sensors.getController()
data = sensors.getSensors(ctrl)
mainSensor = data[1]
probes = sensors.getProbes(ctrl,mainSensor)
EnergyProbe = data[1]
targets = sensors.getAvailableTargetsforProbe(ctrl,mainSensor,EnergyProbe)
EnergyTarget1 = targets[105] -- See the problem here? Had search manually and count on the sensorprobe to 105 just to get a lock on the target.. in this case an MFSU between alot of cables..
data1 = sensors.getSensorReadingAsDict(ctrl,mainSensor,EnergyTarget1,EnergyProbe)