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.

Author
Message
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 3rd Jun 2010 20:04
I got his code which should when 5 mins have passed it saves the data then waits another five mins to save it again.



this works OK if when it called it ture (the ready bit is so that it does not work when first fired up), how would I make it work if time1 is just a bit more that the grabsampletime (set at 300)

eg if time1 was 600 then it would work but if time1 was 602 it would not happen.

so how would I get this to work when time1 is greater than mod sample time.

Dark Physics makes any hot drink go cold.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Jun 2010 20:41 Edited at: 3rd Jun 2010 20:46
I think it would be easier to do it like this wouldn't it:



Or dec a counter every second until it hits 0, then save info and reset counter.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 3rd Jun 2010 21:03
thanks Sasuke ,
however someone told me that there a hit timer in the matrix1 uiltils so I am putting that time into time1 which starts at zero and counts upwards saves doing all that timer stuff, however even if I were not using that I still require a way to see that five mins or 300 seconds have passed.

Also due to the fact that my code uses a sleep command this makes it miss the count some times (well so I thought).

Dark Physics makes any hot drink go cold.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Jun 2010 21:55 Edited at: 3rd Jun 2010 21:56
Quote: "however someone told me that there a hit timer in the matrix1 uiltils so I am putting that time into time1 which starts at zero and counts upwards saves doing all that timer stuff,however even if I were not using that I still require a way to see that five mins or 300 seconds have passed"


Yeah, I would use hitimer.

Here's the counter method:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 3rd Jun 2010 22:04 Edited at: 3rd Jun 2010 22:07
If you're going to use matrix1 utils anyway, then there is a handy specific command for regular timed intervals: "ticker".

HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 3rd Jun 2010 22:08
Thank everone, sladeiw saw that command when looking for hitimer, so that what does!

Ok I'll try that and see what happens

cheers.

Dark Physics makes any hot drink go cold.
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 3rd Jun 2010 22:17


Also, if the timer has gone past the `tick` time then it still fires on the next loop. So if you sleep 10 sec past the 300 sec time, it will still return true the next loop, and then the next tick interval will be 290 sec remaining.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Jun 2010 22:21 Edited at: 3rd Jun 2010 22:23
The problem with ticker is I see no way of pausing it other than deleting it and creating a new ticker based on the time left. The reason I'm talking about pausing is if you go into a menu where the game world pauses then the ticker needs to pause. So it would be a pain deleting/recreating or resetting the ticker every time the game pauses.

Edit, though you could set ticker rate to 0 when there's a pause.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
sladeiw
17
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 3rd Jun 2010 22:29
Quote: "The problem with ticker is I see no way of pausing it other than deleting it and creating a new ticker based on the time left."


Yes you can't pause it, or see how long until the next tick. You can reset it and see how many `ticks` you have missed, but ticker time continues whatever your code does.

Maybe a couple of extra commands `ticker pause` and `ticker restart` would be handy.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Jun 2010 00:45
I can't believe I forgot commands like that! It's not really the end of the world though.

The simplest option is simply to reset the ticker when coming out of paused mode, throwing away any ticks that have occurred in the meantime.

Oh, and probably save sometime while in pause mode anyway - if everything is paused, it's not like you have anything else to do really.

Login to post a reply

Server time is: 2026-07-25 16:21:18
Your offset time is: 2026-07-25 16:21:18