SRL Archive - FAQ

Help with understanding error


Recursive

2012-05-10 19:54:23

K so whenever I run this script, it will run fine then after like 20 secs, it stops and shows me this:

Successfully executed.
The following DTMs were not freed: [2]
The following bitmaps were not freed: [3]

I am trying to understand how this information it shows helps. What do the numbers mean? I understand where the DTMs and BITMAPS mean but what do the numbers beside them represent?

Also is this the right way of using a bitmap obj
FindBitMapTolerancein(app, pX, pY, MIX1, MIY1, MIX2, MIY2, 45)

or this

FindBitmapToleranceIn(appex, pX, pY,   MBX1, MBY1, MBX2, MBY2, 85)


Thanks for your time

~Chig~

Le Jingle

2012-05-10 20:33:16

Pretty sure that means you're not freeing the BMP/DTM's correctly. And when they're not freed, they'll eat your memory. Not positive, just trying to help

CephaXz

2012-05-10 20:36:35

Make procedures that starts and free your BMP/DTMs. Just put AddOnTerminate('FREEDTM'); before your main loop. That's what I did.

Recursive

2012-05-10 20:39:48

I see, but also the last 2 lines I posted, Does it matter if I use MBX1 or MCX1 or MIX1?

CephaXz

2012-05-10 20:43:10

Just use MBX1 / MIX1.

MB search in bank, MI search in inventory.

Recursive

2012-05-10 21:01:22

Thank you soo much for clarifying that! Are there others for searching in magic tab or equipment tab or will MB do for those?

CephaXz

2012-05-10 21:03:24

That is what MI does, not MB. There is tab functions where you can change between tabs, then you can start searching for equipment or magic spells.

Recursive

2012-05-10 21:04:47

Sorry I meant to write MI, but thanks again for providing your 2 cents to this. Really appreciate

Le Jingle

2012-05-10 21:11:02


Procedure ClickSpell;
Var
lx, ly, DTMname : Integer;
Begin
GameTab(Tab_Magic);
DTMname := DTMFromString('w/e DTM string goes here');
If FindDTM(DTMname, lx, ly, MIX1, MIY1, MIX2, MIY2) Then
MMouse(lx, ly, 5, 5);
ClickMouse2(Mouse_Left);
FreeDTM(DTMname);
End;

E: Hope this helps! :>

Abu

2012-05-11 02:28:24

Well I see a few things have been left unanswered so…

Basically, whenever you load a bitmap or DTM it takes up memory, so you should free them to take away that memory. Why? Because if you don't it will slow down the performance of your script.

You can free them using FreeDTM(TheDTM) or FreeBitmap(TheBitmap). The number that comes after them is the number used to represent the DTM or Bitmap that hasn't been freed.

To replace these numbers with names you can do:

{SetDTMName}
procedure SetDTMName(DTM : integer;const name : string);
// Replace DTM with your DTM and name with what you want to call it

{SetBitmapName}
procedure SetBitmapName(Bmp : integer; name : string);
// Replace Bmp with your Bitmap and name with what you want to call it