os.loadAPI("ocs/apis/sensor")
local prox = sensor.wrap("back")
local targets = prox.getTargets()
for name, details in pairs(targets) do
print("Raining: " ..details["Name"])
for k, v in pairs(prox.getTargetDetails(name)) do
print(tostring(k)..": "..tostring(v))
end
end
#741
Posted 28 February 2013 - 11:16 AM
#742
Posted 01 March 2013 - 02:55 AM
#743
Posted 01 March 2013 - 03:52 AM
print(tostring(targets[0]))or
print(tostring(targets.Raining))to see if i can reference just that specific value im looking for but alas... no workie ;/
Now, i briefly looked at a couple of lua table tutorials on the net but cant really wrap my head around what kind of table and contents OCS exposes and how i can extract exactly those values im looking for.
Any help - again - is appreciated !!!
#744
Posted 01 March 2013 - 04:07 AM
It shows the temp on the graph, if the temp is above 3000 it sends a bundled cable output and turns the reactor off then when the temp hits 1000 it turns the reactor back on. You can change them by changing the value on MaxTemp and LowestTemp
#745
Posted 01 March 2013 - 04:20 AM
The Geek, on 01 March 2013 - 03:52 AM, said:
print(tostring(targets[0]))or
print(tostring(targets.Raining))to see if i can reference just that specific value im looking for but alas... no workie ;/
Now, i briefly looked at a couple of lua table tutorials on the net but cant really wrap my head around what kind of table and contents OCS exposes and how i can extract exactly those values im looking for.
Any help - again - is appreciated !!!
Well, the raining and daytime values are (I believe) in the target details table. Last time I used the world sensor, there was only one target, named CURRENT. So you would use something vaguely thus:
local details = sensor.call("top", "getTargetDetails", "CURRENT")
if details.Raining then
--it is raining.
end
#746
Posted 01 March 2013 - 05:37 AM
#747
Posted 01 March 2013 - 05:44 AM
Here is what i came up with now:
os.loadAPI("ocs/apis/sensor")
local sns = sensor.wrap("back")
-- print table data func
function prTBL(data)
for i,v in pairs(data) do
print(tostring(i).." - "..tostring(v))
end
end
term.clear()
term.setCursorPos(1,1)
print("---------------------------------")
prTBL(sns.getTargetDetails("CURRENT"))
print("---------------------------------")
local data=sns.getTargetDetails("CURRENT")
print("Biome: "..tostring(data.Biome))
print("---------------------------------")
if data.Raining then
print("It's raining!")
end
if data.Daytime then
print("It's daytime!")
end
#748
Posted 01 March 2013 - 05:58 AM
The Geek, on 01 March 2013 - 05:44 AM, said:
I agree, having to check sensorview to get the name to pull the info can be a pain, esp if you're new and don't know it all. Should be some place where it shows what you can pull from each sensor like if you wanna pull heat then you need to do Variable.Heat, it took me for ever to figure out how they where getting the info but I have caught on to but I still need to check sensor view to get it.
This is the info from the world sensor, for the x y z it uses CURRENT unlike the others that use x y z
RawName> world Raining> false Name> World Thundering> false Biome> DesertHills LightLevel> 15 Dimension> 0 Daytime> true
#749
Posted 01 March 2013 - 10:16 AM
RicardoRedstone, on 01 March 2013 - 05:37 AM, said:
Sorry, no - this would cause far too much server lag.
ihatetn931, on 01 March 2013 - 05:58 AM, said:
The Geek, on 01 March 2013 - 05:44 AM, said:
I agree, having to check sensorview to get the name to pull the info can be a pain, esp if you're new and don't know it all. Should be some place where it shows what you can pull from each sensor like if you wanna pull heat then you need to do Variable.Heat, it took me for ever to figure out how they where getting the info but I have caught on to but I still need to check sensor view to get it.
This is the info from the world sensor, for the x y z it uses CURRENT unlike the others that use x y z
RawName> world Raining> false Name> World Thundering> false Biome> DesertHills LightLevel> 15 Dimension> 0 Daytime> true
This is what /ocs/programs/sensorview is for
#750
Posted 01 March 2013 - 05:23 PM
#751
Posted 02 March 2013 - 11:22 AM
ihatetn931, on 01 March 2013 - 05:23 PM, said:
Yes, but increasing the text scale also decreases the resolution of the traces. Everything on a monitor must use the same scale. If you still wish to increase the scale of the text and the graph traces, simply copy ocs/apis/graph and modify the copy to use a different scale. Look for setTextScale in the draw function. It is currently 0.5.
We will not be increasing the scale in the mod's version of that API.
#752
Posted 02 March 2013 - 11:38 AM
#753
Posted 09 March 2013 - 08:34 AM
#754
Posted 11 March 2013 - 11:39 AM
If redpower is installed, the Sonic Sensor card mk4 returns a "ocs_error" after being called with getTargets. Well, technically the event it throws has "ocs_error" in the first field and the 3rd field is nil, but you know what I mean. This does not happen without redpower. I have tested a few other sensor cards, including lower levels of Sonic Sensor, and they work fine, but I haven't checked all of them.
Reproduced with,
Forge 6.6.2.534
Computercraft 1.5
OpenCCsensors 0.1.4
Redpower 2.0pr6
Apparently, computercraft error handling fails silently on a error message of nil. So whatever program you are running just terminates without an error in this case. I would recommend adding a condition in waitForResponse() for nil events.
#755
Posted 11 March 2013 - 11:49 AM
Watchful11, on 11 March 2013 - 11:39 AM, said:
If redpower is installed, the Sonic Sensor card mk4 returns a "ocs_error" after being called with getTargets. Well, technically the event it throws has "ocs_error" in the first field and the 3rd field is nil, but you know what I mean. This does not happen without redpower. I have tested a few other sensor cards, including lower levels of Sonic Sensor, and they work fine, but I haven't checked all of them.
Reproduced with,
Forge 6.6.2.534
Computercraft 1.5
OpenCCsensors 0.1.4
Redpower 2.0pr6
Apparently, computercraft error handling fails silently on a error message of nil. So whatever program you are running just terminates without an error in this case. I would recommend adding a condition in waitForResponse() for nil events.
#756
Posted 11 March 2013 - 12:06 PM
#757
Posted 11 March 2013 - 12:20 PM
#758
Posted 11 March 2013 - 01:13 PM
abihoooo, on 11 March 2013 - 12:20 PM, said:
Yup already been reported - will be fixed in the next release (will release in the next week). No new features for this release, just stability/bug fixes
#759
Posted 11 March 2013 - 11:12 PM
Kye_Duo, on 11 March 2013 - 11:49 AM, said:
Watchful11, on 11 March 2013 - 11:39 AM, said:
If redpower is installed, the Sonic Sensor card mk4 returns a "ocs_error" after being called with getTargets. Well, technically the event it throws has "ocs_error" in the first field and the 3rd field is nil, but you know what I mean. This does not happen without redpower. I have tested a few other sensor cards, including lower levels of Sonic Sensor, and they work fine, but I haven't checked all of them.
Reproduced with,
Forge 6.6.2.534
Computercraft 1.5
OpenCCsensors 0.1.4
Redpower 2.0pr6
Apparently, computercraft error handling fails silently on a error message of nil. So whatever program you are running just terminates without an error in this case. I would recommend adding a condition in waitForResponse() for nil events.
I'll look into it asap. A world save would also help.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











