Loading ...
Sorry, an error occurred while loading the content.
 

Re: [libertybasic] Re: TIMER Statement - limitations

Expand Messages
  • A. Watson
    ... I believe that the upper limit has to do with the max value of a long integer, which is actually 65535, but one minute is pretty much the max for a timer.
    Message 1 of 7 , Apr 2, 2001
      At 06:19 PM 3/27/01 -0000, you wrote:
      > This technique is fine as long as you aren't going to trap other user
      >
      > This is because executing code outside the for/next loop in response
      > to a button click or other user event could cause the state of the
      > internal stack that LB uses to manage loops to become invalid.
      >
      > I'll put together a little code to do this in a more robust way.
      >
      > -Carl
      >

      I believe that the upper limit has to do with the max value of a long
      integer, which is actually 65535, but one minute is pretty much the max for
      a timer. I'll look forward to seeing Carl's code. Here is the way I do
      it, although it is probably not the greatest.


      minutes=3 'length to run timer

      timer 60000, [anotherMinute]

      [userInput]
      print "Type something and press enter."
      input var$
      print "You typed ";var$
      print
      goto [userInput]

      [anotherMinute]
      totalminutes=totalminutes+1
      print
      print "TOTAL MINUTES IS: ";totalminutes
      if totalminutes>=minutes then [done]
      wait


      [done]
      beep:beep:beep
      timer 0

      print
      print "TIME IS UP."
      end
    • sniper_lt@hotmail.com
      I appreciate this discussion but you guy have lost me. Since I am still working with 1.41 and TIMER is a 2.0 statement. Would someone please explain the syntax
      Message 2 of 7 , Apr 6, 2001
        I appreciate this discussion but you guy have lost me. Since I am
        still working with 1.41 and TIMER is a 2.0 statement. Would someone
        please explain the syntax and meaning. Also while you are at it
        explain wait. AND yes I tried reading the 2.0x doc. Unfortunatly they
        just look like a rehash of the 1.4X doc and some of the statements
        are not even mentioned in the command reference. I may have and older
        beta version of 2.0x I think it is 2.04 so I might not have the most
        current help file. But I do think there needs to be a complete
        rewrite of the help file.


        --- In libertybasic@y..., "D. Jempson" <dj@j...> wrote:
        > It seems that the TIMER statement will only work accurately with
        periods of up to one minute (60000 milliseconds). For periods of
        over one minute I have worked around the limitation like so:
        >
        > for i = 1 to minutes
        > timer 60000, [anotherMinute]
        > wait
        > [anotherMinute]
        > timer 0
        > next i
        >
        > Is this the "correct" way to do it, or is there another, more
        elegant solution?
        >
        > Derek
      • carlg@libertybasic.com
        Well, what else can I say but go and download the released product! Let me know if that improves your view. ;-) http://www.libertybasic.com/where.html Thanks,
        Message 3 of 7 , Apr 6, 2001
          Well, what else can I say but go and download the released product!
          Let me know if that improves your view. ;-)

          http://www.libertybasic.com/where.html

          Thanks,

          -Carl

          --- In libertybasic@y..., sniper_lt@h... wrote:
          > I appreciate this discussion but you guy have lost me. Since I am
          > still working with 1.41 and TIMER is a 2.0 statement. Would someone
          > please explain the syntax and meaning. Also while you are at it
          > explain wait. AND yes I tried reading the 2.0x doc. Unfortunatly
          they
          > just look like a rehash of the 1.4X doc and some of the statements
          > are not even mentioned in the command reference. I may have and
          older
          > beta version of 2.0x I think it is 2.04 so I might not have the
          most
          > current help file. But I do think there needs to be a complete
          > rewrite of the help file.
          >
          >
          > --- In libertybasic@y..., "D. Jempson" <dj@j...> wrote:
          > > It seems that the TIMER statement will only work accurately with
          > periods of up to one minute (60000 milliseconds). For periods of
          > over one minute I have worked around the limitation like so:
          > >
          > > for i = 1 to minutes
          > > timer 60000, [anotherMinute]
          > > wait
          > > [anotherMinute]
          > > timer 0
          > > next i
          > >
          > > Is this the "correct" way to do it, or is there another, more
          > elegant solution?
          > >
          > > Derek
        • Tom Lake
          ... long ... max for ... I believe in most languages that would be called an unsigned integer. A long integer is four bytes and has a value of over four
          Message 4 of 7 , Apr 7, 2001
            > I believe that the upper limit has to do with the max value of a
            long
            > integer, which is actually 65535, but one minute is pretty much the
            max for
            > a timer.

            I believe in most languages that would be called an unsigned
            integer. A long integer is four bytes and has a value of over four
            billion.

            Tom Lake
          Your message has been successfully submitted and would be delivered to recipients shortly.