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.

Newcomers AppGameKit Corner / Creating a timer?

Author
Message
Skela
9
Years of Service
User Offline
Joined: 23rd Feb 2015
Location:
Posted: 23rd Feb 2015 02:27
I am stuck on how to create a timer, but not a timer()

How would I create a loop where every one second everything inside the loop is called? ex)


while x > x
do
if nextsecond()
print (second)
endif
loop
endwhile

I hope this kinda explains what I am looking for, thanks!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 23rd Feb 2015 08:49
I'm assuming you still want other stuff to run outside the one second loop so here's a version that ONLY runs the increment every second but prints the current value all the time:



Using AppGameKit V2 Tier 1
Skela
9
Years of Service
User Offline
Joined: 23rd Feb 2015
Location:
Posted: 24th Feb 2015 06:41
Quote: "I'm assuming you still want other stuff to run outside the one second loop so here's a version that ONLY runs the increment every second but prints the current value all the time:"


So I did it how you showed and added the function calls I needed but it doesn't work at all for some reason it never even loops, here is how I have it.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Feb 2015 06:57
My mistake, it should be checking for 1 not 1000:


I was on my phone so I couldn't test it. Sorry.


Using AppGameKit V2 Tier 1
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 24th Feb 2015 08:19
baxslash fell into the same trap I always hit - the DBPro timer was milliseconds, AppGameKit is seconds

Quidquid latine dictum sit, altum sonatur
Skela
9
Years of Service
User Offline
Joined: 23rd Feb 2015
Location:
Posted: 24th Feb 2015 08:42
Thank you so much it works now
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 24th Feb 2015 12:09
Doesn't help that the docs say milliseconds either...


Using AppGameKit V2 Tier 1

Login to post a reply

Server time is: 2024-05-02 22:44:25
Your offset time is: 2024-05-02 22:44:25