Bixby Sayz
2014-01-29 20:59:08
findDTMs returns multiple duplicate points as well as a number of duplicate points that are just slightly off.
If you want to see this for yourself place Infernal Ashes in your backpack (do not place in quick inventory slots) and run this script. I've created a dtm with an overkill of points just to prove there should only be one (and only one match).
There *should* be one match. Running the script with Infernal Ashes in the 3rd backpack slot I get:
If you want to see this for yourself place Infernal Ashes in your backpack (do not place in quick inventory slots) and run this script. I've created a dtm with an overkill of points just to prove there should only be one (and only one match).
program new;
{$DEFINE SMART}
{$I SRL-6\SRL.simba}
var
AshesMdtm: TMDTM; // Ashes dtm stored in a tmdtm record.
AshesDtm: Integer; // Ashes dtm.
DtmPositions: TPointArray; // All positions of dtm found.
HiPositions: Integer; // Size of positions array.
PositionIdx: Integer; // Loop counter - current dtm position.
Width, Height: Integer; // Client width and height.
ClientArea: TBox; // Client area.
begin
clearDebug();
setupSRL();
// Create infernal ashes dtm.
AshesMdtm.init();
AshesMdtm.addPoint(CreateDtmPoint(18, 0, 526610, 0, 1, False));
AshesMdtm.addPoint(CreateDtmPoint(0, 4, 131072, 1, 1, False));
AshesMdtm.addPoint(CreateDtmPoint(7, 9, 131072, 1, 1, False));
AshesMdtm.addPoint(CreateDtmPoint(16, 4, 131072, 1, 1, False));
AshesMdtm.addPoint(CreateDtmPoint(6, 0, 131072, 1, 1, False));
AshesMdtm.addPoint(CreateDtmPoint(21, 0, 131072, 1, 1, False));
AshesMdtm.addPoint(CreateDtmPoint(15, 0, 131072, 1, 1, False));
AshesDtm := AddDtm(AshesMdtm);
setDtmName(AshesDtm, 'Infernal Ashes');
// Find all occurances of dtm on client.
getClientDimensions(Width, Height);
ClientArea := IntToBox(0, 0, (Width - 1), (Height - 1));
findDtms(AshesDtm, DtmPositions, ClientArea);
HiPositions := High(DtmPositions);
WriteLn(IntToStr(HiPositions + 1) + ' Dtms found.');
if (HiPositions = (-1)) then
Exit;
// Print out dtm positions.
for PositionIdx := 0 to HiPositions do
with DtmPositions[PositionIdx] do
WriteLn(Format('%d) (%d,%d).', [PositionIdx, X, Y]));
// Free dtm.
freeDtm(AshesDtm);
end. // main.
There *should* be one match. Running the script with Infernal Ashes in the 3rd backpack slot I get:
11 Dtms found.
0) (694,340).
1) (695,340).
2) (696,340).
3) (697,340).
4) (694,341).
5) (695,341).
6) (696,341).
7) (694,342).
8) (695,342).
9) (696,342).
10) (697,342).