Results 1 to 6 of 6

Thread: Keeping time?

  1. #1
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Keeping time?

    So I was wondering if there was a proper way to track how long a procedure has been active? I need it because the monsters in a certain area (Rock Crabs) do not become aggro'd to you after 10 minutes or so. So you need to leave the area far enough to reaggro them to you.

    Any way to do it properly and efficiently?

    Thanks!

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

    Default

    SCAR Code:
    procedure Timing;
    var
      t: Integer;
    begin
      MarkTime(t); // Starts timing here.
      Wait(RandomRange(1000, 2000));
      if TimeFromMark(t) > 1500 then // Checks if the time since 'MarkTime(t)'
        Writeln('Over')
      else
        Writeln('Under');
    end;

    So in your MainLoop have it constantly loop through and when it has been 10 minutes use the RunAway functions. I believe they are in Walking.scar.
    Last edited by NCDS; 02-26-2010 at 12:09 AM.

  3. #3
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    marktime(var time: integer);

    timefrommark(time: integer);

    or alternatively getSystemTime(); which is basically the same thing.

    ex.

    SCAR Code:
    procedure blah;
    var
      timer: integer;
    begin
      marktime(timer);
      shithere;
      writeLn('took: '+IntToStr(timeFromMark(timer)));
    end;

    I haven't used marktime in forever, but im pretty sure that's how it works
    “Ignorance, the root and the stem of every evil.”

  4. #4
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks you two. I was curious on how to do this.

    Appreciate the help!

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Risk View Post
    Thanks you two. I was curious on how to do this.

    Appreciate the help!
    your welcome. and for the record, I'm smarter than NCDS, so regardless what he tells you, I'm more right.
    “Ignorance, the root and the stem of every evil.”

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

    Default

    Quote Originally Posted by Blumblebee View Post
    your welcome. and for the record, I'm smarter than NCDS, so regardless what he tells you, I'm more right.
    Can't argue with fact :/

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
  •