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 / background

Author
Message
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 12th Apr 2004 23:30 Edited at: 12th Apr 2004 23:31
how is it possible to run functions in the background

for example:
have a counter at the top with this:

and have a print command going on at the same time:


BTW: title of this should be Background Functions; stupid PC

N30F15H
Co-CEO of Pulse Productions
www.pulseproductions.tk
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 13th Apr 2004 00:12
You'll have to use timer instead of wait. Timer returns the processor time in milliseconds, so seeing if 1000 milliseconds has passed since the last time you printed will do the same but let the function continue.



Trying is the first step towards faliure.
Athelon XP 1600+/Radeon 9600 Pro/256 RAM
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 13th Apr 2004 00:17
im not sure i get that, could u explain it please?

N30F15H
Co-CEO of Pulse Productions
www.pulseproductions.tk
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 13th Apr 2004 05:19
if i understand you correctly you'r trying to multi-task(that is have more than one thing running at one time) however if this is what your trying to do db doesn't support it, you have to call one command at a time, however the cpu is so fast that it won't make much of a difference anyways.

CPU

Sparring - Loved by many, Pefected by few.

I'm going to live forever, or DIE IN THE ATTEMPT!!!"
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 13th Apr 2004 16:11
The do-loop is just a loop. Basically when the computer reaches the loop it jumps back to the do, much like the for-next loop, except it goes on forever and doesn't incriment a variable.

Whenever trying to understand a program, think of the value of the variable. At the beginning time equals 0, and timer() is the processor time in milliseconds, ie. it may read 100000 now, so in 1 seconds time it will read 101000 (as 1000 milliseconds equals 1 second). It just returns the time in milliseconds, instead of hours, minutes and seconds.

So timer() usually will equal more than 1000, so timer()-time (time equals 0) will be more than 1000, so we incriment n ("inc n" is the same as "n=n+1"), clear the screen, print the percent done, and print the message. We then store the current timer() value in the variable "time", so they equal the same thing. We also check to see if n>100, in which case we end the program (this has the same effect as the for-next loop). You could also use "exit" to exit the do-loop loop if there was something after the loop.

Now we loop back to the beginning. Remember timer()=time, they were both the same, and it is very likely that they will be about the same now, so timer()-time will equal something lower than 1000, so we do not do what is inside the if statement. The only way that timer()-time will be more than 1000 is if timer() is 1000 more than time. As timer() returns the time in milliseconds, we will have to wait till it is 1000 milliseconds AFTER we made time equal to timer(which is also since the last time we counted on 1 percent). When 1000 ms has passed we will count on one and make time=timer() once again. The process then continues until we have counted 100 seconds, and the program ends.

I hope I explained that well, tell me if it helped or not.

Trying is the first step towards faliure.
Athelon XP 1600+/Radeon 9600 Pro/256 RAM
Neofish
20
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 13th Apr 2004 20:00
i already got the do loop

now i get the timer()

ahhh now i get inc n

doesnt that print the message over and over?

thanks for the help but is time the amount of time the app has been running?

N30F15H
Co-CEO of Pulse Productions
www.pulseproductions.tk

Login to post a reply

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