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 DBPro Corner / timer() help needed.

Author
Message
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 2nd Oct 2003 16:19
Hi all, how would i execute a function every 500ms using the timer() command?

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 2nd Oct 2003 16:52
Like this maybe:



If your mansion house needs haunting, just call Rentaghost!
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 2nd Oct 2003 22:12
thanx ill give it a go

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 3rd Oct 2003 01:54 Edited at: 3rd Oct 2003 02:02
ok im stuck on something which is probably so simple but i cant see it. look at the code below.. it prints "Do something" every 500ms which is fine... what i want is for the code to for example, jump to function a after 500ms then jump to function b after another 500ms then back to a after another 500ms and so on.. but do you think i can figure it out? NO!


time=timer()
do
x=timer()
if x-time >=500
Print "Do something"
time=x
endif
loop

ok let me be a bit more precise.. i want to start recording a sound and stop after 500ms then start recording again for another 500ms then stop and so on but i dont want to use the wait command as that holds the whole program up. it would be nice if we could check if a recording is already in progress so that we dont try and record while we are already recording. maybe i could write a type of switch that changes from 0 to 1 and back to 0 every 500ms.

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 3rd Oct 2003 02:12 Edited at: 3rd Oct 2003 02:12
Something like this perhaps?



Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
AndyUK
21
Years of Service
User Offline
Joined: 2nd Apr 2003
Location: United Kingdom
Posted: 3rd Oct 2003 02:20
thank you VERY much just what i need

| AMD Athlon XP 2000+ | 512DDR(400) | GF4MX400 64MB | Win2k Sp4 | Cup of Coffee |
Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 3rd Oct 2003 02:22
If you don't want the extra function, this will work also.



Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 3rd Oct 2003 02:40
you can also replace



with





If your mansion house needs haunting, just call Rentaghost!
Easily Confused
22
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 3rd Oct 2003 03:01
True, serves me right for programming "old school"

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Black Hydra
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 6th Oct 2003 07:25
I guess you couldn't just make a function to pass the time as a real argument?

Login to post a reply

Server time is: 2024-11-10 20:45:28
Your offset time is: 2024-11-10 20:45:28