NCDS
2010-09-27 22:05:11
New updated version:
I just updated the color for the 'Scroll' boolean and the colors for the 'Col' variable and everything works like a charm :)
Successful debug:
Again, thank you Squancy for the account :)
Edit: Tested 3 times now on different worlds/accounts, all successful.
function FindBoxOption(var Box: TBox; var RewardInd: Integer): Boolean;
var
x, y, H, L, II, i, LL, Col: Integer;
Text, TPA, xTPA: TPointArray;
ATPA: T2DPointArray;
Scroll: Boolean;
P: TPoint;
begin
Result := False;
RewardInd := -1;
Box := IntToBox(-1, -1, -1, -1);
if (not LoggedIn) then exit;
L := High(Players[CurrentPlayer].BoxRewards);
Scroll := (GetColor(385, 70) = 592137); //657930
for II := 0 to L + 1 do
begin
if (InIntArray(RB_SkipArray, II)) then Continue;
if (II < L + 1) then
Text := LoadTextTPA(Players[CurrentPlayer].BoxRewards[II], UpChars, H)
else
Text := LoadTextTPA('box', UpChars, H);
FindColorsTolerance(TPA, 2070783, 35, 69, 362, 311, 3);
ATPA := SplitTPAEx(TPA, 3, 1);
LL := High(ATPA);
for i := 0 to LL do
begin
Result := FindTextTPAInTPA(H, Text, ATPA[i], xTPA);
if (Result) then Break;
end;
if (not Result) and (Scroll) then
begin
X := 377;
Y := 312 - II mod 2 * 245;
Col := 592137 + II mod 2 * 5005417;
P := Point(375, 302 - II mod 2 * 224);
MMouse(X, Y, 0, 0);
Wait(RandomRange(30, 60));
HoldMouse(X, y, mouseaction(True));
while (GetColor(P.X, P.Y) <> Col) and (GetColor(385, 70) = 592137) and (not(Result)) do
begin
if (not LoggedIn) then Break;
FindColorsTolerance(TPA, 2070783, 35, 69, 362, 311, 3);
Result := FindTextTPAInTPA(H, Text, TPA, xTPA);
Wait(RandomRange(40, 50));
end;
ReleaseMouse(X, Y, mouseaction(True));
end;
if (Result) then
begin
if (II < L + 1) then
WriteLn('Found Reward Item: ' + Players[CurrentPlayer].BoxRewards[II])
else
WriteLn('Found no prefered reward items, chose default reward: Mystery Box');
Break;
end;
end;
if (not Result) then exit;
Box := GetTPABounds(xTPA);
Rewardind := II;
//Writeln('Box: ' + IntToStr(Box.x1) + ', ' + IntToStr(Box.y1) + ', ' + IntToStr(Box.x2) + ', ' + IntToStr(Box.y2));
end;
I just updated the color for the 'Scroll' boolean and the colors for the 'Col' variable and everything works like a charm :)
Successful debug:
Using box.
Found Reward Item: XP
******** SOLVED LAMP RANDOM ********
Again, thank you Squancy for the account :)
Edit: Tested 3 times now on different worlds/accounts, all successful.