YES! (Scripting Success Stories)

Post » Mon Oct 27, 2014 8:20 pm

I just figured out how to get around the problem with local scripts needing day counter without having to make a global script or variable to track them because you're not in the cell every day, and I did it with the minimum variables possible.

All you need to do is this:

If ( currentDay != Day )	Set currentDay to ( Day - currentDay )	Set dayCount to ( dayCount + currentDay )	Set currentDay to DayEndif

It's so damned simple. Why did I never think of this before? Though the first day is guaranteed to run the rest of the script under the dayCount check. That's exactly what I want, but if you didn't, you'd have to add another check to it. Like this:

If ( currentDay != Day )	If ( dayCount > 0 )		Set currentDay to ( Day - currentDay )		Set dayCount to ( dayCount + currentDay )	Else		Set dayCount to 1	Endif	Set currentDay to DayEndif

And then instead of setting dayCount to 0 at the end of the script (if it's a repeatable script), you'd set it back to 1.

I figured I'd share because someone might find it useful, but it's so minor. So, let's make this thread about everyone's little scripting tricks and triumphs.

User avatar
teeny
 
Posts: 3423
Joined: Sun Feb 25, 2007 1:51 am

Return to III - Morrowind