Results 1 to 4 of 4

Thread: Repeating a procedure every "X" minutes

  1. #1
    Join Date
    Aug 2012
    Location
    Michigan
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Repeating a procedure every "X" minutes

    Ok, so I have a question. How do you repeat a procedure every 5 minutes?



    This code is not for Runescape, its for a different MMORPG.

    My attacking and looting procedures work great, I don't need help on those, but in this game there are certain buffs your character can apply. These buffs are timed for 5 minutes. I have a procedure that applies these buffs and it works, but I need it repeated every 5 minutes.

    The second issue is what should I use for a termination procedure so that whenever I hold down the "Delete" key, it terminates the script. Also, where should I use this procedure so i can terminate at ANYTIME?

    Here's the code I have so far..

    Code:
    program Mob_Farmer;
    {$i srl/srl.simba}
    
    const
    //various constants here
    
    var
    //various variables here
    
    
    Procedure Terminate;
    begin
    //Script Termination Procedure, the second issue i need help with.
    end;
    
    
    Procedure Rebuff;
    Begin
    //this is the procedure I need repeated every 5 mins
    end;
    
    Procedure WaitScreen;
    begin
      //waits till I switch to client screen;
    end;
    
    
    Procedure Attack;
    begin
    //attack procedure
    end;
    
    
    Procedure Loot;
    //loot procedure
    end;
    
    
    begin
      SetUpSRL;
      WaitScreen;
      count:=0;
      repeat
        Attack;
        Loot;
        wait(50);
        inc(count);
        Writeln(intToStr(count)+ ' Mobs killed');
      until (count=35000);
    end.

    Any help at all is appreciated! Thanks!
    Last edited by Frozenfire216; 08-29-2012 at 09:20 PM.

  2. #2
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Hey Frozenfire,

    To terminate the script at any time, you can press (Ctrl + Alt + S). As for the buffs:

    Simba Code:
    procedure Rebuff;
    begin
      if (BuffTime = 0) or (TimeFromMark(BuffTime) > (5 * 60 * 1000)) then
      begin
        // Apply buff
        MarkTime(BuffTime);
      end;
    end;

    Declare BuffTime as a global var (integer) and call Rebuff every loop, like so:

    Simba Code:
    begin
      SetUpSRL;
      WaitScreen;
      count:=0;
      repeat
        Rebuff; // <--
        Attack;
        Loot;
        wait(50);
        inc(count);
        Writeln(intToStr(count)+ ' Mobs killed');
      until (count=35000);
    end.

    It will exit the Rebuff procedure if it hasn't been 5 minutes since the last time it applied buffs. Hope that helps

  3. #3
    Join Date
    Aug 2012
    Location
    Michigan
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Thank You!

    That's exactly what I needed! Thanks for the very quick reply!

    I have experience in programming in other languages, but this is my first script on Simba, so I'm not familiar with most of the commands.

    Is there a thread with a list/explanation of most commands?

    Once again, thanks!

  4. #4
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by Frozenfire216 View Post
    That's exactly what I needed! Thanks for the very quick reply!

    I have experience in programming in other languages, but this is my first script on Simba, so I'm not familiar with most of the commands.

    Is there a thread with a list/explanation of most commands?

    Once again, thanks!
    No problem

    You can check out the Simba bible here, a full list with desciptions of the built-in functions. You can also view them via the document browser in Simba (as well as SRL's library under 'Includes'):



    Other than that, I'd say your best bet would be browsing working scripts.

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
  •