Results 1 to 7 of 7

Thread: How to end a loop after a duration of time?

  1. #1
    Join Date
    Jan 2007
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to end a loop after a duration of time?

    So I would like to end certain loops after 30 sec, 60 sec, and 120 seconds. I was wondering how to set this up. I think this can be done using the system time functions but I cant quite figure it out.

    Thanks for any input.
    AKA http://i105.photobucket.com/albums/m...uceSigcopy.jpg

    I am a SCAR//SRL newb and i am willing to become better =) reading my tut's day by day.

  2. #2
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    T := GetsystemTime;
    repeat
      wait(1);
    until ((GetSystemTime - T) >= 30000);

    Edit:
    Or break loop

    Simba Code:
    repeat
      wait(1);
      if ((GetSystemTime - T) >= 30000) then
       Break;
    until false;
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  3. #3
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Simba Code:
    procedure DoForTime;
    var
      t: Integer;
    begin
      t := GetSystemTime + 30000; //Set 't' equal to 30 seconds from now
      while t > GetSystemTime do
      begin
        ThisIsA;
        30SecondLoop;
      end;
    end;
    Quite simple, you see?

    Also, stick with one thread next time please.
    From the other thread..

  4. #4
    Join Date
    Jan 2007
    Posts
    55
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Much appreciated. Thank you so much, once again I apologize for the double post.
    AKA http://i105.photobucket.com/albums/m...uceSigcopy.jpg

    I am a SCAR//SRL newb and i am willing to become better =) reading my tut's day by day.

  5. #5
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    another way

    SCAR Code:
    T := GetSystemTime;
    while ((GetSystemTime - T) < 10000) do
    begin
      //stuff;
    end;

  6. #6
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    Or you can use Stupid3ooo's Marktime and TimeFromMark... still in SRL
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  7. #7
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by WT-Fakawi View Post
    Or you can use Stupid3ooo's Marktime and TimeFromMark... still in SRL
    I remember when scripts used to use MarkTime, ha. It's literally the same thing though for anyone wondering.

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
  •