Page 1 of 2 12 LastLast
Results 1 to 25 of 45

Thread: ChooseOption bugs (official)

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

    Default ChooseOption bugs (official)

    Now that ChooseOption is done similar as UpText there will be bugs. This thread is more for reports that it's completely broken as there are some cases that I haven't been able to fix without breaking something else.

    Known Bugs
    • Misreading of 'kt' or 'rt' and some others it returns 'M' instead. This is because the letters are actually connected in some cases. [Possible future fix, add 'rt' etc together which if found would return 2 letters - major rework for font system?]
    Last edited by Narcle; 02-08-2012 at 08:10 PM.
    (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.

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    I was thinking, what if you join two fonts such as "r" and "t" and when found on screen, it'll recognize it as rt.. that's one way to get around the mistakes no?
    I am Ggzz..
    Hackintosher

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

    Default

    Quote Originally Posted by ggzz View Post
    I was thinking, what if you join two fonts such as "r" and "t" and when found on screen, it'll recognize it as rt.. that's one way to get around the mistakes no?
    I thought about something similar. Actually adding a 'rt' character to fonts and then it returns 2 letters instead of one if its found. However idk if the text system can use/do that without major changes.
    (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.

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

    Default

    I think we'll need a SplitTPA with a ``leash'' - it can't differentiate itself more than n coordinates from some starty. (Something similar to x for a general case) That would prevent the SplitTPA from ``jumping'' to the next text. (You could even update this leash dynamically by using the mean of all points currently in the part of the atpa)

    Sounds like fun.



    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)

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

    Default

    This below fixes the problem just its only if they don't change the Height (for now its the same everytime).

    Simba Code:
    Function GetChooseOptions(TextType: string): Array of TOptions;
    var
       B, BB, sB, BigBox: TBox;
       TPA, TPA1, TPA2, TPA3: TPointArray;
       ATPA, tempatpa: T2DPointArray;
       I, L, target, bmp,w,h, cts: Integer;
       BoxColors: TIntegerArray;
    begin
      target := GetImageTarget;
      GetClientDimensions(B.X2, B.Y2);
      B := IntToBox(0, 0, B.X2-1, B.Y2-1);
      cts := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);
      //            Black, Top Blue, grey
      BoxColors := [131843, 3682593, 3552822];
      SetLength(ATPA, Length(BoxColors));
      for i := 0 to High(BoxColors) do
        FindColorsTolerance(ATPA[i], BoxColors[i], B.X1, B.Y1, B.X2, B.Y2, 0);
      TPA := MergeATPA(ATPA);
      If Length(TPA) < 100 Then
      begin
        ColorToleranceSpeed(cts);
        Exit;
      end;

      ATPA := SplitTPA(TPA, 4);
      For i := 0 to High(ATPA) do
      begin
        B := GetTPABounds(ATPA[i]);
        if ((B.x2-B.x1) > 90) and ((B.y2-B.y1) > 18) then
          Break
        else
          B := IntToBox(0, 0, 0, 0);
      end;

      If (B.x2 = 0) then
      begin
        ColorToleranceSpeed(cts);
        Exit;
      end;

      BigBox := B;

      SetColorToleranceSpeed(3);
      FindColorsTolerance(TPA2, 2827284, B.X1, B.Y1, B.X2, B.Y2, 16);//Background
      FindColorsTolerance(TPA1, 6968358, B.X1, B.Y1, B.X2, B.Y2, 10);//Blue Highlight
      TPA2 := CombineTPA(TPA2, TPA1);
      sB := GetTPABounds(TPA2);
      ReturnPointsNotInTPAWrap(TPA2, B, TPA);
      FindColorsTolerance(TPA3, 460291, B.X1, B.Y1, B.X2, B.Y2, 6);//shadow
      SetColorToleranceSpeed(cts);

      bmp := CreateBitmap(B.X2-B.X1+2, B.Y2-B.Y1+2);
      OffsetTPA(TPA, Point(-B.X1, -B.Y1));
      OffsetTPA(TPA3, Point(-B.X1, -B.Y1));
      FastDrawClear(bmp, 0);
      DrawTPABitmap(bmp, TPA, clRed);//Text
      DrawTPABitmap(bmp, TPA3, clPurple);//Shadow
      ocr_FilterUpTextByCharacteristics(GetMufasaBitmap(bmp));
      GetbitmapSize(bmp,w,h);
      SetTargetBitmap(bmp);  // new target for findcolorstolerance.
      //findcolorstolerance(TPA, clRed, 0, 0, w-1,h-1, 0);
      //ATPA := SplitTPAEx(TPA, 15, 2);
      SetLength(ATPA, H/16);
      for i := 0 to High(ATPA) do
        FindColorsTolerance(ATPA[i], clRed, 0, 2+i*16,  W-1, 18+i*16, 0);//+2 to y to line it up

      L := High(ATPA);
      SortATPAFromFirstPointY(ATPA, Point(w/2,0));

      SetArrayLength(Result, Length(ATPA));
      Result[0].BigBox := BigBox;
      for i := 0 to high(ATPA) do
      begin
        TPA := ATPA[i];
        tempatpa := SplitTPAEx(TPA, 1, 10); // Split one into characters
        SortATPAFromFirstPointX(tempatpa, Point(0, 0));
        Result[i].Str := GetTextATPA(tempatpa, 5, 'UpCharsEx'); //Writeln(Result[i].Str);
        BB := GetTPABounds(ATPA[i]);
        Result[i].Bounds := IntToBox(BB.X1+B.X1, BB.Y1+B.Y1, BB.X2+B.X1, BB.Y2+B.Y1);
        setlength(tempatpa,0);
        setlength(TPA,0);
      end;
      ColorToleranceSpeed(cts);
      SetImageTarget(target);
      FreeBitmap(bmp);
    end;

    I'd push it now but don't have GIT setup correctly on my laptop.
    (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.

  6. #6
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    How about the frequent crashes? Anyone have any ideas on this? It's pretty annoying; if you have a script that calls chooseoption a lot it will crash script relatively quickly.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

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

    Default

    I asked Wizzup about it too. I don't get why it says, "DrawATPA" and then only now and then it'll be on the DrawTPA line (in the function). I have yet to reproduce the error, so I haven't figured out whats causing it.

    Any particular script this happens a lot in?
    (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.

  8. #8
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Any type of script that power drops items. (Power miner/chopper). Yet, I can't get it to reproduce a lot.


    Quote Originally Posted by Kyle Undefined View Post
    It's very random, after doing 10 different DropAll's, I was only able to get it to error out twice and in two completely different places.

    First place was in FindNPCChatText which is line 738 of text.simba.

    Second place was in SortATPAFromFirstPointY at line 771, which is this:
    Simba Code:
    DistArr[i] := Round(Sqr(From.y - a[i][0].y));
    That function is called in GetChooseOptions at line 893 which is:
    Simba Code:
    SortATPAFromFirstPointY(ATPA, Point(w/2,0));
    I added WriteLn's through out the file to find out what was going on, and it stopped giving me those weird errors, which I don't know why :/

    That's all I have for it at the moment, hope it helps.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  9. #9
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    From what I've read, the FindNPCChatText out of range is very common. Happening with quite a few people when dropping, like you said. I got the SortATPAFromFirstPointY last night as well, but it was during MSI's walking.

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

    Default

    When dropping huh? Maybe when text is highlighted? Its a pain to debug when its so random. I'll mess around with it tonight before I go to sleep.
    (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.

  11. #11
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Narcle View Post
    When dropping huh? Maybe when text is highlighted? Its a pain to debug when its so random. I'll mess around with it tonight before I go to sleep.
    I actually just noticed that sometimes if the option is already highlighted, ChooseOption will return false (not choose the option). That would explain why people are getting this error on the last items (when the 'drop' option is already highlighted).

    Don't know why it would throw an out of range though.

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

    Default

    Yeah it might not be grabbing the text then if the Highlighted color changed. I just don't have the time to get all the highlighted colors to make sure the correct tolerance is set. (cts 3 works really nice for it too)
    (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.

  13. #13
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Should fix the out of range, should it not?
    Simba Code:
    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
      begin
        if (length(a[i]) <= 0) then // prevent out of range errors
          continue;

        DistArr[i] := Round(Sqr(From.y - a[i][0].y));
      end;

      QuickATPASort(DistArr, a, 0, l, True);
    end;
    If the length of a[i] was 0, it calls a[i][0], which would be an out of range. Same thing will have to be changed in SortATPAFromFirstPointX.

    E: Also, that function is right below FindNPCChatText. My guess is that Simba's just giving the wrong line number sometimes.

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

    Default

    Quote Originally Posted by Coh3n View Post
    Should fix the out of range, should it not?
    Simba Code:
    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
      begin
        if (length(a[i]) <= 0) then // prevent out of range errors
          continue;

        DistArr[i] := Round(Sqr(From.y - a[i][0].y));
      end;

      QuickATPASort(DistArr, a, 0, l, True);
    end;
    If the length of a[i] was 0, it calls a[i][0], which would be an out of range. Same thing will have to be changed in SortATPAFromFirstPointX.

    E: Also, that function is right below FindNPCChatText. My guess is that Simba's just giving the wrong line number sometimes.
    That makes sense then. If the hightlighted chooseoption isn't found (I search in boxes) then that ATPA[x] (of highlighted area) would be empty making it out of range in that function.

    Both need to be added. I'm guessing in rare cases the FindColors just happens to not see highlighted color - a tolerance increase and a better average color should fix it.
    Last edited by Narcle; 02-08-2012 at 02:48 AM.
    (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.

  15. #15
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    I can run some tests if you'd like.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


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

    Default

    Quote Originally Posted by Kyle Undefined View Post
    I can run some tests if you'd like.
    The biggest help would be picking all the different highlighted colors so we can get a average. Then you'd basically have it fixed. I still want to play with CTS3 more. I've just be playing with it painting on smart to see how high the tolerance needs to be for various functions (switching to it).

    (if this is indeed the problem and i'm leaning towards it)
    Last edited by Narcle; 02-08-2012 at 02:54 AM.
    (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.

  17. #17
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    I'll do some tweaking and commit a fix shortly.

    E: I've fixed the out of ranges, but didn't have time to tweak the colors. But at least the runtime errors should be gone.
    Last edited by Coh3n; 02-08-2012 at 06:30 AM.

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

    Default

    Nah error is still there after that fix. I figured it out. Its getting double points passed to ReturnPointsNotInTPAWrap which errors out either in that function or in DrawTPABitmap.

    I tried using ClearDoubleTPA - it fixes it but makes it delay by ~1400 ms. Trying to lower tolerances to see if it'll stop overlapping TPoints found.

    I'll have to get back to this when I have more free time.

    Edit:
    Pushed a fix, was working well for me. (only searches for one color now - yay cts3)
    Last edited by Narcle; 02-08-2012 at 09:32 AM.
    (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.

  19. #19
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    Awesome work Narcle! How does it handle the Choose Option box? I noticed the UpText and ChooseOption text, whatever color the UpText is, the ChooseOption text color is the same and the hover is the same aswell, but only lighter.
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


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

    Default

    Quote Originally Posted by Kyle Undefined View Post
    Awesome work Narcle! How does it handle the Choose Option box? I noticed the UpText and ChooseOption text, whatever color the UpText is, the ChooseOption text color is the same and the hover is the same aswell, but only lighter.
    I grabbed the various colors of the dark background of the ChooseOption got the best color for that then did the same when its Highlighted. Got the best color of the 2 together and CTS3 with 18 tolerance it'll get all the pixels around the text (including if its highlighted). Find the gaps and that's the letters. I also get the shadows of text to check it as well. Right now it works so well that you probably don't even need shadows but its better with it in for now, gives it a fail safe of sorts.
    (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.

  21. #21
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Awesome!

    Does this mean the OP is fixed as well?

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

    Default

    Quote Originally Posted by Coh3n View Post
    Awesome!

    Does this mean the OP is fixed as well?
    For now yes. I'll edit it out. Hopefully I can let this thread die >.>
    Last edited by Narcle; 02-08-2012 at 08:08 PM.
    (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.

  23. #23
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default ChooseOption Bug

    So I've noticed a bug with choose option..

    There has to be an infinite loop somewhere in there because sometimes it will right click and instead of choosing the option, it just sits there with the menu open. Happens about once every 48 hrs for me assuming I run my script that long. So it is rare but it keeps happening more than often enough for me to feel the need to report it.

    How to fix: Well it sits there, I disable smart and moved the mouse away from the menu, the script recognizes the menu isn't there and right clicks and chooses the option correctly. Seems moving the mouse away from the menu fixes it. So..?

    Oh and another thing, the withdraw function definitely needs an update as it lags like hell!! I do not lag.. only that function lags me AND it doesn't always withdraw even if the DTM is found. I've tested it 100 times in a row to see if the dtm was found, it was found 100% of the time, but the item was only withdrawn 70% of the time. The more I run it, the more the function lags.
    I am Ggzz..
    Hackintosher

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

    Default

    For ChooseOption
    Screenshot when it gets like that?

    Which Withdraw function? You mention DTM finding too. Because the current Withdraw function shouldn't have anything in it to "lag." Only thing to make it lag is if you use UpText (which'll wait 500ms) or ChooseOption bug.
    (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.

  25. #25
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    SRL's WithdrawEx and Withdraw don't use DTMs at all. If you're searching for a DTM in in a loop, make sure you have a wait(100+random(100)) each time. That's probably what's causing your lag.

Page 1 of 2 12 LastLast

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
  •