Posts: 503
Threads: 31
Joined: Feb 2005
Help
[syntax="FB"]
Count = 0
Do
Timei = Timer
Count = Count + 1
Locate 1,1: Print Count
Do: Loop while Timer-Timei <= .1
Loop While Not Multikey(&h1) And Inkey$ <> Chr$(255) + "X"
[/syntax]
What's wrong?
You see when I run it, it prints 1 then it counts up to 2200 really fast then it pauses then it goes up to 44000 really fast then it pauses then it goes up really fast then it pauses, etc. Why? How can I fix it?
i]"But...it was so beautifully done"[/i]
Posts: 3,522
Threads: 189
Joined: Dec 2003
Works fine.
It's XP raping you from behind, hard.. with it's friend, Bubba Adcode
Posts: 503
Threads: 31
Joined: Feb 2005
ok...can it be fixed?
i]"But...it was so beautifully done"[/i]
Posts: 1,407
Threads: 117
Joined: Dec 2002
Remove the inkey$ check, it's what slows you down. The close button will not work then....
Antoni
Posts: 503
Threads: 31
Joined: Feb 2005
Well, then thats ok, I don't need it, thnx
EDIT:
And yet it still doesn't work. Still need help. You see when I make it .5 instead of .1 it does it good at second intervals, but when I do it at anything less than .5 I get what I stated above still.
i]"But...it was so beautifully done"[/i]
Posts: 268
Threads: 9
Joined: Dec 2004
Depending on what version of Windows you have, TIMER may be using the high resolution win32 timer or not. You may be using the unprecise version.
Secondly, console output under windows is slow, so that may be causing slowdowns every now and then.
Also, try shutting down other apps running in the background before starting your program...
Posts: 1,407
Threads: 117
Joined: Dec 2002
Well, I think I missed the main problem.
In FB the variables are integer by default. so timei=timer rounds to an integer. Make timei single and the bursts will disappear....
Antoni
Posts: 503
Threads: 31
Joined: Feb 2005
Antoni, You hit it on the nose. Thnx
I thought vars in Basic started out defined as singles. So thats why I didn't dim it....heh...any other suprises FB has?
1 Q: whats with the UInteger compared to Integer? What the difference?
i]"But...it was so beautifully done"[/i]
Posts: 2,404
Threads: 153
Joined: Jan 2005
:???: Here is your problem: timei = TIMER,. it needs to be timei! = TIMER.. Like this..
Code:
Timei! = Timer
Do: Loop until (Timer - Timei!) >= .1
:wink: Fixed it for me..
Darn, beatin to it,. lol,. oh well
Kevin (
x.t.r.GRAPHICS)
Posts: 1,845
Threads: 44
Joined: Aug 2002
Quote:1 Q: whats with the UInteger compared to Integer? What the difference?
Unsigned datatypes have no sign bit.
In other words, you can't do negative numbers, but you can do higher positive numbers.
Look:
INT: -2147483648 to 2147483647
UINT: 0 to 4294967295