Issue: isMouseOverText() Access violation

  1. issueid=134 10-14-2013 05:49 AM
    Administrator
    isMouseOverText() Access violation

    Code:
    ---- bankScreen.quickDeposit(): Clicked quick deposit id 0
    -- isMouseOverText()
    Exception in Script: Runtime error: "Access violation" at line 544, column 62 in file "C:\Simba\Includes\SRL-6\lib\core\text.simba"
    Mouse would of moved to the 'logs' and then crashed out

    Simba Code:
    if (isMouseOverText(['logs'], 1000)) then
            begin
              fastClick(MOUSE_RIGHT);
              chooseOption.select(['All']);
              sleep(60 + random(140));
              bankScreen.close();
              sleep(60 + random(140));
              if bankScreen.isOpen() then
                bankScreen.close();
              smartImage.drawBox(tabBackPack.getSlotBox(1), false, clLime);
              tabBackpack.mouseSlot(1, MOUSE_MOVE);
              smartImage.clearArea(tabBackPack.getSlotBox(1));
              waitForUnlock;
            end;
Issue Details
Issue Number 134
Project SRL Bugs and Suggestions
Status Resolved
Users able to reproduce bug 1
Users unable to reproduce bug 0
Assigned Users euphemism
Tags (none)




  1. 10-14-2013 12:52 PM
    Community Complainer
    Il get euphemism to look at this.
  2. 10-15-2013 05:29 PM
    Senior SRL Member
    This is the same bug I've hit with my fighter script

    I posted about it but hadn't filed a bug report as I was still trying to lock onto what the issue was.

    I did some tracing and it's getting the error when accessing linesOfText[i][0][0].x

    I didn't get far enough to figure out why it was an invalid reference.

    It reproduces pretty often if you fight cockroaches in the first room of lumby dungeon with my script.
  3. 10-17-2013 12:46 PM
    SRL Developer
    I may have found the issue. The loop uses the "numberOfLines" variable, but "numberOfLines" doesn't necessarily equal the length of linesOfText (since linesOfText was split and sorted). Try adding this bit after line 540 in text.simba, and tell me if the error still occurs.

    Simba Code:
    sortATPAFromFirstPointX(linesOfText[i], point(0, h div 2));
      end; // line 540

      numberOfLines = length(linesOfText);
      if (numberOfLines <= 0) then
      begin
        print('__getMouseOverText(): No usable lines found', TDebug.ERROR);
        exit();
      end;

      for i := 0 to (numberOfLines - 1) do // loop that throws error
      begin

    You could also try changing line 542 to:

    Simba Code:
    for i := 0 to high(linesOfText) do
  4. 10-17-2013 08:52 PM
    Administrator
    Okay Coh3n. I have changed the lines as requested. I'll give you feedback to this

    Thanks
  5. 10-17-2013 08:58 PM
    SRL Junior Member
    Edit: Nevermind, continues to happen with the edits
  6. 10-18-2013 06:45 AM
    Administrator
    Code:
    -- isMouseOverText()
    Exception in Script: Runtime error: "Access violation" at line 544, column 62 in file "C:\Simba\Includes\SRL-6\lib\core\text.simba"
    Still happning :\
  7. 10-18-2013 06:44 PM
    Community Complainer
    I think it's passing an array with nothing in ie. [[]] even if i add a hacky continue if length (linesOfText[i]) < 1 it still won't read the text :(. il see if euph can take a look at it and fix it soonish, else well we might need a new one or try and repair this one. :)
  8. 10-18-2013 09:15 PM
    SRL Developer
    Quote Originally Posted by Olly
    I think it's passing an array with nothing in ie. [[]] even if i add a hacky continue if length (linesOfText[i]) < 1 it still won't read the text :(. il see if euph can take a look at it and fix it soonish, else well we might need a new one or try and repair this one. :)
    But the lines I added should have caught that.

    @Justin; can you try doing some more debugging? Add some writeln's, even if their useless. Add a writeln that prints the lenght of linesOfText and numberOfLines. After the stuff I added I really can't see why it would still give that error (unless it's not referring to an out of range).

    E: Oh scratch that, I didn't realize linesOfText was a 3D array.
  9. 10-18-2013 09:25 PM
    SRL Developer
    Alright, let's try another edit (sorry I'm not testing myself, I don't really have the time, and you guys know how to easily reproduce it).

    Simba Code:
    for i := 0 to (numberOfLines - 1) do
      begin
        if (length(linesOfText[i]) < 1) then
        begin
          print('__getMouseOverText(): Length linesOfText[i] = 0', TDebug.ERROR);
          break;
        end;

        if (length(linesOfText[i][0]) < 1) then
        begin
          print('__getMouseOverText(): Length linesOfText[i][0] = 0', TDebug.ERROR);
          break;
        end;

        colorCheck := fastGetPixel(cleanBitmap, linesOfText[i][0][0].x, linesOfText[i][0][0].y);
  10. 10-18-2013 10:36 PM
    SRL Junior Member
    Quote Originally Posted by Coh3n
    Alright, let's try another edit (sorry I'm not testing myself, I don't really have the time, and you guys know how to easily reproduce it).

    Simba Code:
    for i := 0 to (numberOfLines - 1) do
      begin
        if (length(linesOfText[i]) < 1) then
        begin
          print('__getMouseOverText(): Length linesOfText[i] = 0', TDebug.ERROR);
          break;
        end;

        if (length(linesOfText[i][0]) < 1) then
        begin
          print('__getMouseOverText(): Length linesOfText[i][0] = 0', TDebug.ERROR);
          break;
        end;

        colorCheck := fastGetPixel(cleanBitmap, linesOfText[i][0][0].x, linesOfText[i][0][0].y);
    ^ Works

    Doesn't break when looking for mouse text when hovering over a player.

    Edit:
    Does not cause access violation but seems to spam 'ERROR: __getMouseOverText(): Length linesOfText[i] = 0'
    when the same circumstances occur.
  11. 10-19-2013 02:25 AM
    msimehpue
    Hmm. Well, I will try to fix this as soon as I can if nobody else has claimed it.
  12. 10-21-2013 09:00 PM
    Administrator
    Coh3n's fix works for now, should that be pushed to the live include until euph can figure it out?
  13. 10-23-2013 02:49 AM
    SRL Developer
    Quote Originally Posted by Justin
    Coh3n's fix works for now, should that be pushed to the live include until euph can figure it out?
    Yeah I've committed the fix. Let me know if everything is okay.
  14. 10-23-2013 04:04 AM
    Administrator
    Hard to tell now since fonts changed and isMouseOverText is broken
  15. 10-23-2013 02:39 PM
    SRL Developer
    alkjnv;oasjnv;lajsndf;ljasndflasdf
  16. 10-23-2013 03:57 PM
+ Reply