Cage
2013-09-30 08:27:23
Hello! I am trying to get my script to click on the shop owner and trade her, then to proceed to selling her my items. I need help finding a way to know whether I have successfully traded her (i.e. on shop screen) or I have missed her and in that case trying again. This is what I have so far…. It still loops even when I think I have found the shop screen. (used a colour on the shop screen - any better ways would be appreciated) Anyway, here is my code.
procedure FindShopOwnerFinal;
Var TPA : TPointArray;
tmpCTS, I, X, Y, Found:Integer;
ATPA : T2DPointArray;
begin
repeat
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.04, 0.37);
FindColorsTolerance(TPA, 1520706, MSX1, MSY1, MSX2, MSY2, 7);
SetColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
ATPA := TPAToATPAEx(TPA, 20, 20);
DebugATPA(ATPA, ' ');
SortATPASize(ATPA, True);
FindNormalRandoms();
For I := 0 To High(ATPA) Do //Loops through until it finds it
If GetArraylength(ATPA[i]) > 10 Then
begin //Similar to 'length'
MiddleTPAEx(ATPA[i], X, Y); //Finds the middle via averaging
MMouse(X, Y, 3, 3);
sleep(50 + random(200));
WriteLn(GetUpText);
if waituptext('Talk', 300) then
begin
sleep(300 + random(200));
clickmouse2(mouse_right);
sleep(300 + random(200));
chooseoption('Trade');
sleep(8000 + random(3000));
if FindColorTolerance(x,y,1692278,MSX1,MSY1,MSX2,MSY2,10) then
WriteLn('Color Found ');
break;
end else
FindShopOwnerFinal;
end;
until (False);
FindTheESSDTM;
end;