Results 1 to 16 of 16

Thread: DTM Failure in AntiRandoms.scar and Simba Fail

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default DTM Failure in AntiRandoms.scar and Simba Fail

    Hello,

    I really do not wish to create a bug tracking account or whatever it is, I will just make a post here.

    Recently, while trying to work on msi, I became aware of a failure in both SRL and Simba. First, I will mention the failure of Simba. What I wish to bring to the attention of developers is the poor error reports. It gave the wrong location, as well as an error which is impossible to follow up.

    PHP Code:
    ErrorExceptionThe given DTM Index[0doesn't exist at line 352 
    The client then opened up "Antirandoms.scar" and highlighted line 352. Looking at the line (Opendev revision) you may be confused, as you should be. The line is blank. Prior is "Function FindFight : Boolean" and after is "begin". But this could not be the error which is causing the crash, so I looked through the FindFight function and the function preceding it. Neither even contained a DTM finding/freeing function.

    So I asked my friend Cohen to open up SCAR, and run msi. When he got the error, he got the report:

    PHP Code:
    [Runtime Error] : ExceptionAccess violation at address 007876D4 in module 'scar.exe'Read of address 00000000 in line 383 in script Z:\home\cohen\SCAR\includes\SRL\SRL\Core\AntiRandoms\AntiRandoms.scar 
    Looking at the include, the code is:

    SCAR Code:
    GameTab(tab_Inv);
      if not SRLBitmapsLoaded then
        LoadSRLBitMaps;
      if (FindDTM(Lamp, x, y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        Result := True;

    Where line 383 is the FindDTM(Lamp) line.

    So, I have no idea why this causes a crash, but the only thing I can think of is that the DTMs aren't loading like they should, causing a crash.

    If someone could clear this up and update the rev, I would greatly appreciate it. As well, if someone could look into why Simba reported the wrong line/area for the failure, that would be appreciated. The error reports in Simba require a large overhaul IMO, because the ones in SCAR actually tell you what went wrong, where the Simba ones are confusing and don't actually help.

    Thanks for your patience,
    Garrett
    Last edited by Wanted; 05-16-2010 at 08:56 PM.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  2. #2
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    I have also had some problems Simba outputting "These bitmaps have not been freed: SRL_Lamp" or something. And there was some other too.
    There used to be something meaningful here.

  3. #3
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by Frement View Post
    I have also had some problems Simba outputting "These bitmaps have not been freed: SRL_Lamp" or something. And there was some other too.
    Seems something in the Antirands went wrong.

    PS- To any staffers, I probably shouldn't have tagged this "Confirmed" but myself and Cohen both have the newest SRL and msi and have the same problem, so I considered it confirmed.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  4. #4
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Those bitmaps are up to the user to be freed (FreeSRLBitmaps) at the end of the script. Garret, I can't seem to reproduce your bug:

    SCAR Code:
    program new;
    {.include SRL/SRL.scar}

    begin
      SetupSRL;
      FindLamp('test');
    end.

    should crash according to you? Are you sure this is not an MSI bug?

  5. #5
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by nielsie95 View Post
    Those bitmaps are up to the user to be freed (FreeSRLBitmaps) at the end of the script. Garret, I can't seem to reproduce your bug:

    SCAR Code:
    program new;
    {.include SRL/SRL.scar}

    begin
      SetupSRL;
      FindLamp('test');
    end.

    should crash according to you? Are you sure this is not an MSI bug?
    At first I thought the same thing as you, but when looking at the reports of SCAR and Simba, it seems highly unlikely that MSI is causing a crash but reporting it as a fault in Antirandoms.

    I will look through MSI, but if it becomes a case of MSI causing the crash, I would wish for a Simba Dev to take a hard look at the error reporter, because it just doesn't make sense that it is reported in the way that it is.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  6. #6
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    I've did a quick search through SRL and MSI, but I can't find anything that changed the Lamp variable, so the only thing I can come up with is that it is not loading properly. What script did you run? RunMe.scar from MSI?

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

    Default

    Quote Originally Posted by nielsie95 View Post
    I've did a quick search through SRL and MSI, but I can't find anything that changed the Lamp variable, so the only thing I can come up with is that it is not loading properly. What script did you run? RunMe.scar from MSI?
    Yes. I had almost exactly the same problem a while back (except I was getting a "DTM is not consistant" error. See this thread for more details). The same line in AntiRandoms would get highlighted (the blank on in Simba), but it was eventually fixed when I discovered that the loading and freeing of the msi items was in the wrong place in Banking.scar.

    I'm been looking at MSI/SRL for the last 20 minutes and I cannot figure out what would cause this. Recently, DDTMs were added to MSI to replace the DTMs for items such as hatchets/logs/ores. Right now, only hatchets and logs have been added in this system. I'm guessing this problem arose once again when the DDTM system was committed.

    However, I don't think that's the problem because I'm running MSI as a powerchopper right now and it's working perfectly, so I don't think there's any problem when the loading/freeing of the DDTMs.
    Last edited by Coh3n; 05-16-2010 at 07:18 PM.

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

    Default

    Quote Originally Posted by 3Garrett3 View Post
    PHP Code:
    ErrorExceptionThe given DTM Index[0doesn't exist at line 352 
    PHP Code:
    [Runtime Error] : ExceptionAccess violation at address 007876D4 in module 'scar.exe'Read of address 00000000 in line 383 in script Z:\home\cohen\SCAR\includes\SRL\SRL\Core\AntiRandoms\AntiRandoms.scar 
    Looking at the include, the code is:

    If someone could clear this up and update the rev, I would greatly appreciate it. As well, if someone could look into why Simba reported the wrong line/area for the failure, that would be appreciated. The error reports in Simba require a large overhaul IMO, because the ones in SCAR actually tell you what went wrong, where the Simba ones are confusing and don't actually help.

    Thanks for your patience,
    Garrett
    Ehm, do you find
    Exception: Access violation at address 007876D4 in module 'scar.exe'. Read of address 00000000 in line 383 in script Z:homecohenSCARincludesSRLSRLCoreAntiRandomsAntiRa ndoms.scar
    a better error than
    Error: Exception: The given DTM Index[0] doesn't exist at line 352
    ?

    In this case, Simba tells you exactly what is wrong. The DTM is not loaded correctly somehow. (Either an error in the script or in Simba, but I'm pretty sure it is an error in the script, seeing that it stops SCAR too)
    SCAR however, doesn't tell you anything. I can't grasp how you find the Simba errors not informative...

    Back on topic... Try finding out what revision causes this bug?

    Quote Originally Posted by Frement View Post
    I have also had some problems Simba outputting "These bitmaps have not been freed: SRL_Lamp" or something. And there was some other too.
    Ehm... Simba tells you those bitmaps weren't freed by SRL, and then frees them itself. SCAR however, does not tell you this, nor does it free the bitmaps SRL has not freed.



    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)

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

    Default

    SCAR Code:
    {.include SRL\SRL.scar}

    procedure ScriptTerminate;
    begin
      SRLFreeBitmaps;
    end;

    begin
      SetUpSRL;
      FindNormalRandoms;
    end.

    This is not a problem with SRL.

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

    Default

    Quote Originally Posted by Wizzup? View Post
    Back on topic... Try finding out what revision causes this bug?
    That's actually a really good idea. I'm going to check that out now.

    <3

  11. #11
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    Ehm... Simba tells you those bitmaps weren't freed by SRL, and then frees them itself. SCAR however, does not tell you this, nor does it free the bitmaps SRL has not freed.
    Yeah I know Thats why Simba > SCAR.
    There used to be something meaningful here.

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

    Default

    Quote Originally Posted by Frement View Post
    Yeah I know Thats why Simba > SCAR.
    Correction: Raymond just told me that SCAR does free the bitmaps, it just doesn't tell you about it.



    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)

  13. #13
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    Ehm, do you find
    Exception: Access violation at address 007876D4 in module 'scar.exe'. Read of address 00000000 in line 383 in script Z:homecohenSCARincludesSRLSRLCoreAntiRandomsAntiRa ndoms.scar
    a better error than
    Error: Exception: The given DTM Index[0] doesn't exist at line 352
    ?

    In this case, Simba tells you exactly what is wrong. The DTM is not loaded correctly somehow. (Either an error in the script or in Simba, but I'm pretty sure it is an error in the script, seeing that it stops SCAR too)
    SCAR however, doesn't tell you anything. I can't grasp how you find the Simba errors not informative...

    Back on topic... Try finding out what revision causes this bug?



    Ehm... Simba tells you those bitmaps weren't freed by SRL, and then frees them itself. SCAR however, does not tell you this, nor does it free the bitmaps SRL has not freed.
    Well, to look at it from a purely informational basis with the report, you could argue that Simba was correct. It told me that the DTM did not exist on line 352 of antirandoms.scar. This is true. However, when looking from a "bug fixing" point of view, the report has no value of help at all, because it points to a blank line of something that wasn't even called.

    The SCAR report doesn't say why, of course, and does not mention DTM freeing of any sort. But, it does direct to something that would make sense; a line containing a DTM finding function. It also tells us definitively that the error was contained in the Antirandoms.scar file, which I had purposely updated this morning from the opendev revision.

    In reality, neither report was 100% helpful. The combination of both was what lead me to the information. What I'm saying is that without SCAR's debugging, we would have no way of knowing what went wrong, because the line reported as causing the flaw was erroneous in Simba's reporting system.

    This was all on topic, as my original report contained two bugs, the reporting system, and the apparent "bug" which is only replicated through MSI, but appears in SRL for some reason.

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

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

    Default

    I found the problem, although I have absolutely not idea why it was causing an error. In the following function, an array of MSI items is loaded, then the items are deposited into the bank, then the items are freed regardless of whether they were actually deposited or not.
    Pascal Code:
    Function MSI_Deposit(Items, Amount: TIntegerArray) : Boolean;
    Var ATPA2 : Array Of TPointArray;  //The length is the same as items.colors
        ATPA : T2DPointArray;
        I, BX, BY, II, DX, DY, XX, YY, Tol : Integer;
        BitmapCheck, TextCheck, DTMCheck : Boolean;
        TB : TBox;

    Begin
      if (not LoggedIn) then
        Exit;
       
      if (Length(Amount) <= 0) then
      begin
        SetLength(Amount, Length(Items));
        for i := 0 to High(Amount) do
          Amount[i] := 28;
      end;

      If Not WaitFunc(@BankScreen, 70, 1300) Then  //Just in case
        Exit
      Else begin
        MSI_LoadItems(Items);
        For I := 0 To High(Items) Do
        Begin
          Tol := 0;
          Repeat
            BitmapCheck := FindBitmapToleranceIn(MSI_Item[Items[I]].BMP, BX, BY, MIX1, MIY1, MIX2, MIY2, Tol);
            IncEx(Tol, INC_TOL);
          Until(BitmapCheck) Or (Tol >= MAX_TOL);

          If Not BitmapCheck Then
          Begin
            SetArrayLength(ATPA2, High(MSI_Item[Items[I]].Colors)+1)

            For II := 0 To High(MSI_Item[Items[I]].Colors) Do
              FindColorsTolerance(ATPA2[II], MSI_Item[Items[I]].Colors[II], MIX1, MIY1, MIX2, MIY2, 15);

            ATPA2[0] := MergeATPA(ATPA2);
            ATPA := SplitTPA(ATPA2[0], 5);

            For II := 0 To High(ATPA) Do
            Begin
              TB := IntToBox(ATPA[II][0].x - 50, ATPA[II][0].y - 50,
                    ATPA[II][0].x + 43, ATPA[II][0].y + 44);

              DTMCheck := DTMRotated(MSI_Item[Items[I]].DTM, DX, DY, TB.x1, TB.y1, TB.x2, TB.y2);
              MMouse(DX, DY, 2, 3);
              TextCheck := WaitUpTextMulti(MSI_Item[Items[I]].UpText, 150+Random(30));
              If TextCheck Then Break;
            End;
          End;

          If BitmapCheck Or TextCheck Then
          Begin
            If BX + BY > 0 Then
              MMouse(BX, BY, 2, 3);

            TextCheck := WaitUpTextMulti(MSI_Item[Items[I]].UpText, 1200);
            GetMousePos(XX, YY);
            Result := TextCheck;

            If Result Then
            Begin
              Mouse(XX, YY, 0, 0, False);

              If Amount[I] >= 28 Then
                Result := WaitOption('-All', 1200);

              If InIntArray([1, 5, 10], Amount[I]) Then
                Result := WaitOption('-'+IntToStr(Amount[I]), 1200)
              Else
              Begin
                If WaitOption('-X', 900) Then
                 If WaitColor(254, 401, ClBlack, 0, 1200) Then
                   TypeSend(IntToStr(Amount[I]));

                   Result := True;
              End;

              If Result Then
                MSI_Debug('MSI_Deposit', 'Deposited Amount '+IntToStr(Amount[I])+
                          ' Of Item : ''' +MSI_Item[Items[I]].Name+'''', DEBUG_SMALL_DETAILS);
            End;
          End;
        End;

        MSI_FreeItemArray(Items); //if you comment out this line, the error no longer occurs.
      end;
    End;
    Notice the comment on the MSI_FreeItemArray line. Since the item was loaded, deposited and the function returned true, I don't see why there would be an error.

    The script even moves on. It starts walking back to the location THEN the DTM error occurs.

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

    Default

    My guess is MSI is improperly freeing a DTM, which is probably not loaded making it "0" which is the same as the LampDTM (the first loaded is 0) then when you go to use FindLamp the lamp dtm is not loaded because MSI freed it.

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

    Default

    Quote Originally Posted by IceFire908 View Post
    My guess is MSI is improperly freeing a DTM, which is probably not loaded making it "0" which is the same as the LampDTM (the first loaded is 0) then when you go to use FindLamp the lamp dtm is not loaded because MSI freed it.
    That seems logical. I'm testing a a fix now. It should get rid of all the problems plus slightly improve efficiency.

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
  •