Jump to content




Detecting Current Weather and Biomes


  • You cannot reply to this topic
10 replies to this topic

#1 gustavowizard

  • Members
  • 94 posts

Posted 04 July 2014 - 05: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

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 July 2014 - 05: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.

#3 gustavowizard

  • Members
  • 94 posts

Posted 04 July 2014 - 03: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

#4 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 04 July 2014 - 03: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.

#5 gustavowizard

  • Members
  • 94 posts

Posted 04 July 2014 - 03: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

#6 gustavowizard

  • Members
  • 94 posts

Posted 04 July 2014 - 07:43 PM

hey cant i do this without the sensor just like i did with the daytime?

#7 gustavowizard

  • Members
  • 94 posts

Posted 06 July 2014 - 06: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

#8 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 07 July 2014 - 02: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.

#9 gustavowizard

  • Members
  • 94 posts

Posted 07 July 2014 - 07:39 PM

oh ok them i will wait for your fix, thanks again mate

#10 gustavowizard

  • Members
  • 94 posts

Posted 16 July 2014 - 12:51 AM

i should say "make me understand" not "make me understood" lol sorry for that :P

#11 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 16 July 2014 - 01:44 AM

While that's technically acceptable grammar, it'd generally be better to use "help me understand".





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users