Results 1 to 19 of 19

Thread: 30 Nov ChooseOption Fix

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

    Default 30 Nov ChooseOption Fix

    Narcle and I have done some more work on stabilizing ChooseOption. it should be a lot more stable now. (Update your SRL)

    If it is slow you either don't have Simba 975 (which is not yet released, but will be soon) or Simba 0.98-rc7 or higher. If you don't have a Simba that accelerates ChooseOption you will see a warning at compile time.

    So without a newer Simba it will be slow (max 1s!), but it will still work a lot better than the previous ChooseOption fix. Or it should anyway.

    I'll update this post when Simba 975 is in the autoupdater.

    Feedback is welcome.

    E: If you're updating your Simba, you should consider trying Simba 0.98-rc7. ( http://villavu.com/forum/showthread.php?p=852119 )
    Last edited by Wizzup?; 11-30-2011 at 09:16 PM.



    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)

  2. #2
    Join Date
    Jan 2010
    Posts
    1,414
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thank you, Wizzup and Narcle.

  3. #3
    Join Date
    Nov 2011
    Location
    Sacramento, CA
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you, much appreciated.

  4. #4
    Join Date
    Oct 2011
    Location
    Chicago
    Posts
    3,352
    Mentioned
    21 Post(s)
    Quoted
    437 Post(s)

    Default

    Thank you both




    Anti-Leech Movement Prevent Leeching Spread the word
    Insanity 60 Days (Killer workout)
    XoL Blog (Workouts/RS/Misc)

  5. #5
    Join Date
    Oct 2011
    Location
    Ireland
    Posts
    68
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Great fix, thanks guys.. much appreciated

  6. #6
    Join Date
    Jun 2006
    Posts
    694
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default

    Updated SRL. Updated Simba.

    Chooseoption still broken.

    How I test; OpenBankNPC at edgeville.

    Sigh.

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

    Default

    Quote Originally Posted by wyn10 View Post
    Updated SRL. Updated Simba.

    Chooseoption still broken.

    How I test; OpenBankNPC at edgeville.

    Sigh.
    Picture would be helpful.



    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)

  8. #8
    Join Date
    Jun 2006
    Posts
    694
    Mentioned
    0 Post(s)
    Quoted
    31 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    Picture would be helpful.

    Here's 3.




  9. #9
    Join Date
    Jan 2011
    Posts
    121
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for the fix guys; working well for me throughout Falador.

  10. #10
    Join Date
    Aug 2007
    Location
    Hawaii
    Posts
    3,880
    Mentioned
    7 Post(s)
    Quoted
    152 Post(s)

    Default

    Will test when I get home from uni.
    Faith is an oasis in the heart which will never be reached by the caravan of thinking.

  11. #11
    Join Date
    Nov 2011
    Location
    Netherlands
    Posts
    31
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yaa thnx for the info

  12. #12
    Join Date
    Nov 2011
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Exclamation

    Deposit(a, b, true) = broke

    Its depositing 1 by 1.. when it should be selecting Deposit-All or when unique Deposit..


    ::EDIT::
    In SRL Bank:
    I changed this:
    WaitOptionMulti(['Deposit-All', 'Deposit'], 200);

    to this:
    WaitOptionMulti(['Deposit-All', 't-All'], 200);

    and then it worked but than there's this issue:
    if there's an item (unique) in your inventory you can't deposit it unless you leave the bug in SRL.. but then its depositing 1 by 1. been trying all sorts of things in SRL bank but no go..

    tried some other things but no succes..
    ::END EDIT::
    Last edited by Trippeh; 11-30-2011 at 11:56 PM.

  13. #13
    Join Date
    Oct 2008
    Location
    behind you!
    Posts
    1,688
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Quote Originally Posted by Trippeh View Post
    Deposit(a, b, true) = broke

    meaning:
    if there's an item (unique) in your inventory you can't deposit it unless you leave the bug in SRL.. but then its depositing 1 by 1. been trying all sorts of things in SRL bank but no go..
    This ^ and i still get the warning even after i downloaded rc7. I am not sure if that's supposed to be like that
    Hi

  14. #14
    Join Date
    Nov 2011
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Tickyy View Post
    This ^ and i still get the warning even after i downloaded rc7. I am not sure if that's supposed to be like that
    download RC8 mate ;-)

  15. #15
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Tickyy/Everone getting the not accelerated warning.
    Go check out the newest Simba download thread again, wizzup edited it with a working link to proper version.

  16. #16
    Join Date
    Mar 2007
    Location
    USA
    Posts
    1,433
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    OpenBankNPC still fails... Here is an image:
    I'm Silent SPY
    Secret project: 0%
    Need help? Send me a PM

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

    Default

    Quote Originally Posted by Silent SPY View Post
    OpenBankNPC still fails... Here is an image:
    I'm beginning to think it might just not find the Choose Option menu itself, because that image works for me (cropped to chooseoption):

    Code:
    Compiled successfully in 33 ms.
    Size: 116, 102
    Time: 1
    6, 6 : Talk-to Banker
    67, 30 : Bank Banker
    62, 44 : Collect Banker
    38, 62 : Walk here
    29, 79 : Examine Banker
    44, 91 : Cancel
    115, 101 : 
    Time: 63
    Successfully executed.
    (You can safely disregard the olive colour there)




    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)

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

    Default

    For those who want to test:

    Simba Code:
    program new;

    // HERE BE DRAGONS
    procedure FilterUpTextByCharacteristics(bmp: TMufasaBitmap);
    var
       x,y: Integer;
    begin
      { Filter 2
        This performs a `simple' filter.
        What we are doing here is simple checking that if Colour[x,y] is part
        of the uptext, then so must Colour[x+1,y+1], or Colour[x+1,y+1] is a shadow.
        if it is neither, we can safely remove it.

        XXX: This causes the previously mentioned fuckup.
      }

     for y := 0 to bmp.Height - 2 do
       for x := 0 to bmp.Width - 2 do
       begin
         if bmp.fastgetpixel(x,y) = clPurple then
           continue;
         if bmp.fastgetpixel(x,y) = clBlack then
           continue;
         if (bmp.fastgetpixel(x,y) <> bmp.fastgetpixel(x+1,y+1)) and
              (bmp.fastgetpixel(x+1,y+1) <> clpurple) then
           bmp.fastsetpixel(x,y,{clAqua}0);
       end;

      {
        Remove false shadow. (A shadow isn't larger than 1 pixel. So if x, y is
        shadow, thex x+1, y+1 can't be shadow. If it is, we can safely remove it.
        (As well as x+2, y+2, etc).

        The tricky part of the algorithm is that it starts at the bottom,
        removing shadow point x,y if x-1,y-1 is also shadow.
      }


     for y := bmp.Height - 1 downto 1 do
       for x := bmp.Width - 1 downto 1 do
       begin
         if bmp.fastgetpixel(x,y) <> clPurple then
           continue;
         if bmp.fastgetpixel(x,y) = bmp.fastgetpixel(x-1,y-1) then
         begin
           bmp.fastsetpixel(x,y,clSilver);
           continue;
         end;
         if bmp.fastgetpixel(x-1,y-1) = 0 then
           bmp.fastsetpixel(x,y,clSilver);
       end;

      // Now we do another filter, with uptext chars identity 1 and 2.
      for y := bmp.Height - 2 downto 0 do
        for x := bmp.Width - 2 downto 0 do
        begin
          if bmp.fastgetpixel(x,y) = clPurple then
            continue;
          if bmp.fastgetpixel(x,y) = clBlack then
            continue;

          // identity 1
          if (bmp.fastgetpixel(x,y) = bmp.fastgetpixel(x+1,y+1) ) then
            continue;

          // identity 2
          if bmp.fastgetpixel(x+1,y+1) <> clPurple then
          begin
            bmp.fastsetpixel(x,y,0); // 0 was clOlive
            continue;
          end;

         // If we make it to here, it means the pixel is part of the uptext.
       end;
    end;

    procedure SortATPAFromFirstPointY(var a: T2DPointArray; const From: TPoint);
    var
       i, l: Integer;
       DistArr: TIntegerArray;
    begin
      l := High(a);
      if (l < 0) then Exit;
      SetLength(DistArr, l + 1);
      for i := 0 to l do
        DistArr[i] := Round(Sqr(From.y - a[i][0].y));
      QuickATPASort(DistArr, a, 0, l, True);
    end;

    procedure SortATPAFromFirstPointX(var a: T2DPointArray; const From: TPoint);
    var
       i, l: Integer;
       DistArr: TIntegerArray;
    begin
      l := High(a);
      if (l < 0) then Exit;
      SetLength(DistArr, l + 1);
      for i := 0 to l do
        DistArr[i] := Round(Sqr(From.x - a[i][0].x));
      QuickATPASort(DistArr, a, 0, l, True);
    end;


    var
       bmp, bmp2: integer;
       w, h: integer;
       cts: integer;
       i: integer;

       s: String;

       P, P2: TPointArray;
       ATPA: Array of TPointArray;
       ATPATemp: Array of TPointArray;
       t,t2:integer;
       Colors: TIntegerArray;
       target: Integer;

    begin
      target := GetImageTarget;

     // LoadFont('SmallCharsNS', True);  // If we want to use shadows

      bmp := LoadBitmap('chooseopt5.bmp'); // Bitmap to search on

      SetTargetBitmap(bmp);
      GetClientDimensions(w, h);
      Writeln('Size: ' + inttostr(w) + ', ' + inttostr(h));

      cts := GetToleranceSpeed;
      SetColorToleranceSpeed(1);

      SetLength(P, 0);
      SetLength(P2, 0);

      // I forgot which colours these are. You'll need each of the colours here.
      {FindColorsTolerance(P, 7901592, 0, 0, w-1, h-1, 15);
      P2 := CombineTPA(P, P2);    // Don't forget to combine.
      FindColorsTolerance(P, 3765443, 0, 0, w-1, h-1, 15);
      P2 := CombineTPA(P, P2);
                                  }


      Colors := [14210562, 14803165, 1865668, 8560553, 317398];//Object Blue, Player White, Item Orange, Action Tan, NPC Yellow
      SetLength(ATPA, Length(Colors));
      for i := 0 to High(Colors) do
        FindColorsTolerance(ATPA[i], Colors[i], 0, 0, w-1, h-1, 50);
      P2 := MergeATPA(ATPA);

      // Shadows
      FindColorsTolerance(P, 460291, 0, 0, w-1, h-1, 30);

      // Reset CTS
      SetColorToleranceSpeed(cts);

      // Copy of the bitmap, blank
      bmp2 := CreateBitmap(w+1, h+1);

      // Clear it
      FastDrawClear(bmp2, 0);
      DrawTPABitmap(bmp2, P2, clRed);
      DrawTPABitmap(bmp2, P, clPurple);

      // this takes a lot of time, but will be in simba/plugin
      t := gettickcount;
      ocr_FilterUpTextByCharacteristics(GetMufasaBitmap(bmp2));
      t2 := gettickcount;
      writeln('Time: ' + inttostr(t2-t));


      // Draw something nice.
      DisplayDebugImgWindow(w, h);
      DrawBitmapDebugImg(bmp2);
      DisplayDebugImgWindow(w, h);

      SaveBitmap(bmp2, 'test.bmp');

      settargetbitmap(bmp2);  // new target for findcolorstolerance.
      // we need to reset the client properly afterwards.

      // comment this for shadow
      findcolorstolerance(P, clRed, 0, 0, w-1,h-1, 0);

      // uncomment this for shadow
      //findcolorstolerance(P, clPurple, 0, 0, w-1,h-1, 0);

      t := gettickcount;

      ATPA := SplitTPAEx(P, 15, 2);
      //SortATPAFromFirstPoint(ATPA, Point(0,0));
      SortATPAFromFirstPointY(ATPA, Point(w/2, 0));

      for i := 0 to high(ATPA) do
      begin
        P := ATPA[i];
        ATPATemp := SplitTPAEx(P, 1, 10); // the 1 used to be 2, make it 2 if you
                                          // experience problems with spacing
        //SortTPAFrom(P, Point(0, 0));
       // SortATPAFromFirstPoint(ATPATemp, P[0]);
        SortATPAFromFirstPointX(ATPATemp, Point(0, 0));

        DrawATPABitmap(bmp2, ATPATemp);  // split draw

        s := GetTextATPA(ATPATemp, 4, 'SmallChars');  // note that this is no shadow atm
        // if you want to do it for shadow,
        writeln(IntToStr(P[0].x) + ', ' + IntToStr(P[0].y) + ' : '  + s);

        setlength(atpatemp,0);
        setlength(p,0);
      end;

      t2 := gettickcount;
      writeln('Time: ' + inttostr(t2-t));

      SaveBitmap(bmp2, 'test_split.bmp');

      SetImageTarget(target);
      //SetDesktopAsClient;
      FreeBitmap(bmp);
      FreeBitmap(bmp2);
    end.

    Code is not exactly the same (but largely) the same as Narcle's in SRL. It doesn't ``detect'' the menu, it only extracts text.

    Set the bitmap name (chooseopt5.bmp atm), and crop the bitmap (saves a lot of crap) to the chooseoption menu.
    Also, if you have an old simba, remove the ocr_ prefix from the filter. (You'll find out where that is as soon as it gives a compiling error)

    If that identifies the text properly, the problem is not in the OCR but rather finding the actual ChooseOption MENU.



    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)

  19. #19
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    OpenBankNPC is now fixed. Was a cts problem, I also added this to compass as it didn't have cts speed check. If it fixes anything, no clue. xD
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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
  •