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 / how to i increase a number over time

Author
Message
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 26th Dec 2007 22:44
sorry that i'm asking all of these questions. but i want to know if their is away to increase a number overtime. such as have 1 for something onsecond then have it increase while the program is running to say 30. i need to increase a number as the program is running. i have beed trying it with my limited coding abilites but still coming up blank.

wind
PresFox
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location:
Posted: 26th Dec 2007 22:54
use a combination of timer and a variable

something like:



untested
will increase number with newvalue every second (1000 miliseconds)

Microsoft isnt evil, they just make really crappy operating systems -- Linus torvalds
wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 26th Dec 2007 22:55
thank you i'm trying to increase the value of x. i need to use x as a number that will graduly change.

wind
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 26th Dec 2007 23:47 Edited at: 27th Dec 2007 01:59
Here are some ways to increase a variable ovetime. Note that the CLS and SET CURSOR and PRINT are not required for the increasing of the variable. Those are there so that you can see the variable's value as it increases. Basically what all of these small code snippets show is a variable increasing by 1 in a LOOP. LOOPS run the code inside of them over and over again, so by putting "inc x,1" or "x=x+1" inside of a loop, that will happen over and over again, thus gradually increasing the variable. In these examples, a DO loop was used. The loop starts at DO and ends at LOOP. There are many types of loops...

Increasing it by 1 overtime:


Here's another way to do the above (Inc is a command that can be thought of as INCREASE):


Increasing it by 1 overtime, and not allowing it to go above 30 (I'll use the INC command, although x=x+1 would work just as well):


Or making it go to 30 and then start over:


And lastly, here is the variable increasing by 4 overtime:


The examples may run a tad bit fast, so a SYNC ON and SYNC RATE at the top of your code is always helpful if you want the numbers to increase at a slower pace. Here's an example of that:



Another way to regulate the speed of the increasing variable is by using PresFox's sugguestion, but I don't think that should concern you yet.

Hope this helps

wind27382
18
Years of Service
User Offline
Joined: 10th Feb 2006
Location:
Posted: 27th Dec 2007 00:48
hey thank you all i appreciate the fact that your all taking time to help me.

wind
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 27th Dec 2007 02:00
You're welcome.

Login to post a reply

Server time is: 2024-11-26 05:41:23
Your offset time is: 2024-11-26 05:41:23