Hello all, apologies for the noob question.
I've decided to start work on a simulation game due to my masochistic tendencies, and have just about everything figured out save one bit of functionality.
The game will involve queuing up short work orders and I can easily use GetSeconds() command and a couple variables to pull it off. I don't necessarily need the accuracy of the Timer() function and I've heard it can be wonky cross platform.
My snag comes from when the player wants to save and quit the game with timers running. I think I may have just figured it out as I'm typing this post but since I'm at work napkin coding I may as well finish writing this for the sake of confirmation...
So if I make my work order arrays...
WorkStart[10] as Integer
WorkCurrent[10] as Integer
WorkFinish[10] as Integer
ResumeWork[10] as Integer
...Then I start working...
WorkStart[1] = GetSeconds()
WorkFinish[1] = WorkStart[1] + 30
Do
WorkCurrent[1] = GetSeconds()
If WorkCurrent[1] => WorkFinish[1]
Print("Job's done!")
EndIf
Loop
...And if I quit...
Function SaveGame()
ResumeWork[1] = GetSeconds()
File = FileToWrite("SaveData.dat", 0)
If WorkCurrent[1] < WorkFinish[1]
WriteInteger (File, ResumeWork[1])
WriteInteger (File, WorkFinish[1])
EndIf
CloseFile(File)
EndFunction
...And finally when we load...
Function LoadGame()
File = OpenToRead ("SaveData.dat")
ResumeWork[1] = ReadInteger(File)
WorkFinish[1] = ReadInteger(File)
WorkCurrent[1] = GetSeconds() + ResumeWork[1]
CloseFile
EndFunction
In production I'd of course use For loops to check against all active work orders, but for the sake of example I just used 1.
So now that I think I answered my own question, I have to ask if I got the correct answer. Thanks!