Jump to content

d.hatch75's Content

There have been 1 items by d.hatch75 (Search limited from 29-March 22)

By content type

See this member's

Sort by                Order  

#30108 [MC 1.2.5] - [CC 1.33] ccSensors [SMP/SSP]

Posted by d.hatch75 on 06 September 2012 - 02:33 AM in Peripherals and Turtle Upgrades

I've been following the tutorial here:
but switching the sensor he uses from the world sensor to a proximity sensor, and am having trouble with the getSensorReadingAsDict() function, which doesn't seem to want to work for me at all. I've been on the ComputerCraft wiki and noticed that the function arguments are slightly different to those given in the video, so I rearranged the arguments I passed and still nothing is happening - no reading is made, and no commands after it are performed. I've also tried using the getSensorReadingAsDict2() function in a similar manner, using the arguments described in the wiki page, with just as little luck. Could someone please tell me what's going wrong? In case it isn't obvious, I'm new to LUA, though I have a fair bit of experience with C++ and some Java. I've pasted my code below, thank you for your time:

function printDict(data)
  for i,v in pairs(data) do
	print(tostring(i).." - "..tostring(v))

ctrl = sensors.getController()
-- print("Controller: "..ctrl)
data = sensors.getSensors(ctrl)
-- print("Sensors:")
-- printDict(data)
proxSensor = data[1]
data = sensors.getSensorInfo(ctrl,proxSensor)
-- print("Sensor Info:")
-- printDict(data)
-- print("Sensor Range: "..sensors.getSensorInfo(ctrl,proxSensor).SensorRange)
data = sensors.getProbes(ctrl,proxSensor)
-- print("Probes:")
-- printDict(data)
playerProbe = data[2]

data = sensors.getAvailableTargetsforProbe(ctrl,proxSensor,playerProbe)
-- print("Available Targets:")
-- printDict(data)
data = sensors.getSensorReadingAsDict(ctrl,proxSensor,playerTarget,playerProbe)
print("We have data...apparently...")