Results 1 to 12 of 12

Thread: Function wont find Bank

  1. #1
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Function wont find Bank

    Hey,

    i made my own function to find the bank, however it doesnt seem to be able to open the bank.

    Simba Code:
    Function MyOpenBank:Boolean;
    var
    TPA : TPointArray;
    ATPA :  T2DPointArray;
    x, y, i, ii:Integer;
    begin
      Result:= False;
      if BankScreen then
      begin
        Result:= True;
        Writeln('Bank Found');
        Exit;
      end;
      MakeCompass('W');
      Wait(300);   //screen settel
      FindColorsTolerance(TPA, MyFindColor('bank', False), MSX1, MSY1, MSX2, MSCY, 5);
      //DebugTPA(TPA, '');
      //Wait(3000);
      ATPA := SplitTPAEx(TPA, 10, 10);
      SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
      //DebugATPABounds(ATPA);
      ii := High(ATPA);   //get higherst entry in array
      for i := 0 to ii do  //from 0 first entry in array to ii highest entry
      begin
        MiddleTPAEx(ATPA[i], x, y);//find middle of array entry
        MMouse(x, y, 3, 3);
        if WaitUpTextMulti(['ooth', 'ank booth'], 300) then
        begin
          Mouse(x, y, 0, 0, False);
          Wait(200);        //ERROR HERE
          //ChooseOption('uickly');          //Dont work
          //WaitOptionMultiEx(['se-quickly', 'uickly'], 'all', ClickLeft, 200);//Dont work
          //WaitOption('uickly', 500); //Dont work
          ChooseOptionMultiEx(['uickly'], 'all', ClickLeft) //Dont work
          Flag;
          Wait(2000 + Random(800));
          if BankScreen then
          begin
            Result:= True;
            Writeln('Bank Found');
            Exit;
          end;
        end;
      end;
    end;

    i have tried just using SRL's OpenBank(); and that works fine, however my function wont for for some reason.

    any ideas
    Last edited by Bobzilla69; 09-21-2010 at 10:54 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    What part is it getting hung up on/What is it doing or not doing that you have defined? What bank are you trying to open?

    Also Some to think about.

    Simba Code:
    ii := High(ATPA);   //get higherst entry in array
      for i := 0 to ii do  //from 0 first entry in array to ii highest entry

    Could be

    Simba Code:
    for i := 0 to High(ATPA) do

    ~BraK
    Last edited by BraK; 09-21-2010 at 10:36 AM.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  3. #3
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    What part is it getting hung up on/What is it doing or not doing that you have defined? What bank are you trying to open?

    ~BraK
    hey,

    its getting stuck on choosing the option, which would be uickly.

    but i have done some more testing and it seems to be that it will find,
    Simba Code:
    chooseoption('uic')
    chooseoption('uick')
    chooseoption('uickl')

    however
    Simba Code:
    chooseoption('uickly')

    will not work, must be a problem with the character y

    cant anyone else confirm the same problem?

    edit: thanks for the extra scripting advice

  4. #4
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Quote Originally Posted by bobzilla69 View Post
    hey,

    its getting stuck on choosing the option, which would be uickly.

    but i have done some more testing and it seems to be that it will find,
    Simba Code:
    chooseoption('uic')
    chooseoption('uick')
    chooseoption('uickl')

    however
    Simba Code:
    chooseoption('uickly')

    will not work, must be a problem with the character y

    cant anyone else confirm the same problem?

    edit: thanks for the extra scripting advice
    Did you Shorten it the other way 'ckly' and 'kly'

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  5. #5
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    Did you Shorten it the other way 'ckly' and 'kly'

    ~BraK
    yes i just tried now, they dont work.

    from what i can see it wont work if its any characters and y

    so uickly, ickly, ckly, kly, ly. none of those will work.

    if you simply do y. that will work


    edit:
    below is script i used to test, its crude but shows if its working

    simply run script and quickly right click bank.
    Simba Code:
    program new;
    {$i srl/srl.scar}
    begin
    setupsrl;
    wait(4000); //wait to allow you to right click bank
    ChooseOption('y');
    end.
    Last edited by Bobzilla69; 09-21-2010 at 10:49 AM.

  6. #6
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    It's Always a good to test all directions. You found even more info on the problem. By doing so You isolated it further. That Way it's easier to fixed for the devs.

    Good Job
    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  7. #7
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    It's Always a good to test all directions. You found even more info on the problem. By doing so You isolated it further. That Way it's easier to fixed for the devs.

    Good Job
    ~BraK
    hehehe, thanks, you help

    will update bug post on it now

  8. #8
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    MMouse(x, y, 3, 3);
        if WaitUpTextMulti(['ooth', 'ank booth'], 300) then
        begin
          Mouse(x, y, 0, 0, False);


    You might want to put a GetMousePos(x, y) before clicking the mouse since your MMouse is a random 3.

    Anyways yea, the y bitmap for upchars is off by a pixel or two, I'll update that and bump this thread http://villavu.com/forum/showthread.php?t=59071 with a fix, but you could of avoided this all together by just not using the y character in your choose option or using chooseoptionmulti with one more inputs with out the y.

  9. #9
    Join Date
    May 2007
    Location
    Some where fun.
    Posts
    2,891
    Mentioned
    1 Post(s)
    Quoted
    5 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    What part is it getting hung up on/What is it doing or not doing that you have defined? What bank are you trying to open?

    Also Some to think about.

    Simba Code:
    ii := High(ATPA);   //get higherst entry in array
      for i := 0 to ii do  //from 0 first entry in array to ii highest entry

    Could be

    Simba Code:
    for i := 0 to High(ATPA) do

    ~BraK
    He had it right, your way is slower. It has to call High() every time it iterates the loop, his way it calls it once.

  10. #10
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by IceFire908 View Post
    SCAR Code:
    MMouse(x, y, 3, 3);
        if WaitUpTextMulti(['ooth', 'ank booth'], 300) then
        begin
          Mouse(x, y, 0, 0, False);


    You might want to put a GetMousePos(x, y) before clicking the mouse since your MMouse is a random 3.

    Anyways yea, the y bitmap for upchars is off by a pixel or two, I'll update that and bump this thread http://villavu.com/forum/showthread.php?t=59071 with a fix, but you could of avoided this all together by just not using the y character in your choose option or using chooseoptionmulti with one more inputs with out the y.
    ok cool, thanks for the update. yeh i ahve now used the multi with and without the y

    Quote Originally Posted by Camaro' View Post
    He had it right, your way is slower. It has to call High() every time it iterates the loop, his way it calls it once.
    ok, its good to know which is faster will make script more stream line and effective.

  11. #11
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Quote Originally Posted by Camaro' View Post
    He had it right, your way is slower. It has to call High() every time it iterates the loop, his way it calls it once.
    Huh didn't know that it would slow it down. that's good to know.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  12. #12
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    Huh didn't know that it would slow it down. that's good to know.
    It doesn't seriously slow it down. Unless you want to iterate over 1000000 points which will be slow anyway.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

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
  •