Results 1 to 5 of 5

Thread: Repeat Procedure certain amount of times?

  1. #1
    Join Date
    Mar 2013
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default Repeat Procedure certain amount of times?

    I am trying to get my script to repeat the Procedure 10 times and then stop.

    program Gems;
    var a:Integer;

    Procedure Gem;
    Begin;
    a:=0
    MoveMouse(772,445)
    Wait(1)
    ClickMouse(772,445,1)
    Wait(8)
    MoveMouse(729,444)
    ClickMouse(729,444,1)
    wait(8)
    a:=a+1;
    repeat
    Until(a=10)
    End;

    begin
    repeat
    gem
    Until (true)
    end.

    I thought by using a=0 at the beginning and a=a+1 it would add it up until it reaches 10 but It clicks once and stops

    i'm tryig to figure out how to stop after 10.
    Last edited by farkid; 04-28-2013 at 10:35 AM.

  2. #2
    Join Date
    May 2012
    Location
    A Russian village
    Posts
    158
    Mentioned
    13 Post(s)
    Quoted
    37 Post(s)

    Default

    I'm not sure if this would work someone correct me if wrong

    Simba Code:
    For a:=1 to 10 do

  3. #3
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Do it Sov's way or

    add repeat above MoveMouse(772,445)

    also remove repeat until(false) in the mainloop, that repeats infinite

    Creds to DannyRS for this wonderful sig!

  4. #4
    Join Date
    Mar 2013
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Got it to work, Thanks guys.

  5. #5
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    Changing it from until(false) to until(true) isn't going to help your situation. What if it never becomes true?

    You could use something like this:

    Simba Code:
    procedure Gem;
    var
      a: Integer;
    begin;
      a:=0
      repeat
        MoveMouse(772,445)
        Wait(1)
        ClickMouse(772,445,1)
        Wait(8)
        MoveMouse(729,444)
        ClickMouse(729,444,1)
        wait(8)
        inc(a);
      until (a=10);
    end;

    begin
      repeat
        Gem
      until not (LoggedIn) //Example. Try and use something else.
    end.

    Also, refrain from using MoveMouse and ClickMouse as they're very botlike, unless this isn't for Runescape.

    If it is for RuneScape, don't forgot to include the include and call SetupSRL; in your mainloop.

    Example for your script:

    Simba Code:
    program GemCutter;
    {$I DEFINE SMART8}

    procedure Gem;
    var
      a: Integer;
    begin;
      a:=0
      repeat
        MoveMouse(772,445)
        Wait(1)
        ClickMouse(772,445,1)
        Wait(8)
        MoveMouse(729,444)
        ClickMouse(729,444,1)
        wait(8)
        inc(a);
      until (a=10);
    end;

    begin
      SetupSRL;
      repeat
        Gem
      until not (LoggedIn); //Example. Try and use something else.
    end.

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
  •