Quote Originally Posted by wall_fall_down
I've begun programming a time-of-day situation in which TimeOfDay is a string. Based on the value of the string, I have a lot of If TimeOfDay = "X" Then... / Else If etc. statements going on. The time of day/night is to be updated in-game every 10 minutes (1 game hour) and dawn/dusk both happen in three closely-timed stages (i.e. dawnEarly, dawn, and dawnLate.)

I've also considered trying to shift what hour of the day dawn and dusk occur, based on seasons. And yeah, I'm laughing at myself as well, because I' mreally making this more complex than it should be. But maybe I'm bored or something.

To sum that up, that's a TON of If-Thens inside more If-Thens. Are there any obvious alternatives that I'm missing here? Anything to make the time schedule seem like less of a mess?
When using variables that will have a set of fixed values it will be easier to use a UDT to build your variables and statements...

Ie..
Code:
Public Type Season as Byte
Spring 
Summer
Autum ' Fall
Winter
End type
 
Public type TOD as Byte ' Time of Day
Midnight
EarlyDawn
Dawn
LateDawn
Morning
LateMorning
EarlyAfternoon
' Etc - you get the idea
End type
 
Public GameSeason as Season
Public GameTime as TOD
Public Sunup as TOD
Public Sundown as TOD
then instead of doing if then's with in If thens, rather try to build simple individual functions than can be called independantly ..
Code:
Private Sub SeasonChange
Select case GameSeason
	Case Summer
		Sunup = EarlyDawn
		Sundown = LateDusk
	Case Winter
		Sunup = LateDawn
		Sundown = EarlyDusk
	Case Spring, Autum
		Sunup = Dawn
		Sundown = Dusk
End Select
End sub
 
Private Sub CheckDawnDusk
If GameTime = Sunup Then Msg="The Sun climbs slowly over the mountains" 
If GameTime = Sundown Then Msg="The Sun slips slowly behind the mountains" 
End Sub
Breaking everything down to the simplest function will effectivly leave your main program loop with a few checks and calls to the correct functions.

Also when building up your functions, try to work sequentially, IE: work out the functions for Hours first, then Days, then Seasons and Then Years. or rather start with the years firat and work everything in backwards towards the hours.. IE, Years affect the seasons crop size, Seasons affect the foilage and days temperature, the season affects the days sunup and sundown ...

You have a hell of a project ahead of you, but it will be fun, And many of us will be nearby whenever you need a little help with anything...

Gremmy...