Results 1 to 13 of 13

Thread: Won't free my dtms

  1. #1
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Unhappy Won't free my dtms

    ERROR:
    Error: Exception: The given DTM Index[2] doesn't exist at line 72
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 3]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

    Simba Code:
    program GlowHerblore;
     {$i srl/srl/misc/smart.scar}
     {$i SRL\SRL.scar}

     {
        -=-=-=- INFORMATION THIS IS MADE BY NEXPB aka NEX -=-=-=-
        - Fill in the required information.
        - Only spec restores supported atm.
      }


     const
     userName = ''; //Username here. (needed to login)
     passWord = ''; //Pass here.
     nickName = ''; //3-4 lowercase letters from your username.
     bankPin = ''; //Bankpin here.
     makeAmountPots = 1000;// Amount pots need to be made (Always put an amount)
     makePot = 'Recover_special'; // your potion here write it same like rs please. (space is "_")
     World = 69;//World you want to login.
     LampXpIn = 'Farming';//Skill you want exp in from the genie.

     var
     firstItem, secondItem, potsMade: Integer;//Don't touch this.

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

      Players[0].Name := userName;
      Players[0].Pass := passWord;
      Players[0].Nick := nickName;
      Players[0].Active := True;
      Players[0].Pin := bankPin;
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];//Random event prices.
    end;

     procedure AntiRandoms;
    begin
      FindNormalRandoms;
      LampSkill := (LampXpIn);
      LevelUp;
    end;

     procedure StartUpClient;
    begin
      Smart_Server := World;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;

      SetupSRL;
      DeclarePlayers;
      ActivateClient;
      if not LoggedIn then
      LoginPlayer;
    end;

     procedure GetDTMs(potion: String);
     begin
      Case (Lowercase(potion)) of
      'recover_special':
       begin
        firstItem := DTMFromString('mrAAAAHic42BgYPBjYmAIBuIwIA4H4gAgdgViDyD2AuJTjAwMe4D4GBCfA+KLQHwGiI8A8U4gnuFYCTSFCQ/GDxgJYBgAABIICjI=');//super energy
        secondItem := DTMFromString('mggAAAHicY2NgYKhgYmBoAOJyIC4A4iIgrgPiI4wMDKeB+BwQnwTifUC8F4gnLhEF6mLCgrEDRhwYAgBiYwjj');//Papaya
       end;
      end;
     end;

     procedure FreeDTMs;
     begin
      FreeDTM(firstItem);
      FreeDTM(secondItem);
     end;

     procedure WithDrawFromBank(dtm: Integer; amount: String);
     var
     x, y: Integer;

     begin
      if not BankScreen then exit;
      if (FindDTM(dtm, x, y, MSX1, MSY1, MSX2, MSY2)) then
      begin
      Mouse(x, y, 4, 4, false);
      ChooseOption(amount);
      end else
        begin
          Mouse(x, y, 4, 4, false);
          ChooseOption('ithdraw-x');
          wait(600 + random(200));
          TypeSend(amount);
        end;
        FreeDTM(dtm);
        FreeDTMs;
     end;

     procedure MakingPots;
     var
     x, y: Integer;

     begin
      writeln('Make pots.');
      if not LoggedIn then Exit;
      //while Animating(IntToBox(MSX1, MSY1, MSX2, MSY2), 2000, 1) do
      //begin
      //Wait(1000 + random(500));
      //end;
      if FindDTM(firstItem, x, y, MIX1, MIY1, MIX2, MIY2)then
      begin
        Mouse(x, y, 4, 4, false);
        Wait(450 + random(150));
        ChooseOption('Use');
        if FindDTM(secondItem, x, y, MIX1, MIY1, MIX2, MIY2) then
          begin
          MMouse(x, y, 4, 4);
          if WaitUptext('Use', 300 + random(100)) then
            begin
            MouseAction(true);
            end;
            MMouse(272, 571, 4, 4);
            if WaitUptext('Make all', 300 + random(100)) then
            MouseAction(true);
          end;
        end;
        FreeDTMs;
     end;

     procedure TakeItems;
     var
     x, y: Integer;

     begin
      writeln('bank and take items');
      if not LoggedIn then Exit;
      if not BankScreen then
      begin
        if FindObjCustom(x, y, ['chest', 'ank'], [5793394, 13158865], 5) then
        Mouse(x, y, 4, 4, false);
        wait(500 + random(200));
        ChooseOption('Use');
        wait(500 + random(200));
      end;
        If PinScreen then
        InPin(Players[CurrentPlayer].Pin);
        if BankScreen then
        begin
          if (not InvFull and not FindDTM(firstItem, x, y, MIX1, MIY1, MIX2, MIY2) and not FindDTM(secondItem, x, y, MIX1, MIY1, MIX2, MIY2)) then
          begin
            potsMade := (potsMade + InvCount);
            DepositAll;
            wait(900 + random(200));
            WithDrawFromBank(firstItem, '14');
            wait(900 + random(200));
            WithDrawFromBank(secondItem, '14');
          end else
          begin
            CloseBank;
          end;
        end;
       FreeDTMs;
     end;

     procedure Loop;
     var
     x, y: Integer;

     begin
      GetDTMs(makePot);
      AntiRandoms;
      if (FindDTM(firstItem, x, y, MIX1, MIY1, MIX2, MIY2) and FindDTM(secondItem, x, y, MIX1, MIY1, MIX2, MIY2)) then
      begin
        MakingPots;
      end else
      begin
        TakeItems;
      end;
     end;

    begin
      StartUpClient;
      Addonterminate('freeDTMs');
      if LoggedIn then
      repeat
      Loop;
      until (potsMade >= makeAmountPots) or not LoggedIn;
    end.
    Last edited by NexPB; 12-25-2011 at 04:52 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    in your mainloop call Addonterminate('freeDTMs'); that should always free them.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  3. #3
    Join Date
    Dec 2011
    Location
    Texas
    Posts
    348
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I also noticed you never have the option to use the bank pin.

  4. #4
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Got a new error.

  5. #5
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    2,254
    Mentioned
    21 Post(s)
    Quoted
    238 Post(s)

    Default

    What's the error?

  6. #6
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by cause View Post
    What's the error?
    Posted above in thread but here

    Error: Exception: The given DTM Index[2] doesn't exist at line 72
    The following DTMs were not freed: [SRL - Lamp bitmap, 1, 3]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

  7. #7
    Join Date
    Mar 2007
    Location
    Mars, I thought all men were from Mars.
    Posts
    513
    Mentioned
    7 Post(s)
    Quoted
    124 Post(s)

    Default

    ur problem is here

    procedure FreeDTMs;
    begin
    FreeDTM(firstItem);
    FreeDTM(secondItem);
    end;

    when you call this procedure at the current time the dtm 'firstItem' didn't exist. You have not made it yet. So find a better way to free you dtms

    maybe free it in the procdure you use the dtm in. Free it right after you use it. Declare it right b4 you need it, as well.

  8. #8
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by bud_wis_er_420 View Post
    ur problem is here

    procedure FreeDTMs;
    begin
    FreeDTM(firstItem);
    FreeDTM(secondItem);
    end;

    when you call this procedure at the current time the dtm 'firstItem' didn't exist. You have not made it yet. So find a better way to free you dtms

    maybe free it in the procdure you use the dtm in. Free it right after you use it. Declare it right b4 you need it, as well.
    I know but i can't find how to fix it.

  9. #9
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Bump. Still need help someone.

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

    Default

    Looks like your "FirstItem" DTM is either already freed or isn't set when you call your FreeDTM procedure.
    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.


  11. #11
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Kyle Undefined View Post
    Looks like your "FirstItem" DTM is either already freed or isn't set when you call your FreeDTM procedure.
    But there is nothing wrong with my method to get DTMs?

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

    Default

    Quote Originally Posted by NexPB View Post
    But there is nothing wrong with my method to get DTMs?
    Indeed there is. I'll point it out as it's not very obvious.

    A: GetDTM's is called at the beginning of the "Procedure Loop"
    B: FreeDTM's is called at the end of MakingPots.
    C: FreeDTM's is called at the end of TakeItems.


    If B gets executed, there is no DTM's to free at C. That's the problem because the way I see it, B ALWAYS gets called and will ALWAYS free the DTM's before C can even see them.

    You can either remove the call to freedtm's at B.. Or you can just free and initialize the DTM's as you go along which might be a much better approach rather than spreading them across three procedures. Reasoning: If spread that wide, if the script terminates prematurely/in-between.. the DTM's will not be freed until something else is written over that block of memory.
    I am Ggzz..
    Hackintosher

  13. #13
    Join Date
    Dec 2011
    Posts
    353
    Mentioned
    3 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by ggzz View Post
    Indeed there is. I'll point it out as it's not very obvious.

    A: GetDTM's is called at the beginning of the "Procedure Loop"
    B: FreeDTM's is called at the end of MakingPots.
    C: FreeDTM's is called at the end of TakeItems.


    If B gets executed, there is no DTM's to free at C. That's the problem because the way I see it, B ALWAYS gets called and will ALWAYS free the DTM's before C can even see them.

    You can either remove the call to freedtm's at B.. Or you can just free and initialize the DTM's as you go along which might be a much better approach rather than spreading them across three procedures. Reasoning: If spread that wide, if the script terminates prematurely/in-between.. the DTM's will not be freed until something else is written over that block of memory.
    Thanks for the helpfull post I always thought that it would recall the GetDTMs because it was at a begin from the loop.
    Going to fix it now.

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
  •