TIMER Delays

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

TIMER Delays

Post by Mitth'raw'nuruodo »

Ok, here's what I know:

Code: Select all

Seconds = 1
timeI = TIMER
DO : LOOP UNTIL timeI + Seconds <= TIMER
That code will delay for 1 second.

Now here's my question:

How do you make it delay for <1 second? If you make Seconds <1 then won't it still delay for 1 second? :?
"But...It was so beutifully done"
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

Ohh! Thats sooo easy! Just make you vars !s (the defualt) and change them to decimals :!:

here is a tutor: http://petesqbsite.com/sections/tutoria ... e_lift.txt

Pete, you da man!
Image
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

Thanks Nate, I thought TIMER was an integer because it returns the seconds from midnight....heh...But thanks! :D
"But...It was so beutifully done"
User avatar
{Nathan}
Veteran
Posts: 1169
Joined: Thu Aug 19, 2004 6:08 pm
Location: The wetlands of central Ohio, USA
Contact:

Post by {Nathan} »

It might be, but it still works. Actually... I think it is!
Image
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

No, if it was then it wouldn't work...

Use this code to find out:

Code: Select all

DO
   PRINT TIMER
LOOP WHILE INP(96) <> 129  'if the ESC key has gone up then exit do
As you see TIMER has two decimal places with it. So TIMER is not an integer.
"But...It was so beutifully done"
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

Timer is a SINGLE floating point numerical value.

Just like it says in the QB help, if you look under TIMER
I have left this dump.
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

No it doesn't.

I looked before I posted this, and I double checked after you posted that and it says nowhere in the QB help that TIMER is a floating point single precision type variable.

Hence this topic.
"But...It was so beutifully done"
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

Um, Mitth, arn't "31.123" what you call a floating point.. so that makes TIMER a floating point.. ^^ Or thats what TIMER returns for me.. :)
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

I know its floating point.....and your right....so uh?

What's that about?

I said It doesn't because QB help says nothing about floating point, I assumed that since it said # of seconds from midnight, it ment an integer...

But then I checked it out and its not so your right it is a floating point but Z!re said that QB help said it was and I said it doesn't cause it doesn't, clear now, eh? :D
"But...It was so beutifully done"
Rattrapmax6
Veteran
Posts: 1055
Joined: Sun Jan 02, 2005 2:11 pm
Location: At my computer
Contact:

Post by Rattrapmax6 »

:) QB Help has 3 Layers,. :Quick Screen: :Discrition: :Example:

Z!re might be on a diff page about TIMER :wink:
-Kevin (aka:Rattra)
(x.t.r.GRAPHICS)
User avatar
Mitth'raw'nuruodo
Veteran
Posts: 839
Joined: Sat Jan 22, 2005 11:04 am
Location: Eastern Coast of US
Contact:

Post by Mitth'raw'nuruodo »

No.

QuickScreen: Details: Example: Contents: Index

I looked at all three of them and it never says TIMER is a SINGLE precision floating-point decimal type variable. I does however say it indirectly when in the example it shows Start! = TIMER.

Now start! is a single precision. So therefore TIMER is a single precision indirectly. But it never says it directly.
"But...It was so beutifully done"
Post Reply