ccSensors, Reactors and Monitors.

Started by arttu80, Mar 09, 2020, 04:23 PM

Previous topic - Next topic

arttu80

If there is two or more targets under one sensor how can I choose which target I am reading? They are close so you can see 6 reactors with one sensor... I have 10 reactors in 5 row. I am doing monitors for each one showing heat,output and if its on also fuel remaining percentage would be nice. I dont have the code yet or any idea how to do it (my old code wasnt working so I am starting from bottom again.) I believe its ccSensors. https://www.computercraft.info/wiki/CcSensors I am talking about tekkit classic. I will start to do script when I know how to choose the target.

EDIT#1
I managed to understand how I can change the sensors and make the first working script. Still I couldnt findout how I could make that fuel meter. I think if I could get just damage value of uranium cell and divide it by 100 (max damage for cells is 10 000) I could make it as percentage. I cant get the damage value. I will leave the script to under.

arttu80

#1
os.unloadAPI("sensors")
os.loadAPI("/rom/apis/sensors")

while true do
sleep(0.1)
term.redirect(peripheral.wrap("right"))
term.clear()
term.setCursorPos(1,1)

ctrl = sensors.getController()
data = sensors.getSensors(ctrl)

reactorSensor = data[1]
--sensor we are using

data = sensors.getSensorInfo(ctrl,reactorSensor)
data = sensors.getProbes(ctrl,reactorSensor)
reactorProbe = data[2]
--what we are reading

data = sensors.getAvailableTargetsforProbe(ctrl,reactorSensor,reactorProbe)
reactorTarget = data[2]
--reactors number on sensor

sensors.setTarget(ctrl,reactorSensor,reactorTarget)
data =      sensors.getSensorReadingAsDict(ctrl,reactorSensor,reactorTarget,reactorProbe)

print("Reactor #10")
print("----------------")
print("Hull temp:"..data.heat.."'C")
print("EU Output:"..data.output)

end


pjals

Quote from: arttu80 on Mar 09, 2020, 06:50 PMos.unloadAPI("sensors")
os.loadAPI("/rom/apis/sensors")

while true do
sleep(0.1)
term.redirect(peripheral.wrap("right"))
term.clear()
term.setCursorPos(1,1)

ctrl = sensors.getController()
data = sensors.getSensors(ctrl)

reactorSensor = data[1]
--sensor we are using

data = sensors.getSensorInfo(ctrl,reactorSensor)
data = sensors.getProbes(ctrl,reactorSensor)
reactorProbe = data[2]
--what we are reading

data = sensors.getAvailableTargetsforProbe(ctrl,reactorSensor,reactorProbe)
reactorTarget = data[2]
--reactors number on sensor

sensors.setTarget(ctrl,reactorSensor,reactorTarget)
data =      sensors.getSensorReadingAsDict(ctrl,reactorSensor,reactorTarget,reactorProbe)

print("Reactor #10")
print("----------------")
print("Hull temp:"..data.heat.."'C")
print("EU Output:"..data.output)

end


You should be indenting the code, also you should but it in a
Code bullet(https://i.imgur.com/Du8hyfi.png) AND use peripheral.find
hi i am T79, bye