Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How do I save a timer value to a file

Author
Message
Daniel wright 2311
User Banned
Posted: 2nd Jul 2012 08:53
Ok,so I have a timed game,you have 5 min to finish the leval,so I am doing this but it is not saving the timer,everything else saves just fine,but the timer

ctval is my timer value

write long 1,CTVal

to open it i say

read long 1,CTVal

But,it records as only a 1,so if save at 3 min and 45 sec it still just gives me a 1.

Thanks for any help on this.

my signature keeps being erased by a mod So this is my new signature.
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 2nd Jul 2012 09:30
So you're saying this value each frame with your other data

ie.


write long 1,CTVal
write long 1,Player_Xpos
write long 1,Player_Ypos
write long 1,Player_Zpos

etc etc


Is the timer variable being read each refresh ?

CTVal = Timer()


I'd be more inclined to save the delta time, rather than the actually time anyway.

Something like this (mock up)




Daniel wright 2311
User Banned
Posted: 2nd Jul 2012 10:19 Edited at: 2nd Jul 2012 10:20
Well that did not help my sistuation,that messed up my timer in game,darn,my timer is set with this if it helps,I wish I could figure this out.

if Timer() - CTtimer => 1000
Dec CTVal
CTtimer = Timer()
EndIf

my signature keeps being erased by a mod So this is my new signature.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Jul 2012 14:23 Edited at: 2nd Jul 2012 14:25
Quote: "my timer is set with this if it helps..."


That isn't where your timer is set. That's where it is decreased. Hard to say if you are grabbing it in the right place.

Daniel wright 2311
User Banned
Posted: 3rd Jul 2012 00:47
I figured this out,this is what was wrong,a good lesson to every one


My load in data was not the same as my save data,it was the same values,but not in the same order here is what I mean.

a example of my save code

write long 1,coinscolleted
write long 1,health
write long 1,dragonposition

a example of my load code

read long 1,coinscolleted
read long 1,health
read long 1,dragonposition

but if mixed up,it will not work,this is it mixed

a example of my save code mixed

write long 1,health
write long 1,coinscolleted
write long 1,dragonposition

a example of my load code mixed

read long 1,coinscolleted
read long 1,health
read long 1,dragonposition

my signature keeps being erased by a mod So this is my new signature.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 3rd Jul 2012 04:20
I was going to say GLOBALS here but was it the save - load order?

Daniel wright 2311
User Banned
Posted: 3rd Jul 2012 05:34
Quote: "I was going to say GLOBALS here but was it the save - load order?"


Yes it was,thanks

my signature keeps being erased by a mod So this is my new signature.
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 3rd Jul 2012 05:51
well chuffed with myself tonight

Login to post a reply

Server time is: 2026-07-08 01:55:35
Your offset time is: 2026-07-08 01:55:35