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.

Dark GDK / Scheduling events

Author
Message
winged Serpent
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location:
Posted: 18th Aug 2008 07:20
I Was trying to use dbTimer() to create a loop of some sort to dbShowSprite() after a set amount of time but I just can't seem to figure out a good way of doing that. Am I missing something, is there an easier way to schedule events?

Everyday the dreamers die to see whats on the other side.
Swift
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location:
Posted: 18th Aug 2008 10:52
maybe. the way I would make a timer to execute an event however often would look something like this;



so all it is, I created a variable timer and decrement it every step. when timer==0, i execute my timed event and reset the timer.
winged Serpent
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location:
Posted: 19th Aug 2008 00:31
Okay, but how does that actually measure time, that doesn't work for scheduling a certain function to run say 6 seconds after a certain if statement is true. I assume I would need to use dbTimer in there somewhere but I guess I don't really see how to check whether or not its equal to another variable often and quickly so that as soon as 6000 ms are up it will call a certain function.

http://wingedserpent776.deviantart.com/
Swift
16
Years of Service
User Offline
Joined: 17th Aug 2008
Location:
Posted: 19th Aug 2008 07:13
alrite well I thought of a way you could measure time using the dbTimer() function.

what you want to do is store the current system time to a variable.
StartTime = dbTimer(). this would happen when the game starts.

then if you want an event to happen 6sec after the game commences. do a simple if check. if ( dbTimer()- StartTime == 6000 ) { do whatever }.

There could be a few issues using this function. The if statement may not be checked every ms so it may skip the event execution in which case just use >= 6000. I also dont know how the system time changes from am to pm and I assume it would start back to 0 over midnight, this would affect your checks.

Login to post a reply

Server time is: 2024-09-30 05:30:37
Your offset time is: 2024-09-30 05:30:37