Results 1 to 18 of 18

Thread: Error

  1. #1
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default Error

    Simba Code:
    for i := 1 to 3 do
        begin
          if GetCurrentTab <> tab_Magic then
            GameTab(tab_Magic);
          if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
            Mouse(x, y, 2, 2, true);
          FreeBitmap(Bitmap);
          while (GetCurrentTab <> tab_Inv) and (a <= 3) do
            begin
              wait(300);
              a := i + 1;
            end;
          R_FindRandoms;
          MouseItem(i, true);
          while (GetCurrentTab <> tab_Magic) and (b <= 3) do
            begin
              wait(500 + random(500));
              b := b + 1;
            end;
          AntiBan;
        end;
    when i ran the script yesterday and the day before it ran perfectly, but today it gave me this error:
    Error: Exception: The bitmap[2] does not exist at line 69(if findbitmaptol....then)
    The following DTMs were not freed: [SRL - Lamp bitmap]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
    File[C:\Simba\Includes\SRL/logs/SRL log 16-12-10 14.txt] has not been freed in the script, freeing it now.

    Any ideas on how to fix it?

  2. #2
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Can you show the whole script? Seems as if Bitmap isn't declared..

  3. #3
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Simba Code:
    procedure CastSpell;
    var
      a, b, i, x, y, Bitmap: Integer;
    begin
      R_FindRandoms;
      Bitmap := BitmapFromString(14, 7, 'meJw9kDEKwkAQRdmNJrFIbpBecPE' +
               'MizewtRAsUnsAsbH1CKmtrdNYpYq9jYXYKEFE1EZZEN86IAzhzf9/' +
               'Z2ej41ynpR5tqUD1I1sHswvV0pZKehuUaPXUcQ6TgVFUZ44Ch92DV' +
               'hktR+Ss13/gk6bACseLwe7uLZXJhPbwBjAfMamaf5Ka7q+EuQsLwJ' +
               'JlAPP64PplGGJreH08Sxhgjr/UFHxJOucIyFtwadPTmyQgy5CUZcS' +
               'dLB+0AK0k/eSq4Tn8li8k64Ze');
      for i := 1 to 3 do
        begin
          if GetCurrentTab <> tab_Magic then
            GameTab(tab_Magic);
          if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
            Mouse(x, y, 2, 2, true);
          FreeBitmap(Bitmap);
          while (GetCurrentTab <> tab_Inv) and (a <= 3) do
            begin
              wait(300);
              a := i + 1;
            end;
          R_FindRandoms;
          MouseItem(i, true);
          while (GetCurrentTab <> tab_Magic) and (b <= 3) do
            begin
              wait(500 + random(500));
              b := b + 1;
            end;
          AntiBan;
        end;
    end;

  4. #4
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    pascal Code:
    procedure CastSpell;
    var
      a, b, i, x, y, Bitmap: Integer;
    begin
      R_FindRandoms;
      Bitmap := BitmapFromString(14, 7, 'meJw9kDEKwkAQRdmNJrFIbpBecPE' +
               'MizewtRAsUnsAsbH1CKmtrdNYpYq9jYXYKEFE1EZZEN86IAzhzf9/' +
               'Z2ej41ynpR5tqUD1I1sHswvV0pZKehuUaPXUcQ6TgVFUZ44Ch92DV' +
               'hktR+Ss13/gk6bACseLwe7uLZXJhPbwBjAfMamaf5Ka7q+EuQsLwJ' +
               'JlAPP64PplGGJreH08Sxhgjr/UFHxJOucIyFtwadPTmyQgy5CUZcS' +
               'dLB+0AK0k/eSq4Tn8li8k64Ze');
      for i := 1 to 3 do
        begin
          if GetCurrentTab <> tab_Magic then
            GameTab(tab_Magic);
          if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
            Mouse(x, y, 2, 2, true);
          //FreeBitmap(Bitmap); You have to put this outside the loop.
          while (GetCurrentTab <> tab_Inv) and (a <= 3) do
            begin
              wait(300);
              a := i + 1;
            end;
          R_FindRandoms;
          MouseItem(i, true);
          while (GetCurrentTab <> tab_Magic) and (b <= 3) do
            begin
              wait(500 + random(500));
              b := b + 1;
            end;
          AntiBan;
        end;
        FreeBitmap(Bitmap);
    end;

    Or just have a..

    pascal Code:
    procedure ScriptTerminate;
    begin
      FreeBitmap(Bitmap);
    end;

    etc. etc.

  5. #5
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    I tried it putting outside the loop as well and tried without freeing it as well, but it still didn't work

  6. #6
    Join Date
    Sep 2008
    Location
    Chicago
    Posts
    224
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by kongking View Post
    I tried it putting outside the loop as well and tried without freeing it as well, but it still didn't work
    If that didn't work then I have no idea how to fix it. You could try making the bitmap global instead of declaring it every time you call that function.

  7. #7
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    And you should still post the whole script rather than just one procedure.

  8. #8
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Still giving me the same error.

    Edit: here's the script:

    Simba Code:
    {$DEFINE SMART}
    {$i srl\srl.scar}
    {$i reflection\reflection.simba}

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      with Players[0] do
      begin
        Name    := '';
        Pass    := '';
        Nick    := '';
        Active  := true;
        Pin     := '';
        BoxRewards := ['XP', 'ostume', 'mote', 'Gem', 'ithril', 'oal'];
        Integers[0] := 333;
      end;
    end;

    procedure AntiBan;
    begin
      case random(1001) of
        0..40: BoredHuman;
        41..80: PickUpMouse;
        81..120: HoverSkill('Smithing', false);
        121..160: HoverSkill('Magic', false);
        161..200: RandomMovement;
        201..220: MakeCompass('random');
        220..240: RandomRClick;
      end;
    end;

    procedure WithdrawOres;
    begin
      if not BankScreen then
        R_OpenBankBooth('vwb');
      if PinScreen then
        InPin(Players[0].Pin);
      if BankScreen then
        begin
          Withdraw(3, 0, 3);        //bank slot 4
          wait(365 + random(210));
          Withdraw(2, 0, 0);
          wait(132 + random(52));   //bank slot 3
        end;
      CloseBank;
      wait(50 + random(300));
    end;

    procedure CastSpell;
    var
      a, b, i, x, y, Bitmap: Integer;
    begin
      R_FindRandoms;
      Bitmap := BitmapFromString(14, 7, 'meJw9kDEKwkAQRdmNJrFIbpBecPE' +
               'MizewtRAsUnsAsbH1CKmtrdNYpYq9jYXYKEFE1EZZEN86IAzhzf9/' +
               'Z2ej41ynpR5tqUD1I1sHswvV0pZKehuUaPXUcQ6TgVFUZ44Ch92DV' +
               'hktR+Ss13/gk6bACseLwe7uLZXJhPbwBjAfMamaf5Ka7q+EuQsLwJ' +
               'JlAPP64PplGGJreH08Sxhgjr/UFHxJOucIyFtwadPTmyQgy5CUZcS' +
               'dLB+0AK0k/eSq4Tn8li8k64Ze');
      for i := 1 to 3 do
        begin
          if GetCurrentTab <> tab_Magic then
            GameTab(tab_Magic);
          if FindBitmapToleranceIn(Bitmap, x, y, MIX1, MIY1, MIX2, MIY2, 30) then
            Mouse(x, y, 2, 2, true);
          FreeBitmap(Bitmap);
          while (GetCurrentTab <> tab_Inv) and (a <= 3) do
            begin
              wait(300);
              a := i + 1;
            end;
          R_FindRandoms;
          MouseItem(i, true);
          while (GetCurrentTab <> tab_Magic) and (b <= 3) do
            begin
              wait(500 + random(500));
              b := b + 1;
            end;
          AntiBan;
        end;
    end;

    procedure BankOres;
    begin
      if not BankScreen then
        R_OpenBankBooth('vwb');
      if PinScreen then
        InPin(Players[0].Pin);
      if BankScreen then
        Deposit(1, 3, true);
    end;

    procedure MainLoop;
    var
      loads: Integer;
    begin
      repeat
        WithdrawOres;
        CastSpell;
        BankOres;
        loads := loads + 1;
        ClearDebug;
        writeln('Running for: ' + TimeRunning);
        writeln('Loads done: ' + IntToStr(loads));
        writeln('Smithing exp: ' + ToStr(112.5 * loads));
        writeln('Magic exp: ' + IntToStr(159 * loads));
      until(loads = Players[0].Integers[0]);
    end;

    begin
      Smart_Members := false;
      Smart_Server := 123;
      Smart_Signed := true;
      Smart_SuperDetail := false;
      SetupSRL;
      DeclarePlayers;
      LogInPlayer;
      MainLoop;
      Logout;
    end.

  9. #9
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I would make the bitmap global and take the freeing out of the function and donut externally, that should fix your problem

    I think what happens the script loads the bitmap but it gets freed before getting used



  10. #10
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Already tried it making a global variable, but it still gives me the same error.

  11. #11
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I haven't got access to a computer with simba, i will have a better look when i get home



  12. #12
    Join Date
    Mar 2007
    Posts
    1,700
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    When I = 1, you call FindBitmapTol, then 2 lines later, you free the bitmap. When I = 2, you call FindBitmapTol, and are returned an exception because you have no bitmap to search for.

  13. #13
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    ^ This solved my problem. I just put the bitmap in the loop.

  14. #14
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    I was trying to explain what lordsaturn said, wouldn't putting the bitmap in the loop be the same as declaring it over and over again, just free the bitmap on result or when the function fails



  15. #15
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by kongking View Post
    ^ This solved my problem. I just put the bitmap in the loop.
    Quote Originally Posted by lordsaturn View Post
    When I = 1, you call FindBitmapTol, then 2 lines later, you free the bitmap. When I = 2, you call FindBitmapTol, and are returned an exception because you have no bitmap to search for.
    Doing what I said would fix the problem, too..? >_>

  16. #16
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    lol, i think you all were trying to say the same thing to me, and i only realised it after hearing it like 5 times.

  17. #17
    Join Date
    Nov 2010
    Location
    Australia
    Posts
    1,472
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Does anyone know how to start a script from within a script and close an opened script from within a script?(Didn't want to open a new thread just for this)

  18. #18
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Well, you could look at how MSI works. Recently they've been working on something similar to this. But in short, no. Not without modifications, I don't think.

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
  •