SRL Archive - General

NCDS capnarnav solver in MSI


Sir R. M8gic1an

2010-10-15 11:21:55


// /Alpha/capnarnav.simba

{$IFDEF NCDS_ARNAV}

TeleRandoms[14].SolveRandom := @NCDS_SolveArnav;

//-----------------------------------------------------------------//
//-- MSI --//
//-- � Cap'n Arnav Solver Routines --//
//-----------------------------------------------------------------//
// * function NCDS_arnav_FixLock: Boolean; // * by Nielsie95, NCDS
// * function NCDS_SolveArnav: Boolean; // * by Nielsie95, NCDS
//-----------------------------------------------------------------//




{*******************************************************************************
function NCDS_arnav_FixLock: Boolean;
by: Nielsie95
Description: Moves the required items into line.
*******************************************************************************}

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('Arnav Target Text Color Count: ' + 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, 1204356, b.x1, b.y1, b.x2, b.y2, 20);
if (Length(tpa) > 500) 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
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;
{*******************************************************************************
function NCD_SolveArnav: Boolean;
by: Nielsie95, NCDS
Description: Solves the Cap'n Arnav random.
*******************************************************************************}

function SolveArnav: Boolean;
var
deg, cts, x, t: Integer;
begin
Result := False;
if (not arnav_InRandom) then
begin
WriteLn('Not in Arnav!');
Exit;
end;

cts := GetColorToleranceSpeed;
deg := Round(rs_GetCompassAngleDegrees);
MakeCompass('n');
t := GetSystemTime;

SetAngle(True);
while ((GetSystemTime - t) < 40000) and (not arnav_LockScreen) do
begin
Wait(1500);
if AreTalking then
begin
if FindNPCChatText('hop through', ClickLeft) then
begin
arnav_ExitPortal;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
Exit;
end;
if (not ClickContinue(True,True)) then
FindNPCChatText('ready to try', ClickLeft);
end
else
arnav_TalkToCapnArnav;
end;

if (not NCDS_arnav_FixLock) then
begin
WriteLn('Could not identify arnav objects!');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
Exit;
end;

Mouse(405, 245, 70, 20, True);
x := GetSystemTime;
while arnav_LockScreen and ((GetSystemTime - x) < 5000) do Wait(100);

if arnav_LockScreen then
begin
MouseFlag(MMCX, MMCY - 10, 5, 5, 0);
Wait(1000 + Random(1000));
end;

t := GetSystemTime;
while arnav_InRandom and ((GetSystemTime - t) < 30000) do
begin
Wait(100);
if InConvo then
ClickContinue(True,True)
else
arnav_ExitPortal;
end;

Result := (not arnav_InRandom);
if (not Result) then
begin
arnav_ExitPortal;
Result := (not arnav_InRandom);
end;

arnav_ExitPortal;
MakeCompass(Deg);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
end;

{$ENDIF}

This is how it could be included in MSI. You could even add MSI's debugging and tracking into it. Up to you if you wanna do it.

~RM

Naike

2010-10-15 11:32:50

Why would you add a random solver for this project? :cartman:

Sir R. M8gic1an

2010-10-15 12:16:16

To test the new functions, if it doesn't get added straight to SRL.

Many things in the past didn't get added because they weren't tested enough. Here's a nice way to test it.

~RM

Naum

2010-10-15 12:38:45

From: Sir R. Magician
To test the new functions, if it doesn't get added straight to SRL.

Many things in the past didn't get added because they weren't tested enough. Here's a nice way to test it.

~RM


I second that!
I would've tested it, but there were no accounts in that random. Actually.. MSI could be pretty useful in helping with random development/testing.. come to think of it

Coh3n

2010-10-15 18:48:35

From: Naum
I second that!
I would've tested it, but there were no accounts in that random. Actually.. MSI could be pretty useful in helping with random development/testing.. come to think of it

That's what RM has been saying for a while. :p

Also one of the main points to MSI Extras and defines. :)

Naum

2010-10-15 18:51:15

From: Coh3n
That's what RM has been saying for a while. :p

Also one of the main points to MSI Extras and defines. :)


Yeah I hardly check MSI anymore :/.
Sorry 'bout that.

Coh3n

2010-10-15 18:58:33

From: Naum
Yeah I hardly check MSI anymore :/.
Sorry 'bout that.

No problem, just letting you know. :)