Results 1 to 16 of 16

Thread: repeat a certain amount of times

  1. #1
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default repeat a certain amount of times

    I need to make a section of my script look for the bank symbol 5 times and then if it doesn't find it log out....this is my script so far. also tell me anything unecesary or that won't work or i should add. the bit I want to repeat 5 times is
    FindSymbol(x, y, 'bank')
    under the findummy procedure.

    SCAR Code:
    program GoodRadialWalk;
    {.Include SRL/SRL.scar}

    var
    OreDTM: integer;

    procedure FindDummy;
    begin
    if findsymbol(x,y,'Training Dummy')then
    begin
    mouse(x,y,5,5,true);
    fflag(0);
    if FindSymbol(x, y, 'bank')then
    Mouse(x, y, 5, 5, true)                    //Clicks on symbol
      FFlag(0);
    Exit;
    if (not findsymbol(x,y,'Bank'))then
    Logout;
    end else;
    if (not findsymbol(x,y,'Training Dummy'))then
    begin
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 405, 336, 20, 0, 0);
    end;
    if FindSymbol(x, y, 'bank')then
    begin
    Mouse(x, y, 5, 5, true)                    //Clicks on symbol
      FFlag(0);
    Exit;
    end else;
    if (not findsymbol(x,y,'bank'))then
    begin
    if findsymbol(x,y,'Training Dummy')then
    Mouse(x,y, 5, 5, true)
    fflag(0);
    if FindSymbol(x, y, 'bank')then
    begin
    Mouse(x, y, 5, 5, true)                    //Clicks on symbol
      FFlag(0);
    Exit;
    end else
    if (not findsymbol(x,y,'bank'))then
    Logout;
    end;
    end;

    procedure BankToMine;
    begin
    setupSRL;
    activateclient;
    wait(3000+random(300));
    makecompass('N');
    HighestAngle;
    Setrun(false);
    gametab(4);
    Roadcolor:=FindRoadColor;
    wait(500+random(200));
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    Roadcolor:=FindRoadColor;
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 39, 72, 70, 0, 0);
    fflag(0);
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 78, 100, 66, 0, 0);
    fflag(0);
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 168, 131, 62, 0, 0);
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 195, 145, 58, 0, 0);
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 191, 157, 62, 0, 0);
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 189, 153, 58, 0, 0);
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 188, 139, 60, 0, 0);
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 195, 148, 60, 0, 0);
    RadialWalk( 6186854 , 288, 195, 42, 0, 0);
    end;

    procedure MineToBank;
    begin
    activateclient;
    wait(3000+random(300));
    makecompass('N');
    HighestAngle;
    Setrun(false);
    gametab(4);
    Roadcolor:=FindRoadColor;
    wait(500+random(200));
    if not(FindMMColor(x,y,RoadColor)) then RoadColor:=FindRoadColor;
    RadialRoadWalk(RoadColor, 64, 76, 67, 0, 0);
    repeat
      RadialRoadWalk(RoadColor, 337, 377, 58, 0, 0);
      flag;
    until(findsymbol(x,y,'Quest'))
    RadialRoadWalk(RoadColor, 332, 370, 51, 0, 0);
    RadialRoadWalk(RoadColor, 336, 366, 50, 0, 0);
    RadialRoadWalk(RoadColor, 321, 346, 30, 0, 0);
    MakeCompass('W')
    RadialRoadWalk(RoadColor, 405, 336, 65, 0,0);
    RadialRoadWalk(RoadColor, 405, 336, 35, 0,0);

    begin
    if FindSymbol(x, y, 'bank')then
    Mouse(x, y, 5, 5, true)                    //Clicks on symbol
      FFlag(0);
    if(not FindSymbol(x, y, 'bank'))then
      begin
    FindDummy;                                              //Waits for flag to dissapear
    end;
    end;
    end;

    Function EasyBank:Boolean;//stolen from wizzup?
    Begin
      Makecompass('N')
      LowestAngle;
      OpenBankGlass('veb',False,False);
      FFlag(0);
      Wait(1000);
      If BankScreen Then
      Begin
        Result := True;
        Exit;
      End;
      If OpenBankQuiet('veb') Then Result := True;
    End;

    procedure BankOres;
    begin
    OreDTM := DTMFromString('78DA634C636060706740038C48249006A9F12' +
          '3A0261F487813A12688809A1C201141847BA209A84902123104D4' +
          'C4028944026AA2893007E4DE28026A828930071436A104D484128' +
          'E0B0047CA0967');
    if FindDTM(OreDTM, x, y, MIx1, MIY1, MIx2, MIY2) then
    begin
    repeat
         mouse(x,y,0,0,False)
         ChooseOption(x, y, 'Store All');
         FFlag(5);
         wait(500+random(250));
         until not (FindDTM(OreDTM, x, y, MIx1, MIY1, MIx2, MIY2));
         if (not FindDTM(OreDTM, x, y, MIx1, MIY1, MIx2, MIY2)) then
         Freedtm(OreDTM);
      end;
    end;


    begin
    repeat;
    BankToMine;
    MineToBank;
    wait(5500 +random(2000));
    EasyBank;
    Wait(10+random(500))
    BankOres;
    Wait(10+random(500))
    CloseBank;
    until(false);
    end.
    Sleeping...

  2. #2
    Join Date
    Jun 2006
    Location
    N Wales
    Posts
    558
    Mentioned
    2 Post(s)
    Quoted
    56 Post(s)

    Default

    to find the bank symbol 5 times and if not logg out just do:

    SCAR Code:
    Begin
      repeat
      if FindDTM(Banksymbol,x, y, 0, 0, 200, 200)then
      begin
        exit;
      end;
      until(5)
        logout;
    end.

  3. #3
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Any questions just ask.

    SCAR Code:
    program New;
    {.include srl\srl.scar}
    function SymbolFinder(var gx,gy:integer; symbol:string):boolean;
    var bankfindtries,logouttries:integer;
    begin
      if (FindSymbol(gx,gy,symbol)) then result:=true;
      logouttries:=0;
      if not (FindSymbol(gx,gy,symbol)) then
      begin
        repeat
          bankfindtries:=0;
          repeat
            if ( not(FindSymbol(gx,gy,symbol)) ) then
            begin
              KeyDown(VK_Left)
              Wait(100 + Random(50));
              KeyUp(VK_Left)
              bankfindtries:=bankfindtries+1;
              wait(10);
            end;
          until (( FindSymbol(gx,gy,symbol) ) or (bankfindtries>10) );
          if bankfindtries>10 then
          begin
            logout;
            wait(1000+random(1000));
            loginplayer;
            logouttries:=logouttries+1;
            repeat
              wait(10);
            until (loggedin);
            mouse(519+random(31),214+random(40),0,0,true);
          end;
          FindSymbol(gx,gy,symbol);
          if logouttries>3 then
          begin
            LogOut;
            exit;
            //ActivateClient;
            //NextPlayer ( False );
            //LoginPlayer;
            //break
          end;
        until  ( FindSymbol(gx,gy,symbol));
        if (FindSymbol(gx,gy,symbol)) then result:=true;
      end;
    end;

    begin
      setupsrl;
      activateclient;

      SymbolFinder(x,y,'bank');
      mouse(x,y,2,2,true);

    //if findSymbol(x,y,'hair dresser') then mouse(x+25,y,5,5,true);


    end.

  4. #4
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    O.o......thanks Boreas lol...I get bits of it but I only really get that it looks for bank symbol 10 times and if it looks for it more than that it will logout and then it looks like it logs back in again.....Can you kinda explain what it does rofl..I'll explain what my original post script does(theoretically)

    if it doesn't find bank symbol it looks for dummies. if it finds dummies it goes there then it looks for bank. thats the bank bit i want looked for 5 times. if it doesn't find bank symbol after five goes i want it to log out. then if it doesn't find dummy symbol it walks forward a bit. then looks for bank symbol. if it doesn't find bank symbol it looks for dummy symbol. then if it finds dummy symbol walks there and looks for bank if it doesn't find after 5 times i want it to log out.
    Sleeping...

  5. #5
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Ahh ok. My thing is just for finding symbols when they are covered by people dots. It first tries rotating the compass up to 10 times, and then it tries logging out and in up to 3 times, trying the compass again, for a maximum of 30 tries, then gives up. You can change the 3 and 10 of course.

    You can use the same sort of code though. Repeat loops and counters.

  6. #6
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    hmmm I think I will use that then if it somehow doesn't work go onto my failsafes lol which suk o well thx a tonne
    Sleeping...

  7. #7
    ronny.m.p Guest

    Default

    Use a counter

  8. #8
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    Quote Originally Posted by ronny.m.p View Post
    Use a counter
    gee thats helpful....don't you think i'd be using one if i knew how to...so saying use a counter doesn't really help if i've got no idea what one is?!
    Sleeping...

  9. #9
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    bankfindtries:=bankfindtries+1;

  10. #10
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    Quote Originally Posted by Boreas View Post
    bankfindtries:=bankfindtries+1;
    rofl u help too much :P
    Sleeping...

  11. #11
    Join Date
    Sep 2006
    Location
    West U.S.
    Posts
    2,172
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by rkroxpunk View Post
    rofl u help too much :P
    thats why boreas is a mod and SRL dev

    They are sisters...
    Runescape Classic

  12. #12
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Actually that's why I have the helper bear

  13. #13
    Join Date
    Sep 2006
    Posts
    179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    basicly this is how a counter works. this does codestuff; until a condition is met or counter is 5 (meaning the 5 attempts to get it right)
    SCAR Code:
    procedure whatev;

    counter:integer;

    begin

    repeat
       codestuff;
       counter:=counter+1
    until(condition(true) or (counter=5))

    end;
    http://www.fenjer.com/adnan/SRLStats/391.png
    http://img341.imageshack.us/img341/4...irbypb6lf8.gif
    If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly. - put this in your sig
    i <3 jagex

  14. #14
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    In my willow chopper, once it walks to the tree, it repeats waiting 400 miliseconds and each time it repeats I do Tries:= Tries + 1; and then in the waiting I have
    if(Tries=40)then
    TerminateScript
    I added that as a failsafe. As said above, you should do it like that because if it just repeats looking for it 5 times, its not going to terminate the script.

  15. #15
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    ok thx
    Sleeping...

  16. #16
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    Quote Originally Posted by JAD View Post
    In my willow chopper, once it walks to the tree, it repeats waiting 400 miliseconds and each time it repeats I do Tries:= Tries + 1; and then in the waiting I have
    if(Tries=40)then
    TerminateScript
    I added that as a failsafe. As said above, you should do it like that because if it just repeats looking for it 5 times, its not going to terminate the script.
    why not just make ur script support multiplayers then instead of making script go false just go next play and make the previous 1 false?
    Sleeping...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how do u make something repeat 28 times?
    By gore in forum OSR Help
    Replies: 11
    Last Post: 05-27-2008, 10:43 AM
  2. question about hwo many times u can
    By Mountain Lions Own? in forum Bot Information and Spottings
    Replies: 8
    Last Post: 03-16-2008, 05:34 PM
  3. Sad Times Very Sad Times
    By NiCbaZ in forum RuneScape News and General
    Replies: 26
    Last Post: 12-04-2007, 10:29 PM
  4. need some help with times
    By ShowerThoughts in forum OSR Help
    Replies: 4
    Last Post: 08-29-2007, 01:42 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
  •