Ricksan Posted October 12, 2007 Author Share Posted October 12, 2007 HI allI added Days, Months yaers, and Seasons to TE.I made a ini file call time to save and load the time and date so that time dose not start over ever time the server starts up.How off ten should I write the time and date to the ini file?and were in the code is a good spot to put it, would it be in it's own sub?This is what I have dine so far.```Private Sub Form_Load()Dim fileName As StringfileName = App.Path & "\Time.ini"Years = GetVar(fileName, "Time", "Year")Months = GetVar(fileName, "Time", "Month")Days = GetVar(fileName, "Time", "Day")Hours = GetVar(fileName, "Time", "Hour")Minutes = GetVar(fileName, "Time", "Min")Seconds = GetVar(fileName, "Time", "Sec")Gamespeed = GetVar(fileName, "Time", "Gamespeed")'Hours = Rand(1, 24)'Minutes = Rand(0, 59)'Seconds = Rand(0, 59)'Gamespeed = 1Wierd = 0End Sub``````Private Sub Timer1_Timer()Dim AMorPM As StringDim TempSeconds As IntegerDim PrintSeconds As StringDim PrintSeconds2 As StringDim PrintMinutes As StringDim PrintMinutes2 As StringDim PrintHours As IntegerSeconds = Seconds + GamespeedIf Seconds > 59 Then Minutes = Minutes + 1 Seconds = Seconds - 60End IfIf Minutes > 59 Then Hours = Hours + 1 Minutes = 0End IfIf Hours > 24 Then Days = Days + 1 Hours = 0End IfIf Days > 31 Then Months = Months + 1 Days = 1End IfIf Months > 14 Then Years = Years + 1 Months = 1End IfIf Hours > 12 Then AMorPM = "PM" PrintHours = Hours - 12Else AMorPM = "AM" PrintHours = HoursEnd IfIf Months >= 1 And Months < 5 Then Seasons = WinterEnd IfIf Months >= 5 And Months < 8 Then Season = SpringEnd IfIf Months >= 8 And Months < 12 Then Season = SummerEnd IfIf Months >= 12 And Months < 15 Then Season = FallEnd IfIf Hours = 24 Then AMorPM = "AM"End IfIf Hours = 1 Or Hours = 4 Or Hours = 8 Or Hours = 12 Or Hours = 16 Or Hours = 20 Or Hours = 23 Then Call PutVar(App.Path & "\Time.ini", "Time", "Min", Minutes) Call PutVar(App.Path & "\Time.ini", "Time", "Hour", Hours) Call PutVar(App.Path & "\Time.ini", "Time", "Day", Days) Call PutVar(App.Path & "\Time.ini", "Time", "Month", Months) Call PutVar(App.Path & "\Time.ini", "Time", "Year", Years) Call PutVar(App.Path & "\Time.ini", "Time", "Season", Seasons)End IfTempSeconds = SecondsIf Seconds > 9 Then PrintSeconds = TempSecondsElse PrintSeconds = "0" & SecondsEnd IfIf Seconds > 50 Then PrintSeconds2 = "0" & 60 - TempSecondsElse PrintSeconds2 = 60 - TempSecondsEnd IfIf Minutes > 9 Then PrintMinutes = MinutesElse PrintMinutes = "0" & MinutesEnd IfIf Minutes > 50 Then PrintMinutes2 = "0" & 60 - MinutesElse PrintMinutes2 = 60 - MinutesEnd IfLabel8.Caption = "Current Time is " & PrintHours & ":" & PrintMinutes & ":" & PrintSeconds & " " & AMorPMIf Hours > 20 And GameTime = TIME_DAY Then GameTime = TIME_NIGHT Call SendTimeToAll End IfIf Hours < 21 And Hours > 6 And GameTime = TIME_NIGHT Then GameTime = TIME_DAY Call SendTimeToAll End IfIf Hours < 7 And GameTime = TIME_DAY Then GameTime = TIME_NIGHT Call SendTimeToAll End IfIf Hours < 21 And Hours > 6 Then Label10.Caption = "Time until night:" Label11.Caption = 21 - Hours - 1 & ":" & PrintMinutes2 & ":" & PrintSeconds2Else Label10.Caption = "Time until day:" If Hours < 7 Then Label11.Caption = 7 - Hours - 1 & ":" & PrintMinutes2 & ":" & PrintSeconds2 Else Label11.Caption = 24 - Hours - 1 + 7 & ":" & PrintMinutes2 & ":" & PrintSeconds2 End IfEnd IfIf Hours > 11 Then GameClock = Hours - 12 & ":" & PrintMinutes & ":" & PrintSeconds & " " & AMorPMElse GameClock = Hours & ":" & PrintMinutes & ":" & PrintSeconds & " " & AMorPMEnd IfCall SendGameClockToAllEnd Sub``` Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now