Anyways, I'm having a LOT of trouble with CCSensors. I don't understand the API at all, I'm trying to get the information for a condenser's current emc etc and what item it is making. Is this possible? If so can someone please explain how I could go about this?
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
CCSensors D:
Started by Sane, 19 December 2012 - 03:46 PMPosted 19 December 2012 - 04:46 PM
This is the 2nd help topic I've posted today, sorry.
Anyways, I'm having a LOT of trouble with CCSensors. I don't understand the API at all, I'm trying to get the information for a condenser's current emc etc and what item it is making. Is this possible? If so can someone please explain how I could go about this?
Anyways, I'm having a LOT of trouble with CCSensors. I don't understand the API at all, I'm trying to get the information for a condenser's current emc etc and what item it is making. Is this possible? If so can someone please explain how I could go about this?
Posted 19 December 2012 - 05:56 PM
well it is not really possible to work with the equivalent exchange module using CCsensors because it is a IC2 an other mods peripheral :(/>
but I really can't help you with CCsensors I don't know much about it myself.
oh and hit the up bottom on the lower right corner of this comment :)/>
but I really can't help you with CCsensors I don't know much about it myself.
oh and hit the up bottom on the lower right corner of this comment :)/>
Posted 19 December 2012 - 06:13 PM
If your using tekkit/technic, there is a EE Sensor Module (I assume its there if you don't use tekkit too) That can get you the current EMC Here is my code for it
As for the checking items thing, do the same process and use a Inventory Sensor Module instead..
PS. Put this at the top of your code
----------------------getEMCInformation-----------------------------------
ctrl = sensors.getController() -- set the Sensor Controler's data
data = sensors.getSensors(ctrl) -- Find and access the Sensor Controler, bring up all avaiable sensors.
EMC = data[3] -- The EE Sensor Module is thrid on the list, pick it, make note of it.
data = sensors.getProbes(ctrl,EMC) -- Bring up a list of avalable options (TargetInfo, Collector, Furnace ect.)
EMCProbe = data[2] -- Pick #5 Because we are using a condesor
data = sensors.getAvailableTargetsforProbe(ctrl,EMC,EMCProbe) -- Get available blocks
EMCPos = data[1] -- Select the first condensor seen
data = sensors.getSensorReadingAsDict(ctrl,EMC,EMCPos,EMCProbe) -- GET THE DATA!!
---------------------printEMC--------------------------
print(data.displayEnergy) -- Print the current reading to the screen
Im fairly new at this so this is probably not the correct way to do it, but it works…As for the checking items thing, do the same process and use a Inventory Sensor Module instead..
PS. Put this at the top of your code
function printDict(data)
for i,v in pairs(data) do
print(tostring(i).." - "..tostring(v))
end
end
and then use printDict(data) whenever your not sure what data[x] your supposed to pick, its helped me lots!Posted 20 December 2012 - 09:04 AM
If your using tekkit/technic, there is a EE Sensor Module (I assume its there if you don't use tekkit too) That can get you the current EMC Here is my code for itIm fairly new at this so this is probably not the correct way to do it, but it works…----------------------getEMCInformation----------------------------------- ctrl = sensors.getController() -- set the Sensor Controler's data data = sensors.getSensors(ctrl) -- Find and access the Sensor Controler, bring up all avaiable sensors. EMC = data[3] -- The EE Sensor Module is thrid on the list, pick it, make note of it. data = sensors.getProbes(ctrl,EMC) -- Bring up a list of avalable options (TargetInfo, Collector, Furnace ect.) EMCProbe = data[2] -- Pick #5 Because we are using a condesor data = sensors.getAvailableTargetsforProbe(ctrl,EMC,EMCProbe) -- Get available blocks EMCPos = data[1] -- Select the first condensor seen data = sensors.getSensorReadingAsDict(ctrl,EMC,EMCPos,EMCProbe) -- GET THE DATA!! ---------------------printEMC-------------------------- print(data.displayEnergy) -- Print the current reading to the screen
As for the checking items thing, do the same process and use a Inventory Sensor Module instead..
PS. Put this at the top of your codeand then use printDict(data) whenever your not sure what data[x] your supposed to pick, its helped me lots!function printDict(data) for i,v in pairs(data) do print(tostring(i).." - "..tostring(v)) end end
Alright, thanks and cheers.
Posted 20 December 2012 - 09:08 AM
That is despicable. You didn't help him at all, then you ask for a +1? -.-oh and hit the up bottom on the lower right corner of this comment :)/>
Posted 20 December 2012 - 09:28 AM
sorry i thought i helped
but i did clear somethings in a way for him/her
but i did clear somethings in a way for him/her
Posted 20 December 2012 - 11:13 AM
sorry i thought i helped
but i did clear somethings in a way for him/her
You didn't help, and you didn't clear anything up. You were completely wrong. Don't try to help if you don't know anything about the solution.
Posted 20 December 2012 - 12:51 PM
Topic update, what does he mean the ee sensor module is third on the list. Third on what list? I'm trying to do this with inventory module right now and I don't understand what he means.
ctrl = sensors.getController() -- set the Sensor Controler's data
data = sensors.getSensors(ctrl) -- Find and access the Sensor Controler, bring up all avaiable sensors.
EMC = data[3] -- The EE Sensor Module is thrid on the list, pick it, make note of it.
data = sensors.getProbes(ctrl,EMC) -- Bring up a list of avalable options (TargetInfo, Collector, Furnace ect.)
EMCProbe = data[2] -- Pick #5 Because we are using a condesor
data = sensors.getAvailableTargetsforProbe(ctrl,EMC,EMCProbe) -- Get available blocks
EMCPos = data[1] -- Select the first condensor seen
data = sensors.getSensorReadingAsDict(ctrl,EMC,EMCPos,EMCProbe) -- GET THE DATA!!
print(data.displayEnergy) -- Print the current reading to the screen
Posted 20 December 2012 - 01:05 PM
It means that whoever wrote that code had at least three sensors attached to their sensor controller, and their EE sensor was the third one.
Posted 20 December 2012 - 02:12 PM
Another topic update, whenever I use this code it doesn't print anything:
ctrl = sensors.getController() -- set the Sensor Controler's data
data = sensors.getSensors(ctrl)
SENSOR = data[1]
data = sensors.getProbes(ctrl,SENSOR)
SENSProbe = data[2]
data = sensors.getAvailableTargetsforProbe(ctrl,SENSOR,SENSProbe)
SENSPos = data[1]
data = sensors.getSensorReadingAsDict(ctrl,SENSOR,SENSPos,SENSProbe)
print(data.TotalItems)
Posted 20 December 2012 - 09:54 PM
Copy pasting that into my game, it prints fine, the only thing different in mine is I create the printDict function first, you sure its not printing anything?
function printDict(data)
for i,v in pairs(data) do
print(tostring(i).." - "..tostring(v))
end
end
ctrl = sensors.getController() -- set the Sensor Controler's data
data = sensors.getSensors(ctrl)
SENSOR = data[1]
data = sensors.getProbes(ctrl,SENSOR)
SENSProbe = data[2]
data = sensors.getAvailableTargetsforProbe(ctrl,SENSOR,SENSProbe)
SENSPos = data[1]
data = sensors.getSensorReadingAsDict(ctrl,SENSOR,SENSPos,SENSProbe)
print(data.TotalItems)
Thats my code that I just tested, prints 0 items for an empty chest.