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

Re: [libertybasic] Re: TIMER Statement - limitations

Expand Messages
  • D. Jempson
    Thanks Carl - I ll look forward to the result. Derek ... From: carlg@libertybasic.com To: libertybasic@yahoogroups.com Sent: Tuesday, March 27, 2001 7:19 PM
    Message 1 of 7 , Mar 27, 2001
    • 0 Attachment
      Thanks Carl - I'll look forward to the result.
       
      Derek
      ----- Original Message -----
      From: carlg@...
      Sent: Tuesday, March 27, 2001 7:19 PM
      Subject: [libertybasic] Re: TIMER Statement - limitations

      This technique is fine as long as you aren't going to trap other user
      interactions, which would cause your for/next loop get messed up. 
      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

      --- 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



      To unsubscribe from this group, send an email to:
      libertybasic-unsubscribe@egroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    • 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 2 of 7 , Apr 2, 2001
      • 0 Attachment
        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 3 of 7 , Apr 6, 2001
        • 0 Attachment
          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 4 of 7 , Apr 6, 2001
          • 0 Attachment
            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 5 of 7 , Apr 7, 2001
            • 0 Attachment
              > 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.