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

[1.7.10] OpenPeripheral Addons Sensor

Started by Flexico, 26 November 2018 - 07:46 AM
Flexico #1
Posted 26 November 2018 - 08:46 AM
Ok, I'm trying to gather data on nearby mobs, and I found the functions sensor.getEntityIds("MOB") and put the numbers from that into sensor.getMobData([number]), and that gives me a table. Here I get stuck, because I don't know the keys where the data is stored in the table. How much info can the sensor get about an entity? Name, health, age, etc? I want to use it in several projects, including a wither grinding machine ("If there is a wither present, do X") and a cow farm ("If there are more than 6 cows in the pen, do X").
Lupus590 #2
Posted 26 November 2018 - 07:01 PM
you can list all the keys in a table using this

for key, value in pairs(wrappedPeripheral) do
  print(key..": "..tostring(value))
end
it's probably best to do this in the lua prompt until you know what you need for your program

also, I belive that open peripherals adds a doc folder to root when a peripheral connects
Edited on 26 November 2018 - 06:02 PM