Results 1 to 6 of 6

Thread: How do I set this kind of timer ?

  1. #1
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    433
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default How do I set this kind of timer ?

    Code:
    function FindMonsterM(Color1, Color2, Color3, Tolerance: Integer; MonsterName: String): Boolean;
    var
      i: integer;
      dir: string;
    begin
     case random(4)+1 of
      1: dir:= 'nswe';
      2: dir:= 'wens';
      3: dir:= 'sewn';
      4: dir:= 'ewns';
     end;
     for i:= 1 to 4 do
       if(not(KAttackMonsterM(Color1, Color2, Color3, Tolerance + i, monsterName)))then
         MakeCompass(strget(dir, i))
       else
       begin
         result:= true;
         exit;
       end;
    end;
    How could I set it that if it wont find a monster in 2 minutes it would logout ?

  2. #2
    Join Date
    Aug 2006
    Location
    London
    Posts
    2,021
    Mentioned
    2 Post(s)
    Quoted
    0 Post(s)

    Default

    use the procedure MarkTime and TimeFromMark

    it would be something like this
    Code:
    function FindMonsterM(Color1, Color2, Color3, Tolerance: Integer; MonsterName: String): Boolean;
    var
      i: integer;
      dir: string;
      TimeOut: integer;
    begin
    MarkTime(TimeOut);
    repeat //you have to make it a loop so it lasts for 1 minutes
    
     case random(4)+1 of
      1: dir:= 'nswe';
      2: dir:= 'wens';
      3: dir:= 'sewn';
      4: dir:= 'ewns';
     end;
     for i:= 1 to 4 do
       if(not(KAttackMonsterM(Color1, Color2, Color3, Tolerance + i, monsterName)))then
         MakeCompass(strget(dir, i))
       else
       begin
         result:= true;
         exit;
       end;
    
    until( TimeFromMark(TimeOut)>120000 );
    end;
    MarkTime stores the system time into the variable TimeOut
    TimeFromMark returns the milliseconds from the MarkTime of that variable

    (MarkTime acctually stores the number of milliseconds your computer has been turned on)
    Join the Official SRL IRC channel. Learn how to Here.

  3. #3
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    433
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    Thanks Yak, yes I knew how to set timers and stuff, didn't just know how should I set it up on that kind of procedure, thanks alot.

  4. #4
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    433
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    Uh, How could I acctually make it so that it LogOut; and terminatescript; when TimedOut ? Im feeling bit embaressed to ask this lol.

  5. #5
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by DaWu View Post
    Uh, How could I acctually make it so that it LogOut; and terminatescript; when TimedOut ? Im feeling bit embaressed to ask this lol.
    PHP Code:
    function FindMonsterM(Color1Color2Color3ToleranceIntegerMonsterNameString): Boolean;
    var
      
    iinteger;
      
    dirstring;
      
    TimeOutinteger;
    begin
    MarkTime
    (TimeOut);
    repeat //you have to make it a loop so it lasts for 1 minutes

     
    case random(4)+1 of
      1
    dir:= 'nswe';
      
    2dir:= 'wens';
      
    3dir:= 'sewn';
      
    4dir:= 'ewns';
     
    end;
     for 
    i:= 1 to 4 do
       if(
    not(KAttackMonsterM(Color1Color2Color3Tolerance imonsterName)))then
         MakeCompass
    (strget(diri))
       else
       
    begin
         result
    := true;
         exit;
       
    end;

    untilTimeFromMark(TimeOut)>120000 )
    or(
    Result=True);
    if(
    TimeFromMark(TimeOut)>120000 ))
    then begin
    LogOut
    ;
    terminateScript;
    end
    Also, to until( TimeFromMark(TimeOut)>120000 ) you should make this:
    until( TimeFromMark(TimeOut)>120000 )
    OR(Result=True);

  6. #6
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    433
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    Great Pentti, thats right what I was looking for.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. First of it's kind.. A pot mixer
    By souppy in forum RS3 Outdated / Broken Scripts
    Replies: 6
    Last Post: 02-26-2008, 08:22 PM
  2. What Kind Of Srl Member Are You
    By edwardred7 in forum News and General
    Replies: 14
    Last Post: 01-23-2008, 10:57 PM
  3. What kind of programing should i do?
    By SKy Scripter in forum News and General
    Replies: 9
    Last Post: 04-14-2007, 10:40 PM

Posting Permissions

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