Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Timer
#1
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]
Reply
#2
Works fine.


It's XP raping you from behind, hard.. with it's friend, Bubba Adcode
Reply
#3
ok...can it be fixed?
i]"But...it was so beautifully done"[/i]
Reply
#4
Remove the inkey$ check, it's what slows you down. The close button will not work then....
Antoni
Reply
#5
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]
Reply
#6
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...
ngelo Mottola - EC++
Reply
#7
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
Reply
#8
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]
Reply
#9
:???: 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)

[Image: 11895-r.png]
Reply
#10
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)