olseric 0 Posted August 13, 2004 Anyone know of a simple way to find out if the sun is shining or not? Tried polling a streetlamp (i.e. on at night, off during day), however, that didn't work. And...setting it by the hour doesn't work because of the season difference (i.e. sun up earlier in the summer). Share this post Link to post Share on other sites
bn880 5 Posted August 13, 2004 No way other than streetlamp AFAIK. Using knowsabout returns daytime as well, not light level. Share this post Link to post Share on other sites
PLRSniper 3 Posted August 13, 2004 DayTime shows what time it is... Try to find a way of defining the date in game??? I'll return here later and try to crack your egg.. I need this too! Share this post Link to post Share on other sites
olseric 0 Posted August 13, 2004 You'd think there would be a simple command for this, wouldn't ya? Â I mean, there's gotta be something in the internal game coding that drives the streetlamps in AUTO mode. I suppose if someone was ambitious, you could prolly figure it out simply by "waiting" in game and determining sunrise and sunset on both the summer and winter solstace and then calculating the rate of time increase between the two. Â I would suspect that it's set so it's a steady incline/decline. I just hope daylight savings time isn't in play here. ;) If I have some time in the next couple days, maybe I'll try and write out a function for it. If I do, I'll make sure you get a copy, sniper. Share this post Link to post Share on other sites
PLRSniper 3 Posted August 13, 2004 Make sure to use SetAccTime so you dont have to wait SetAccTime 1000 would be just fine i suppose Then ten minutes would pass every seond i think. I Could do this as well, actually im going to check this now! But i hoped there would be some way of finding out the ingame date... Well anyways i will try to come up with an easy sullotion now Share this post Link to post Share on other sites
PLRSniper 3 Posted August 13, 2004 OK! *Sigh* I made this script that will determine if lights are on... <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; DayTime calculation script by PLRSniper... ; 1 January _DayOfYear = 1 ; 1 July ; _DayOfYear = 182 ; 31 December ; _DayOfYear = 365 ?(_DayOfYear < 183): _LightsOffTime = 7.2 - ((_DayOfYear / 183) * 2.119) ?(_DayOfYear > 183): _LightsOffTime = 7.2 - 2.107 + (((_DayOfYear / 183) * 2.119) - 2.107) ?(_DayOfYear < 183): _LightsOnTime = 16.8 + ((_DayOfYear / 183) * 2.119) ?(_DayOfYear > 183): _LightsOnTime = 16.8 + 2 .107 + (((_DayOfYear / 183) * 2.119) - 2.107) #Loop Hint Format["Time: %1\n\nLights on: %2", DayTime, _Lights] ?(DayTime < _LightsOffTime): _Lights = True ?(DayTime > _LightsOffTime): _Lights = False ?(DayTime > _LightsOnTime): _Lights = True ~0.1 ?(Alive Player): Goto "Loop" Exit To execute type <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] Exec "DayTime.Sqs" You dont have to name it DayTime.Sqs  Anyways...   It's a little bit off by 10 seconds to maybe 1 minute but it's all about finetuning it a little bit more! So you could do that yourself if you like... Have fun! BTW: Dont forget to change _DayOfYear to the appropriate day of your "mission". That's what i needed a DATE command for! Share this post Link to post Share on other sites
olseric 0 Posted August 14, 2004 Looks great! The only problem is, you need to set it to check from June 22nd and December 22nd - the two solstaces as they are respectively, the longest and shortest days of the year. But, for rough and quick, great job! Share this post Link to post Share on other sites
PLRSniper 3 Posted August 14, 2004 I know this olseric  But i made a quick and rough draft as i told you Edit: It's up to you to fine tune that parts Share this post Link to post Share on other sites
olseric 0 Posted August 14, 2004 LOL! Â Okay, I'll try and work on that part of it then. -EDIT- From the research labs, I have determined: Equinox days: Approx sunrise 6AM, sunset 6PM there is 2:30 of additional sunlight during the summer solstace (1:15 each way) and 2:30 of less sunlight during the winter solstace (1:15 each way). Share this post Link to post Share on other sites
olseric 0 Posted August 14, 2004 Haven't tested this yet as I did it while at my desk here at work, however, it should work: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;Header Information _days = 0 _month = missionStart select 2 _day = missionStart select 3 _hour = daytime _month = _month - 1 ;Determine Day of the Year #MonthLoop ?(_month == 0):goto "LoopEnd" _dayssofar = _days ;30 days has SEP, APR, JUN, & NOV :) ?(_month == 2):_days = _days + 28 ?(_month == 9) OR (_month == 4) OR (_month == 6) OR (_month == 11):_days = _days + 30 ?(_dayssofar == _days):_days = _days + 31 _month = _month - 1 goto "MonthLoop" #LoopEnd ;Day of the Year Calculation _dayofyear = _days + _day ;Calculate days from an equinox _equinox = 0 ?(_dayofyear < 80):_equinox = _dayofyear - 80 ?(_dayofyear > 80):_equinox = _dayofyear - 80 ?(_dayofyear > 172):_equinox = 265 - _dayofyear ?(_dayofyear > 265):_equinox = 265 - _dayofyear ?(_dayofyear > 356):_equinox = _dayofyear - 445 ;Calculate Sunrise/Sunset _sunrise = ((_equinox * -.013889) + 6) _sunset = ((_equinox * .013889) + 18) ;Change stuff below to suit...examples listed. if (_hour < _sunrise) OR (_hour > _sunset) then {hint "It's Dark!"} else {hint "It's Light!"} The actual dates of the solstaces and equinoxes may need to be adjusted to fit the game, but I tested it on paper and it seems to work well. Share this post Link to post Share on other sites