SRL Archive - SRL Archives

Cap'n Arnav's Chest random solver


Iroki

2009-02-26 06:22:05

Ok i made it today, i know that mods should fix some bugs on it and add some filesafes.

Special thanks to boss01 who lend me his acc.


program New;


{.include srl/srl.scar}


procedure Confirm;
begin
Wait(RandomRange(700, 1200));
MouseBox(384, 237, 503, 278, 1);
end;


function FindChest: boolean;
var
x, y, i, j: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
FindColorsSpiralTolerance(x, y, TPA, 4348001, MSX1, MSY1, MSX2, MSY2, 20);
ATPA := SplitTPA(TPA, 15);
for i := 0 to High(ATPA) do
begin
for j := 0 to 3 do
begin
if MiddleTPAEX(ATPA[i], x, y) then
MMouse(x, y, 3, 3);
if IsUpText('hest') then
begin
GetMousePos(x, y);
ClickMouse(x, y, False);
Wait(RandomRange(1000, 1500));
if ChooseOption('pen') then Result := True;
if Result then Exit;
end;
end;
end;
end;


function FindPortal: boolean;
var
x, y, i, j: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
FindColorsSpiralTolerance(x, y, TPA, 6663573, MSX1, MSY1, MSX2, MSY2, 20);
ATPA := SplitTPA(TPA, 15);
for i := 0 to High(ATPA) do
begin
for j := 0 to 3 do
begin
if MiddleTPAEX(ATPA[i], x, y) then
MMouse(x, y, 3, 3);
if IsUpText('ortal') then
begin
GetMousePos(x, y);
ClickMouse(x, y, False);
Wait(RandomRange(1000, 1500));
if ChooseOption('ortal') then Result := True;
if Result then Exit;
end;
end;
end;
end;


procedure ClickArrow(Times, Col: integer; How: Boolean); //How: True = up, False = down
var
x1, x2, y1, y2, i: integer;
begin
case Col of
1: if How then
begin
x1 := 106; y1 := 11; x2 := 147; y2 := 39;
end else
begin
x1 := 106; y1 := 302; x2 := 147; y2 := 320;
end;
2: if How then
begin
x1 := 193; y1 := 11; x2 := 236; y2 := 39;
end else
begin
x1 := 193; y1 := 302; x2 := 236; y2 := 320;
end;
3: if How then
begin
x1 := 283; y1 := 11; x2 := 327; y2 := 39;
end else
begin
x1 := 283; y1 := 302; x2 := 327; y2 := 320;
end;
end;

for i := 0 to Times - 1 do
begin
Wait(RandomRange(100, 200));
MouseBox(x1, y1, x2, y2, 1);
end;
end;

function MachineBox(i :Integer): TBox;
{
_____ _____ _____
| 1 | 4 | 7 |
|_____|_____|_____|
| 2 | 5 | 8 |
|_____|_____|_____|
| 3 | 6 | 9 |
|_____|_____|_____|
}
var
x1, x2, y1, y2: integer;
begin
case i of

1: begin x1 := 90; x2 := 175; y1 := 45; y2 := 125; end;
2: begin x1 := 90; x2 := 175; y1 := 125; y2 := 210; end;
3: begin x1 := 90; x2 := 175; y1 := 210; y2 := 290; end;

4: begin x1 := 175; x2 := 260; y1 := 45; y2 := 125; end;
5: begin x1 := 175; x2 := 260; y1 := 125; y2 := 210; end;
6: begin x1 := 175; x2 := 260; y1 := 210; y2 := 290; end;

7: begin x1 := 260; x2 := 345; y1 := 45; y2 := 125; end;
8: begin x1 := 260; x2 := 345; y1 := 125; y2 := 210; end;
9: begin x1 := 260; x2 := 345; y1 := 210; y2 := 290; end;

end;

Result.x1 := x1;
Result.x2 := x2;
Result.y1 := y1;
Result.y2 := y2;
end;







procedure Chest_Analyze(Col: integer);
{
______
| |
| | coins
|______|
| |
| | bowl
|______|
| |
| | bar
|______|

ring


This function is serching for bar, combination is always the same.
}
var
Time, i, j, x, y, Slot: integer;
B: TBox;
BBreak: boolean;
begin

case Col of
1: i := 1;
2: i := 4;
3: i := 7;
end;

MarkTime(Time);
repeat
for j := i to i + 2 do
begin
B := MachineBox(j);
if FindColoredAreaTolerance(x, y, 1074825, B.x1, B.y1, B.x2, B.y2, 100, 10) then
begin
Slot := j;
BBreak := True;
// WriteLn(inttostr(j));
end;
end;
until (TimeFromMark(Time) > 5000) or BBreak;

if InRange(i, 4, 6) then Slot := Slot - 3;
if InRange(i, 7, 9) then Slot := Slot - 6;


case slot of
1: ClickArrow(1, Col, True);
2: case Random(1) of
0: ClickArrow(2, Col, True);
1: ClickArrow(2, Col, False);
end;
3: ClickArrow(1, Col, False);
end;

end;


procedure SolveChestRandom;
var
i, x, y: integer;
begin
SetAngle(False);
// FindChest;
FindObj(x, y, 'hest', 7510440, 10);
Mouse(x, y, 0, 0, True);
Wait(RandomRAnge(1200, 1700));
SetAngle(True);
ClickToContinue;
Wait(RandomRAnge(700, 1200));
FindNPCChatText('try', ClickLeft);
Wait(RandomRAnge(700, 1200));
ClickToContinue;
for i := 1 to 3 do
begin
Wait(RandomRAnge(700, 1200));
Chest_Analyze(i);
end;
Confirm;
for i := 0 to 2 do ClickToContinue;
FindPortal;
end;



begin
setupsrl;
activateclient;
SolveChestRandom;

end.

Wizzup?

2009-02-26 06:32:51

Has it occured to you that the combination may differ per account, and per time you enter the random? (Seems obvious to me, but I am not 100% sure.)

Iroki

2009-02-26 06:35:10

as far as i know combination is the same

Colluci

2009-02-26 06:36:06

Thats really nice. Try to solve the Bee-keeper. I posted some pictures in the stickied thread and also there a vid on yt

Iroki

2009-02-26 06:39:26

i need acc stucked in beekeeper random to start makeing solver.

Colluci

2009-02-26 06:42:30

Ill try to get one.

Baked0420

2009-02-26 06:44:04

oh my god Iroki, you're a random solving machine. You've solved so many randoms lately. Rep+ for yet another solver. Goodjob, if I get any randoms I'll send account to you for you to solve it.

Nava2

2009-02-26 08:28:12

You could shorten and clean up your code.

Use some maths in the machine box function, as well, you use unnecessary nests. If only one line of code comes after an if statement, you don't need a begin end nest. Same for after an else! :)

Good job though, quick off the bat.

E: Look at wizzup's post, good initiative, bad logic?

Iroki

2009-02-26 08:40:03

From: Nava2
You could shorten and clean up your code.

Use some maths in the machine box function, as well, you use unnecessary nests. If only one line of code comes after an if statement, you don't need a begin end nest. Same for after an else! :)

Good job though, quick off the bat.


Thanks Nava2, i dont have enought time to "clean" my code. The most important thing is that it works ;), devs must "clean" it.

Tickyy

2009-02-26 10:04:42

wow that was fast :D!

tbh, iroki deserves to be a SRL member.

Torrent of Flame

2009-02-26 11:27:57

From: Tickyy
wow that was fast :D!

tbh, iroki deserves to be a SRL member.


This has been discussed by Admins, and he was a member on that account. He is lucky he is still at SRL for breaking the rules when he was on Iroki. The highest rank he can ever achieve is Jr Member. Same as Sandstorm.


Fantastic scripter or not, rules are rules.


Nice work, Iroki, however.

Iroki

2009-02-26 11:43:19

From: Tickyy
wow that was fast :D!

tbh, iroki deserves to be a SRL member.


I accepted that i cant be member :)

Nava2

2009-02-26 23:21:15

From: Iroki AKA manfromczech
Thanks Nava2, i dont have enought time to "clean" my code. The most important thing is that it works ;), devs must "clean" it.


Err… Isn't that your job?

Da 0wner

2009-02-27 01:07:00

From: Torrent of Flame
This has been discussed by Admins, and he was a member on that account. He is lucky he is still at SRL for breaking the rules when he was on Iroki. The highest rank he can ever achieve is Jr Member. Same as Sandstorm.


Fantastic scripter or not, rules are rules.


Nice work, Iroki, however.


[offtopic] What happened to Sandstorm? [/offtopic]

Tickyy

2009-02-27 01:21:44

From: Da 0wner
[offtopic] What happened to Sandstorm? [/offtopic]


[offtopic]

From: WT-Fakawi

I am sorry Sandstorm, but you will have to accept the fact you will be capped at Junior Members. Rules are rules, you where permanently banned so technically speaking you shouldnt be here in the first place.

Now, I am not saying you are not a nice guy nor that you haven't learned from your mistakes, but Junior is all you will ever be.


Btw, Congrats on your cup that you always wanted, Da Owner :p.

[offtopic]

Da 0wner

2009-02-27 01:44:33

From: Tickyy
[offtopic]



Btw, Congrats on your cup that you always wanted, Da Owner :p.

[offtopic]


Give me the link to that post…and my name has a zero (0).

Edit: :o Is sandstorm hey321? On sythe his name is hey321 and his sig on it said ~Sandstorm.

NiCbaZ

2009-02-27 02:15:29

From: Da 0wner
Give me the link to that post…and my name has a zero (0).

Edit: :o Is sandstorm hey321? On sythe his name is hey321 and his sig on it said ~Sandstorm.


Yes he is ;)

Iroki

2009-03-01 16:23:11

http://www.youtube.com/watch?v=HaAaU9hxNgs - the same combination as in my solver.

nielsie95

2009-03-02 11:09:09

You always try to get the coins in the middle?


2: case Random(1) of
0: ClickArrow(2, Col, True);
1: ClickArrow(2, Col, False);
end;

You know that random(1) never returns 1?

Iroki

2009-03-02 11:13:21

From: nielsie95
You always try to get the coins in the middle?


2: case Random(1) of
0: ClickArrow(2, Col, True);
1: ClickArrow(2, Col, False);
end;

You know that random(1) never returns 1?


Thanks, my fault :)

btw http://www.youtube.com/watch?v=j3sAeuMkhKw <- the same combination.
I need to make new function which checks for object which must be in the centre.

nielsie95

2009-03-02 11:19:59

In the video you posted you see that the bar needs to be in the centre, so it varies each time.

The order of the items seems to be the same every time though. My solver doesn't use that, but it's actually quite a good idea :)

Iroki

2009-03-02 11:26:28

you made this random solver :) ??

nielsie95

2009-03-02 11:48:52

Yes, but that's no reason for you not to work on it :p The best one will be put in SRL.

Iroki

2009-03-02 11:53:41

can i see yours?? I'm just wonder how you solve it:P

nielsie95

2009-03-02 12:01:17

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

function arnav_InRandom: Boolean;
begin
Result := (GetMusic = 'Sea Shanty');
end;

function arnav_LockScreen: Boolean;
begin
Result := SimilarColors(GetColor(497, 19), 6854059, 3);
end;

procedure arnav_ClickArrow(Col: Integer; Up: Boolean);
var
t: TPoint;
begin
t.x := 123 + (Col * 90);
if Up then
t.y := 20
else
t.y := 305;
Mouse(t.x, t.y, 8, 8, True);
Wait(1500 + Random(500));
end;

function arnav_GetTarget: string;
var
tpa: TPointArray;
begin
Result := 'unknown';
if (not arnav_LockScreen) then
Exit;

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

case Length(tpa) of
84: Result := 'bar';
108: Result := 'bowl';
102: Result := 'coins';
end;
end;

function arnav_GetCurrent(Col: Integer): string;
var
i, t: Integer;
tpa: TPointArray;
b: TBox;
Info: array of Variant;
begin
ColorToleranceSpeed(2);
Result := 'unknown';
t := GetSystemTime;
b := IntToBox(91 + (88 * Col), 125, 166 + (88 * Col), 198);

while (Result = 'unknown') and ((GetSystemTime - t) < 20000) and
arnav_LockScreen do
begin
for i := 0 to 4 do
begin
case i of
0: Info := ['bar' , 0.02, 0.15, 1008002, 20, 500];
1: Info := ['coins', 0.03, 0.15, 876911, 13, 700];
2: Info := ['coins', 0.02, 0.7, 1358036, 8, 600];
3: Info := ['bowl' , 0.03, 0.35, 1732993, 30, 850];
4: Info := ['ring' , 0.05, 0.3 , 1421243, 12, 200];
end;
SetColorSpeed2Modifiers(Info[1], Info[2]);
FindColorsTolerance(tpa, Info[3], b.x1, b.y1, b.x2, b.y2, Info[4]);
//WriteLn(IntToStr(i)+':'+IntToStr(Length(tpa)));
if (Length(tpa) > Info[5]) then
begin
Result := Info[0];
//DebugTPA(tpa);
Break;
end;
end;
Wait(60);
end;
WriteLn(Result);
end;

function SolveArnav: Boolean;
var
deg, cts, col, t, x, y: Integer;
Target, c: string;
Up: Boolean;
aci: TAutoColorInfo;
begin
Result := False;
if (not arnav_InRandom) then
begin
WriteLn('Not in Arnav!');
Exit;
end;

with aci do
begin
UpText := 'Talk';
MaxDist := 15;
Color := 2047847;
HueMod := 0.43;
SatMod := 3.23;
LumTol := 8;
MinR := 85; MaxR := 129;
MinG := 28; MaxG := 94;
MinB := 9; MaxB := 63;
MinX := 4.31; MaxX := 11.23;
MinY := 2.86; MaxY := 11.51;
MinZ := 0.59; MaxZ := 6.20;
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 (not ClickContinue(True,True)) then
FindNPCChatText('ready to try', ClickLeft);
end
else if FindObjRecordEx(x, y, aci, MSX1, MSY1, MSX2, MSY2, False, False) then
begin
Mouse(x, y, 0, 0, False);
Wait(100 + Random(200));
ChooseOption('Talk');
Wait(500);
FFlag(0);
x := GetSystemTime;
while (not AreTalking) and ((GetSystemTime - x) < 5000) do Wait(100);
end;
end;

Target := arnav_GetTarget;
if (Target = 'unknown') then
begin
WriteLn('Could not get Arnav target!');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
Exit;
end;
WriteLn('Arnav target: '+Target);

for col := 0 to 2 do
begin
t := GetSystemTime;
Up := RBool;
while ((GetSystemTime - t) < 60000) and arnav_LockScreen do
begin
c := arnav_GetCurrent(col);
if (c = Target) then
Break;
arnav_ClickArrow(col, Up);
end;
if (c <> Target) then
Break;
end;
if (col < 3) then
begin
WriteLn('Could not identify arnav objects!');
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
Exit;
end;

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

if arnav_LockScreen then
CloseWindow;

with aci do
begin
UpText := 'portal';
MaxDist := 15;
Color := 8633254;
HueMod := 0.19;
SatMod := 0.72;
LumTol := 11;
MinR := 147; MaxR := 187;
MinG := 165; MaxG := 212;
MinB := 97; MaxB := 162;
MinX := 28.03; MaxX := 50.00;
MinY := 34.43; MaxY := 59.62;
MinZ := 16.70; MaxZ := 42.60;
MinCount := 100;
end;

t := GetSystemTime;
while arnav_InRandom and ((GetSystemTime - t) < 20000) do
begin
Wait(100);
if AreTalking then
ClickContinue(True,True)
else if FindObjRecordEx(x, y, aci, MSX1, MSY1, MSX2, MSY2, False, False) then
begin
Mouse(x, y, 0, 0, False);
Wait(100 + Random(200));
ChooseOption('Enter');
Wait(500);
FFlag(0);
Wait(4000);
end;
end;

Result := (not arnav_InRandom);
MakeCompass(IntToStr(Deg));
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
end;

begin
SetupSRl;
ClearDebug;
WriteLn(BoolToStr(SolveArnav));
end.

n3ss3s

2009-03-02 12:05:38

Thanks Nava2, i dont have enought time to "clean" my code. The most important thing is that it works , devs must "clean" it.


Wrong, son :p


If the combination varies, here's my 2 cents, I don't have an account in Cap'n Arnav' so can't solve :(


Procedure ClickDown;

Begin
End;

Function GetSlot(X, Y: Integer): String;

Begin
End;

Procedure SolveGame;

Begin
For I := 0 To 2 Do
Slots[i] := GetSlot(0, i); // Get the first column.
For I := 1 To 2 Do
For C := 0 To 2 Do
Repeat
ClickDown;
Until(GetSlot(i, c) = Slots[c]);
End;

:p



EDIT: Oh, Nielsie's has kinda same logic as "my solver".

Naum

2009-03-02 12:14:19

Lol, what with the son, thing. Nielsie nice to see you used TPA lengths to find the letters. I thought the only proper way was to make a whole new text or use bitmaps ;)

jakeyboy29

2009-03-02 12:20:10

son, is the way to descibe i peer i do belive, i use it a lot. son.

n3ss3s

2009-03-02 13:19:08

From: NaumanAkhlaQ
Lol, what with the son, thing. Nielsie nice to see you used TPA lengths to find the letters. I thought the only proper way was to make a whole new text or use bitmaps ;)


I don't know, I just say it a lot now because I tell loads of people in PVP like "You tried, son" or "Wrong pray, son" :p

Iroki

2009-03-02 14:33:37


case Length(tpa) of
84: Result := 'bar';
108: Result := 'bowl';
end;
i have screenie with coins, i can get length of it :)


function arnav_GetCurrent(Col: Integer): string;
var
i:integer;
maybe byte; ?? just idea :P

nielsie95

2009-03-02 14:35:51

From: Iroki AKA manfromczech

case Length(tpa) of
84: Result := 'bar';
108: Result := 'bowl';
end;
i have screenie with coins, i can get length of it :)


Cool, that would be very nice :)

Iroki

2009-03-02 14:45:51

102: Result := 'coins';

:)

Naum

2009-03-02 14:48:07

Just the .bmp if you need.


Iroki

2009-03-02 14:51:17

My bmp :P but its compressed by tinypic :)

nielsie95

2009-03-02 16:50:24

Thank you very much :)

Punkgi

2009-03-21 05:12:20

now how do i use this?

Heavenzeyez1

2009-03-21 05:52:53

Well, you can't yet, they are not ready, you must wait for the next SRL #rev. :)
Good job, guys!
~Eerik~

jas0npc

2009-04-04 17:37:50

I really need this, i seem to get arnav while wc magics

noidea

2009-04-06 12:16:30

Hmm, does any one have a way of detecting what object you need to choose?