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

ccSensors: odd behavior with "getAvailableTargetsforProbe"

Started by hux, 09 November 2012 - 08:40 AM
hux #1
Posted 09 November 2012 - 09:40 AM
I've been putting together a simple program that uses a sensor to query a chest for its inventory contents and then make decisions based on the information that gets returned. When I use it on one of my computers (in single player, creative mode) it works fine. But on my other computer the program appears to stop halfway through, but with no errors. (To be clear: when I say "computer" here I'm talking about two physical machines in the real world. :unsure:/>/>) After a little debugging, I've traced the problem to the "getAvailableTargetsforProbe()" command. On that second computer, when the program reaches that command it just stops.

Here's the problem:

- sensors.getAvailableTargetsforProbe(left,Sensor,InventoryContent): works fine on one computer, doesn't work on the other
- sensors.getAvailableTargetsforProbe(left,Sensor,"3"): works fine on both computers

So the issue, it looks like, is the "InventoryContent" part. If I replace it with its corresponding table number (as shown by the result of "sensors.getProbes(left,Sensor)") everything works.

Any idea what's going on here? Maybe I'm running different versions of CC (I'm not able to check right now) and this was a bug that was fixed?
Cruor #2
Posted 09 November 2012 - 09:42 AM
Programs is for finished programs, moved to Ask a Pro.
Lyqyd #3
Posted 09 November 2012 - 11:11 AM
What's going on there is that the InventoryContent variable probably doesn't contain what you think it should contain at that point.

If you want a better answer, post the whole code for the working and non-working programs and any error messages.
remiX #4
Posted 10 November 2012 - 06:46 AM
You probably made some stupid mistake :unsure:/>/> Like Lyqyd, if you need help, you will need to post your code and indicate where the error is.