View Full Version : Quering ambient light in script
khun
March 11th, 2007, 03:52 AM
Hi!
I can't find any examples of how to query ambient light in a script?
I have a script where I want something like:
if AmbientLight[OutsideLight] is darker or = Mostly light then
...
end
Thanks!
Promixis
March 16th, 2007, 12:43 PM
Hi, you can open the ambient light lua file in the luascript dir. I haven't had a chance to look at it for you yet.
khun
March 17th, 2007, 08:39 AM
After looking a little at AmbientLight.lua, I found the solution:
local OutsideLight = AmbientLight.GetAreaObject("OutsideLight")
if (not OutsideLight) then
gir.LogMessage("OutsideLight", "Not found", 1)
elseif (OutsideLight.Level < 5) then -- Mostly light or darker
... whatever
end
Thanks!
honnt
June 7th, 2007, 04:42 AM
I'm REALLY struggling with Component/Device manager concepts, and it doesn't look like the above code is applicable anymore since the upgrade from SunRiseSet to SunriseSunset. Can I get an updated lua snippet to query the current AmbientLight level for one/more locations, please?
Thanks in advance,
Promixis
June 7th, 2007, 06:14 AM
I'm REALLY struggling with Component/Device manager concepts, and it doesn't look like the above code is applicable anymore since the upgrade from SunRiseSet to SunriseSunset. Can I get an updated lua snippet to query the current AmbientLight level for one/more locations, please?
Thanks in advance,
Terry, this has changed for G5. See my post there.
honnt
June 7th, 2007, 07:36 AM
Terry, this has changed for G5. See my post there.
Lol...thanks, Mike...didn't even notice that this was in the G4 forum...
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.