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

Detecting Current Weather and Biomes

Started by gustavowizard, 04 July 2014 - 04:14 AM
gustavowizard #1
Posted 04 July 2014 - 06:14 AM
Hey guys, i could use some help with this program below, it detects the current daytime (i got a separated one for time)
i need to add lines to make it detect also the current Weather (Rain, Thunder, Clear) and Biome (ocean, etc), but i dont know the parameters.


m = peripheral.wrap("left")
m.setBackgroundColor(colors.black)
m.clear()
m.setTextScale(0.5)
while true do
--shell.run("clear")
local time = os.time()
--local formattedTime = textutils.formatTime(time,true)
m.clear()
m.setCursorPos(5,1)
m.setTextColor(colors.blue)
m.write("GEODATA")
if time > 5 and time < 6 then
t = "SUNRISE"
elseif time > 6 and time < 12 then
t = "MORNING"
elseif time > 12 and time < 18 then
t = "AFTERNOON"
elseif time > 18 and time < 19.5 then
t = "SUNSET"
elseif time > 19.5 and time < 21 then
t = "EVENING"
else
t = "NIGHT"
end

m.setTextColor(colors.lime)
m.setCursorPos(1,3)
m.write("TIME: "..t)
sleep(.5)
end

http://pastebin.com/GD5SsS7i

i can use OpenCCSensors (with World Sensor) if needed, but also dont know the parameters

thank you guys
Lyqyd #2
Posted 04 July 2014 - 06:31 AM
Check out the information sensorview displays when using the world sensor. You'd getTargetDetails("CURRENT"), I believe, then index details for things like IsRaining, if I recall correctly.
gustavowizard #3
Posted 04 July 2014 - 04:04 PM
yeah i tried it but the thing is that the World Sensor dont give me any information at all (not working, it shows 'no sensor card'. you think it might be disable?

i tried this code i found on pastebin, but its outdated (its from 2012), i dont know what to change/update on it to make it work:

reading=sensors.getSensorReadingAsDict(conside,weatherSensor,target,areaProbe)
raining=reading.isRaining
thunder=reading.isThunderStorm

if thunder then
theWeather="Thunder"

http://pastebin.com/F7bVB42e
Lyqyd #4
Posted 04 July 2014 - 04:29 PM
That code is for ccSensors, not OpenCCSensors. The world sensor bug got reported a week or two ago. I can't remember whether I put out an updated build with the fix. You could check the topic to see. If not, I can get one put together soon.
gustavowizard #5
Posted 04 July 2014 - 04:56 PM
hum im using the last version 1.6.4.4, so i guess its off for now them, i will wait for the 1.6.4.5. right?
thanks a lot lyqyd
gustavowizard #6
Posted 04 July 2014 - 08:43 PM
hey cant i do this without the sensor just like i did with the daytime?
gustavowizard #7
Posted 06 July 2014 - 07:56 AM
i mean there is a os.time to get time, isnt there some kind of os.biome or os.weather? - sorry its a noob question but just to make me understood :D/>
Lyqyd #8
Posted 07 July 2014 - 03:32 PM
No, the computers don't have anything built in for that, there's no reason for them to. You might be able to use some combination of a turtle, a comparator and a cauldron as a rain detector, but that won't help you detect stormy conditions, only rainy/not rainy.
gustavowizard #9
Posted 07 July 2014 - 08:39 PM
oh ok them i will wait for your fix, thanks again mate
gustavowizard #10
Posted 16 July 2014 - 01:51 AM
i should say "make me understand" not "make me understood" lol sorry for that :P/>
Bomb Bloke #11
Posted 16 July 2014 - 02:44 AM
While that's technically acceptable grammar, it'd generally be better to use "help me understand".