timer()

Started by Pfaber11, September 15, 2019, 14:41:21

Previous topic - Next topic

Pfaber11

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?
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz

Steve Elliott

Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Dabz

#2
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

Pfaber11

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.
HP 15s i3 1.2 upto 3.4 ghz 128 gb ssd 16 gb ram 15.6 inch screen. Windows 11 home edition .  2Tb external hard drive dedicated to Linux Mint .
  PureBasic 6 and AppGameKit studio
ASUS Vivo book 15 16gb ram 256gb storage  cpu upto 4.1 ghz