Jump to content

How the hell do ccSensors work?


VideoBoy

Recommended Posts

function pt(t) -- print table

  for k,v in pairs(t) do print(tostring(k).." = "..tostring(v)) end

end

 

sensors.setSensorRange("right", "Sensor", "16") -- short range so only I am detected

 

tTable = sensors.getAvailableTargetsforProbe("right", "Sensor", "LivingEntities")

pt(tTable) -- prints a living entity (me) and my coordinates

 

ent = tostring(tTable[1]) -- my name & coords are displayed, as expected

 

tTable = sensors.getSensorReadingAsDict("right", "Sensor", ent, "LivingEntities")

pt(tTable) -- EMPTY! NOTHING DISPLAYED!

It didn't work so I grabbed the ccSensors/console program, copied it to my computer, found the call to getSensorReadingAsDict() and made it display exactly what parameters were being passed to the function and then crash the program. Turns out the official ccSensors program is passing THE EXACT SAME PARAMETERS as my program passes to the same function, yet mine doesn't work. This is bizarre. I dun get. Has someone successfully coded for the ccSensors API? There's barely any information for it out there.

(I want to hook up a player name detector to my base so it can execute item evac and self destruct in the case someone ever finds it.)

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...