GTA Style RealTime...
I'm using these in a game Im doing, And they Might be useful to SomeOne Else...
So here you go...
SetRealTime(Day,Hour,Minute) - Place this at the Start of your Programme to Set the Time
UpdateRealTime() - Place this at the Start of your Loop
Get24HourTime() - Get the Time in 24 Hour format as a String, Ie: Text 10,10,Get24HourTime()
GetDay() - Get the Day as a String, Ie: Text 10,20,GetDay()
RealTime.Update - This Indicates if An Update was Made, Ie: I Minute Has Passed
` RealTime Functions
`
` By Michael Mihalyfi
` MSon648@Hotmail.com
`
` SetRealTime(Day,Hour,Minute) - Place this at the Start of your Programme to Set the Time
`
` UpdateRealTime() - Place this at the Start of your Loop
`
` Get24HourTime() - Get the Time in 24 Hour format as a String, Ie: Text 10,10,Get24HourTime()
`
` GetDay() - Get the Day as a String, Ie: Text 10,20,GetDay()
`
` RealTime.Update - This Indicates if An Update was Made, Ie: I Minute Has Passed
`
` ----------------------------------------------------------------------------------------------
Sync On
Sync Rate 0
SetRealTime(1,6,0)
Do : Cls : UpdateRealTime()
If RealTime.Update = 1
` Code can Go here...
EndIf
Text 10,10,Get24HourTime()
Text 10,20,GetDay()
Sync
Loop
` RealTime Functions ----------------------------------------------------------------------------------------------
Function SetRealTime(Day,Hour,Minute)
GoSub SetupRealTime
RealTime.Day = Day
RealTime.Hour = Hour
RealTime.Minute = Minute
RealTime.RealTimer = Timer()
RealTime.Update = 1
EndFunction
Function UpdateRealTime()
If RealTime.RealTimer + 1000 <= Timer()
RealTime.RealTimer = Timer()
RealTime.Minute = RealTime.Minute + 1
If RealTime.Minute = 60 Then RealTime.Minute = 0 : RealTime.Hour = RealTime.Hour + 1
If RealTime.Hour = 25 Then RealTime.Hour = 0 : RealTime.Day = RealTime.Day + 1
If RealTime.Day = 8 Then RealTime.Day = 1
RealTime.Update = 1
Else
RealTime.Update = 0
EndIf
EndFunction
Function Get24HourTime()
If RealTime.Hour < 10 Then Hour$ = "0" + Str$(RealTime.Hour ) Else Hour$ = Str$(RealTime.Hour )
If RealTime.Minute < 10 Then Minute$ = "0" + Str$(RealTime.Minute) Else Minute$ = Str$(RealTime.Minute)
Time$ = Hour$ + ":" + Minute$
EndFunction Time$
Function GetDay()
If RealTime.Day = 1 Then ExitFunction "Monday"
If RealTime.Day = 2 Then ExitFunction "Tuesday"
If RealTime.Day = 3 Then ExitFunction "Wednesday"
If RealTime.Day = 4 Then ExitFunction "Thursday"
If RealTime.Day = 5 Then ExitFunction "Friday"
If RealTime.Day = 6 Then ExitFunction "Saturday"
If RealTime.Day = 7 Then ExitFunction "Sunday"
EndFunction ""
` --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SetupRealTime: Type System_Type_RealTime
Day As Integer
Hour As Integer
Minute As Integer
Update As Integer
RealTimer As Integer
EndType
` GTA3 Style RealTime (1 Second = 1 RealTime Minute)
Global RealTime As System_Type_RealTime
Return
Edit:
To make it look like it does in GTA you need something like this
http://forum.thegamecreators.com/?m=forum_view&t=40880&b=1
Bitmap Fonts...