SRL Archive - SRL Suggestions

Cap'n Arnav updates


NCDS

2010-10-11 20:05:17

Just needed to update the colors and Length() checks in FixLock. Once I did that it worked great.

Updated FixLock:

function arnav_FixLock: Boolean;
var
t, Target, r, c: Integer;
tpa: TPointArray;
b: TBox;
Col: array[0..2] of Boolean;
begin
ColorToleranceSpeed(2);
Result := False;
if (not arnav_LockScreen) then
Exit;
t := GetSystemTime;

FindColorsTolerance(tpa, 0, 7, 150, 80, 185, 1);
WriteLn(inttostr(Length(tpa)));

case Length(tpa) of
116: Target := 0;//'ring';
84: Target := 1;//'bar';
108: Target := 2;//'bowl';
102: Target := 3;//'coins'; 4.
else
begin
WriteLn('Could not get Arnav target!');
Exit;
end;
end;

while (not Result) and ((GetSystemTime - t) < 30000) and arnav_LockScreen do
begin
for c := 0 to 2 do
begin
if Col[c] then
Continue;
for r := 0 to 2 do
begin
b := IntToBox(91 + (88 * c), 45 + (88 * r), 166 + (88 * c), 112 + (88 * r));
SetColorSpeed2Modifiers(0.02, 0.22);
FindColorsTolerance(tpa, 803162, b.x1, b.y1, b.x2, b.y2, 20);
if (Length(tpa) > 400) then
begin
arnav_ClickArrow(c, Target - r);
Col[c] := True;
Break;
end;
SetColorSpeed2Modifiers(0.02, 0.05);
FindColorsTolerance(tpa, 2281971, b.x1, b.y1, b.x2, b.y2, 20);
if (Length(tpa) > 400) then
begin
arnav_ClickArrow(c, Target - r - 1);

Col[c] := True;
Break;
end;
end;
end;
Result := Col[0] and Col[1] and Col[2];
Wait(60);
end;
end;

Has only been tested once (successfully), but I don't see what it could break..

Wyn

2010-10-15 10:55:50

I'll see if I can get it tonight to test also.

NCDS

2010-10-20 17:51:48

Tested again successfully, it doesn't have much for output :/


Compiled succesfully in 608 ms.
SRL Compiled in 16 msec
Arnav Target Text Color Count: 102
Successfully executed.

Tested with:

program new;
{.include SRL/SRL.scar}


begin
SetupSRL;
ActivateClient;
if Arnav_InRandom then
SolveArnav;
end.

Naum

2010-10-20 17:56:54

Post up a diff and I'll apply the patch :)

NCDS

2010-10-20 18:12:54


Index: capnarnav.scar
===================================================================
--- capnarnav.scar (revision 640)
+++ capnarnav.scar (working copy)
@@ -107,16 +107,16 @@
begin
b := IntToBox(91 + (88 * c), 45 + (88 * r), 166 + (88 * c), 112 + (88 * r));
SetColorSpeed2Modifiers(0.02, 0.22);
- FindColorsTolerance(tpa, 1204356, b.x1, b.y1, b.x2, b.y2, 20);
- if (Length(tpa) > 500) then
+ FindColorsTolerance(tpa, 803162, b.x1, b.y1, b.x2, b.y2, 20);
+ if (Length(tpa) > 400) then
begin
arnav_ClickArrow(c, Target - r);
Col[c] := True;
Break;
end;
SetColorSpeed2Modifiers(0.02, 0.05);
- FindColorsTolerance(tpa, 2916754, b.x1, b.y1, b.x2, b.y2, 20);
- if (Length(tpa) > 500) then
+ FindColorsTolerance(tpa, 2281971, b.x1, b.y1, b.x2, b.y2, 20);
+ if (Length(tpa) > 400) then
begin
arnav_ClickArrow(c, Target - r - 1);
There's the patch. :)

Naum

2010-10-20 18:16:12

Cool beans.
I'll give it a once-over and commit it first thing tomorrow, unless another Dev commits it before then.
Night.

NCDS

2010-10-20 18:17:17

From: Naum
Cool beans.
I'll give it a once-over and commit it first thing tomorrow, unless another Dev commits it before then.
Night.


Appreciate it, have a good night.

Naum

2010-10-21 14:02:34

Committed.