SRL Archive - SRL Suggestions

FindBoxOption; fix


NCDS

2010-09-27 22:05:11

New updated version:

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.

TRiLeZ

2010-09-28 23:16:09

Committed. Good work. :)

rockseller

2011-02-12 10:19:30

Hi!, Where can i insert this code into? I'm a bit lost, but also having the mystery box problem =(. Thanks in advance!

**BANNED The Man

2011-02-12 10:30:45

From: rockseller
Hi!, Where can i insert this code into? I'm a bit lost, but also having the mystery box problem =(. Thanks in advance!


What exact problem is that?

-Boom

Train

2011-02-12 20:16:04

From: rockseller
Hi!, Where can i insert this code into? I'm a bit lost, but also having the mystery box problem =(. Thanks in advance!

It automatically updates to the new version when you open simba, don't worry about it.

Frement

2011-02-12 20:19:19

From: Train
It automatically updates to the new version when you open simba, don't worry about it.


Thats if he has set it to automatically update SRL.

Train

2011-02-12 20:20:24

From: Frement
Thats if he has set it to automatically update SRL.


Regardless, this code is useless. Plus he should already have it or a more up to date version [09-28-2010].

YoHoJo

2011-02-12 20:20:46

Good Work! Thank you.

Frement

2011-02-12 20:24:21

From: YoHoJo
Good Work! Thank you.


Back in action? :) Haven't seen you around a lot lately.

YoHoJo

2011-02-12 20:38:35

From: Frement
Back in action? :) Haven't seen you around a lot lately.


Wipe that smirk off your face before I ban you!
Yeah I've been lurking around quite a bit recently.

Frement

2011-02-12 21:18:15

From: YoHoJo
Wipe that smirk off your face before I ban you!
Yeah I've been lurking around quite a bit recently.


Haha, yeah, I believe you. Good to have you back in the game ;)