SyntaxBomb - Indie Coders

Languages & Coding => AGK => Topic started by: Pfaber11 on September 15, 2019, 02:41:21 PM

Title: timer()
Post by: Pfaber11 on September 15, 2019, 02:41:21 PM
Good afternoon I have a problem I hope some kind person can shed some light on. I need to subtract 20 seconds off the timer() time is this possible.?
something like timer() = timer()- 20 but this does not work. anyone know a solution?
Title: Re: timer()
Post by: Steve Elliott on September 15, 2019, 03:45:07 PM
Read up on the GetMilliseconds() command.  A 1000 milliseconds in a second.
 
https://www.google.co.uk/url?sa=t&source=web&rct=j&url=https://www.appgamekit.com/documentation/Reference/Core/GetMilliseconds.htm&ved=2ahUKEwi6vu_Wh9PkAhXHa8AKHVdhB1oQFjAAegQICBAC&usg=AOvVaw3osYq40UcubDUlSVsSFnaN
Title: Re: timer()
Post by: Dabz on September 15, 2019, 07:13:55 PM
Timer, GetMilliseconds etc etc is the amount of time since the app was started, and as such, you cannot take away or add anything to the internal clock, but, you can store the current time in the internal timer then minus whatever from that:-

dim timeMinus20sec as int = GetSeconds() - 20

Then use that, or like Steve says, if you use GetMilliseconds, you need to minus 20000...

dim timeMinus20sec as int = GetMilliseconds() - 20000

The only way you can change the internal timer that I know of is using ResetTimer, and as it suggests, it returns the internal clock back to 0, which, is a good idea if your game is to be left open for quite a while.

Dabz
Title: Re: timer()
Post by: Pfaber11 on September 17, 2019, 03:40:34 AM
I think I've got it sorted bit late for starting now but will take a look tomorrow . Just spent 7 hours getting rid of the bugs and yes I've backed up . It's worth it when it all comes together . Biggest program I've wrote so far . Gonna add one more feature  bit of a polish and it's done . Still running nice and smooth.