October 18, 2019, 06:31:48 PM

Author Topic: timer()  (Read 115 times)

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 357
    • FABERSGAMES
timer()
« 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?
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....

Online Steve Elliott

  • Hero Member
  • *****
  • Posts: 2046
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
Raspbian Buster, pi4 4Gb RAM,1.5Ghz

Offline Dabz

  • Full Member
  • ***
  • Posts: 243
  • Is it cos I is ginger?
    • dabzy.co.uk
Re: timer()
« Reply #2 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
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Offline Pfaber11

  • Sr. Member
  • ****
  • Posts: 357
    • FABERSGAMES
Re: timer()
« Reply #3 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.
Celeron N3060 1.6 ghz duel core  4 Gb ram 32 gig storage  HD400 Graphics 160 gig external hard drive....