Brandon
2012-02-16 16:14:57
Remove Objects from ATPA/TPA..
I have two functions that are very similar but yet so different. The Original one just finds the crimson charms and items flawlessly except!! when some guy comes walking around with an HP cape on or whatever skill cape matches the colour.. The problem is that not only does it find the crimson charm but I had to make the tolerance higher due to the fact that sometimes the crimson charm is actually full on BROWN. Yes.. The same brown as the tables in mobilizing armies.
Now I modified the original pickup items and created the second one where it should scan the screen for items and if the uptext doesn't match, remove that point from the tpa/atpa. It's very tedious and slow AND it doesn't always work.. for example lets say it does scan for the crimson charm and it does find it, when it moves the mouse to get the uptext, sometimes if the mouse is at the very edge of the item, it won't get the uptext at all. 1 pixel off makes a difference. Sometimes it removes the points on the charm itself:fiery:
Soooo How can I remove Objects/things I don't want from my item finding.. I managed to do it for monsters aka finding which ones can be fought.. but items :confused::confused:
I have two functions that are very similar but yet so different. The Original one just finds the crimson charms and items flawlessly except!! when some guy comes walking around with an HP cape on or whatever skill cape matches the colour.. The problem is that not only does it find the crimson charm but I had to make the tolerance higher due to the fact that sometimes the crimson charm is actually full on BROWN. Yes.. The same brown as the tables in mobilizing armies.
Now I modified the original pickup items and created the second one where it should scan the screen for items and if the uptext doesn't match, remove that point from the tpa/atpa. It's very tedious and slow AND it doesn't always work.. for example lets say it does scan for the crimson charm and it does find it, when it moves the mouse to get the uptext, sometimes if the mouse is at the very edge of the item, it won't get the uptext at all. 1 pixel off makes a difference. Sometimes it removes the points on the charm itself:fiery:
Soooo How can I remove Objects/things I don't want from my item finding.. I managed to do it for monsters aka finding which ones can be fought.. but items :confused::confused:
Procedure PickUpItemsOrig(ItemList: TStringArray);
var
Items, TPA: TPointArray;
ATPA: T2DPointArray;
Item: TPoint;
ItemArray: Array of ItemPickup;
I, CTS: Integer;
MeBox: TBox;
begin
MeBox:= IntToBox(MSCX - 50, MSCY - 50, MSCX + 50, MSCY + 50);
SetLength(ItemArray, Length(ItemList) + 1);
For I:= 0 To High(ItemList) do
Case lowercase(ItemList[I]) of
'noted', 'Noted', 'oted':
begin
ItemArray[I].Color := 8767731;
ItemArray[I].Speed := [0.64, 1.34];
ItemArray[I].Tolerance := 10;
end;
'bones', 'bone':
begin
ItemArray[I].Color := 13423589;
ItemArray[I].Speed := [0.39, 2.16];
ItemArray[I].Tolerance := 11;
end;
'bluecharm', 'lue charm', 'bluecharms':
begin
ItemArray[I].Color := 10725730;
ItemArray[I].Speed := [0.11, 0.44];
ItemArray[I].Tolerance := 22;
end;
'crimson', 'rimson charm', 'crimsoncharms', 'rimson':
begin
ItemArray[I].Color := 4674682;
ItemArray[I].Speed := [0.38, 1.34];
ItemArray[I].Tolerance := 12;
end;
'coins', 'gold', 'gp', 'Coins':
begin
ItemArray[I].Color := 4641005;
ItemArray[I].Speed := [0.29, 3.33];
ItemArray[I].Tolerance := 5;
end;
end;
Items:= GetMMDotsOnMS('item');
if (Length(Items) > 0) then
begin
Item:= MMToMS(Items[0]);
if (Not FightWaterfiends(MeBox)) then
begin
For I:= 0 To High(ItemArray) - 1 do
begin
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(ItemArray[I].Speed[0], ItemArray[I].Speed[1]);
FindColorsTolerance(TPA, ItemArray[I].Color, MeBox.X1, MeBox.Y1, MeBox.X2, MeBox.Y2, ItemArray[I].Tolerance);
ATPA:= TPAToATPAEx(TPA, 10, 10);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
if (Length(ATPA) < 1) then
exit;
SortATPAFrom(ATPA, Item);
MiddleTPAEx(ATPA[0], Item.X, Item.Y);
MMouse(Item.X, Item.Y, 0, 0);
wait(200);
if (isUptextMultiCustom(ItemList) or IsUptextMultiCustom(['ake', 'nteract', 'ttack'])) then
begin
ClickMouse2(False);
WaitOptionMulti(ItemList, 300);
wait(200);
while isMoving do
wait(1);
end;
end;
end;
end;
end;
Procedure PickUpItems(ItemList: TStringArray);
var
Items, TPA: TPointArray;
ATPA: T2DPointArray;
Item: TPoint;
ItemArray: Array of ItemPickup;
I, J, CTS: Integer;
MeBox: TBox;
begin
MeBox:= IntToBox(MSCX - 50, MSCY - 50, MSCX + 50, MSCY + 50);
SetLength(ItemArray, Length(ItemList) + 1);
For I:= 0 To High(ItemList) do
Case lowercase(ItemList[I]) of
'noted', 'Noted', 'oted':
begin
ItemArray[I].Color := 8767731;
ItemArray[I].Speed := [0.64, 1.34];
ItemArray[I].Tolerance := 10;
end;
'bones', 'bone':
begin
ItemArray[I].Color := 13423589;
ItemArray[I].Speed := [0.39, 2.16];
ItemArray[I].Tolerance := 11;
end;
'bluecharm', 'lue charm', 'bluecharms':
begin
ItemArray[I].Color := 10725730;
ItemArray[I].Speed := [0.11, 0.44];
ItemArray[I].Tolerance := 22;
end;
'crimson', 'rimson charm', 'crimsoncharms', 'rimson':
begin
ItemArray[I].Color := 4674682;
ItemArray[I].Speed := [0.38, 1.34];
ItemArray[I].Tolerance := 12;
end;
'coins', 'gold', 'gp', 'Coins':
begin
ItemArray[I].Color := 4641005;
ItemArray[I].Speed := [0.29, 3.33];
ItemArray[I].Tolerance := 5;
end;
end;
Items:= GetMMDotsOnMS('item');
if (Length(Items) > 0) then
begin
Item:= MMToMS(Items[0]);
if (Not FightWaterfiends(MeBox)) then
begin
For I:= 0 To High(ItemArray) - 1 do
begin
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(ItemArray[I].Speed[0], ItemArray[I].Speed[1]);
FindColorsTolerance(TPA, ItemArray[I].Color, MeBox.X1, MeBox.Y1, MeBox.X2, MeBox.Y2, ItemArray[I].Tolerance);
ATPA:= TPAToATPAEx(TPA, 10, 10);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
if (Length(ATPA) < 1) then
exit;
For J:= 0 To High(ATPA[I]) do
begin
if (WaitUptextMulti(ItemList, 600)) then
break;
try
MMouse(ATPA[J][I].X, ATPA[J][I].Y, 0, 0);
except
break;
end;
if (Not (WaitUptextMulti(ItemList, 300))) then
try
DeleteValueInTPA(ATPA[J], I);
except
break;
end;
end;
//SortATPAFrom(ATPA, Item);
//MiddleTPAEx(ATPA[0], Item.X, Item.Y);
GetMousePos(Item.X, Item.Y);
MMouse(Item.X, Item.Y, 0, 0);
wait(200);
if (isUptextMultiCustom(ItemList) or IsUptextMultiCustom(['ake', 'nteract', 'ttack'])) then
begin
ClickMouse2(False);
WaitOptionMulti(ItemList, 300);
wait(200);
while isMoving do
wait(1);
end;
end;
end;
end;
end;