Results 1 to 10 of 10

Thread: Repeat until 1 hour has passed

  1. #1
    Join Date
    Sep 2014
    Posts
    74
    Mentioned
    2 Post(s)
    Quoted
    34 Post(s)

    Default Repeat until 1 hour has passed

    Hey,

    Just a quick question that I've been thinking about for a little while and haven't found a way how to do it.

    How would I make my script run the Repeat loop until one hour has passed (And the option to make it 2,3,4, etc hours.) ?

    Thanks in advance.
    Last edited by TomTop; 10-19-2014 at 04:40 PM. Reason: Resolved

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Simba Code:
    var someTimer: TTimeMarker;

    begin
      someTimer.start();
      repeat
        //Do this and that
      until(someTimer.getTotalTime() > (60 * 60 * 1000));
    end.
    There used to be something meaningful here.

  3. #3
    Join Date
    Sep 2014
    Posts
    74
    Mentioned
    2 Post(s)
    Quoted
    34 Post(s)

    Default

    Quote Originally Posted by Frement View Post
    Simba Code:
    var someTimer: TTimeMarker;

    begin
      someTimer.start();
      repeat
        //Do this and that
      until(someTimer.getTotalTime() > (60 * 60 * 1000));
    end.
    Wow, thanks for the fast reply, now, How would I go about making it run for lets say, 2 hours? Replace the first 60 with 120?

  4. #4
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Quote Originally Posted by TomTop View Post
    Wow, thanks for the fast reply, now, How would I go about making it run for lets say, 2 hours? Replace the first 60 with 120?
    Simba Code:
    const hoursToRun = 2;

    var someTimer: TTimeMarker;

    begin
      someTimer.start();
      repeat
        //Do this and that
      until(someTimer.getTotalTime() > (hoursToRun * 60 * 60 * 1000));
    end.
    There used to be something meaningful here.

  5. #5
    Join Date
    Sep 2014
    Posts
    74
    Mentioned
    2 Post(s)
    Quoted
    34 Post(s)

    Default

    Thanks again!

  6. #6
    Join Date
    Sep 2014
    Posts
    74
    Mentioned
    2 Post(s)
    Quoted
    34 Post(s)

    Default

    I haven't managed to get it working, It doesn't stop after 1hr has passed, it keeps going.
    But no error messages show.

  7. #7
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Quote Originally Posted by TomTop View Post
    I haven't managed to get it working, It doesn't stop after 1hr has passed, it keeps going.
    But no error messages show.
    show your code

  8. #8
    Join Date
    Sep 2014
    Posts
    74
    Mentioned
    2 Post(s)
    Quoted
    34 Post(s)

    Default

    Quote Originally Posted by undorak7 View Post
    show your code
    Simba Code:
    program Private;
      {$DEFINE SMART}
      {$I SRL-6/SRL.simba}

    var
      someTimer: TTimeMarker;
      sent: integer;

    *snip*

    begin
      smartShowConsole := FALSE;
      smartEnableDrawing := TRUE;
      cleardebug();
      setupSRL();

      repeat
        TalkFast(color + ':[ ' + name + ' ] ' + message + ' [ ' + name + ' ]', true);
        wait(RandomRange(2950, 3050));
      until(someTimer.getTotalTime() > (hoursToRun * 60 * 60 * 1000));
    end.

  9. #9
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    Quote Originally Posted by TomTop View Post
    Simba Code:
    program Private;
      {$DEFINE SMART}
      {$I SRL-6/SRL.simba}

    var
      someTimer: TTimeMarker;
      sent: integer;

    *snip*

    begin
      smartShowConsole := FALSE;
      smartEnableDrawing := TRUE;
      cleardebug();
      setupSRL();

      repeat
        TalkFast(color + ':[ ' + name + ' ] ' + message + ' [ ' + name + ' ]', true);
        wait(RandomRange(2950, 3050));
      until(someTimer.getTotalTime() > (hoursToRun * 60 * 60 * 1000));
    end.
    you are missing this

    someTimer.start();

    after the begin.. you never start the timer, so it never reaches the hour

  10. #10
    Join Date
    Sep 2014
    Posts
    74
    Mentioned
    2 Post(s)
    Quoted
    34 Post(s)

    Default

    Got it working (finally) thanks a lot!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •