SRL Archive - SRL Bugs

New SolveLeo


Wanted

2009-12-20 00:30:28

Lot of work guys, big thanks to Iroki… his current plugin still works if you use it the right way (as he explained to me on MSN)

New Leo.scar

I exited one of my accounts to test its entirety, but I still have one account left if anyone wants proof that this works like a charm ;)

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- ยป Leo The Grave Digger Routines --//
//-----------------------------------------------------------------//
// * procedure Leo_LoadDTMs; // * by ZephyrsFury
// * function InLeoGraveyard: Boolean; // * by ZephyrsFury
// * procedure Leo_WaitForScreen(What: string); // * by Iroki
// * procedure Leo_ToCenter; // * by IceFire908
// * function Leo_WalkTo: Boolean; // * by IceFire908
// * function Leo_DepositMausoleum: Boolean; // * by IceFire908
// * function Leo_TalkTo: Boolean; // * by IceFire908
// * function Leo_ClickNearestGrave(cx, cy: Integer): Boolean; // * by Nielsie95 and SKy Scripter
// * function Leo_AnalyzeCoffin2(GetClientCanvas.Handle): string;// * by Iroki
// * function Leo_AnalyzeGraveStone2(GetClientCanvas.Handle): string; // * by Iroki
// * function Leo_BuryCoffins: Boolean; // * by IceFire908 & Iroki
// * function SolveLeo: Boolean; // * by IceFire908, Iroki, Nielsie95, & SKy Scripter

var
LeoDTM_Coffin: Integer;

const
Leo_CoffinColour = 3105664;
Leo_CoffinTol = 8;
Leo_CoffinHue = 0.06;
Leo_CoffinSat = 1.30;

{*******************************************************************************
procedure Leo_LoadDTMs;
By: ZephyrsFury
Description: Loads Leo Solver DTMs and Bitmaps, etc.
*******************************************************************************}

procedure Leo_LoadDTMs;
begin
LeoDTM_Coffin := DTMFromString('78DA63CC636660E864644006B1DE9A0C72401' +
'A24FA1F081893806A1A51D530303081499828584D270135154035' +
'5309A82906AA994E404D35504D3F01358540354D04D46401D54CC' +
'4AD860D8801E1940D04');
end;

{*******************************************************************************
function InLeoGraveyard: Boolean;
By: ZephyrsFury
Description: Checks if we're in the Leo random.
*******************************************************************************}

function InLeoGraveyard: Boolean;
var
Pts: TPointArray;
ATPA: T2DPointArray;
X, Y, II, GraveCount, cts: Integer;
B: TBox;
begin
if (InBlack) then
if (FindColor(X, Y, 60909, MMX1, MMY1, MMX2, MMY2)) then
if (CountColor(60909, MMX1, MMY1, MMX2, MMY2) = 1) then
if (InRange(PercentBlackMM, 75, 80)) then
begin
FindColorsPie(Pts, clWhite, 50, 0.0, 360.0, 0.0, 76.0, MMX1, MMY1, MMX2, MMY2, MMCX, MMCY);
B := GetTPABounds(Pts);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(100.0, 100.0);
FindColorsTolerance(Pts, 0, B.X1, B.Y1, B.X2, B.Y2, 2);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(cts);
ATPA := SplitTPAEx(Pts, 1, 1);
for II := 0 to High(ATPA) do
if (Length(ATPA[II]) < 50) then
Inc(GraveCount);
Result := (GraveCount > 5);
end;
end;

{*******************************************************************************
procedure Leo_WaitForScreen(What: string);
By: Iroki
Description: Waits for a gravestone/coffin screen.
*******************************************************************************}

procedure Leo_WaitForScreen(What: string);
var
t, C: Integer;
begin
if (What = 'coffin') then
C := 0
else
C := 465160;
t := GetSystemTime;
while (GetColor(20, 20) <> C) and ((GetSystemTime - t) <= (5 * 1000)) do Wait(1);
end;


{*******************************************************************************
procedure Leo_ToCenter;
By: IceFire908
Description: Walks to the center of the graveyard
*******************************************************************************}

procedure Leo_ToCenter;
var
TPA: TPointArray;
LTC: TPoint;
begin
FindColorsTolerance(TPA, clWhite, MMX1, MMY1, MMX2, MMY2, 421);
FilterPointsPie(TPA, 0, 360, 0, 75, MMCX, MMCY);
LTC := MiddleTPA(TPA);
if (Distance(MMCX, MMCY, LTC.X + 3, LTC.Y + 6) > 4) then
begin
Mouse(LTC.X + 3, LTC.Y + 6, 0, 0, True);
Wait(RandomRange(700, 1400));
Flag;
end;
Wait(2500 + Random(500));
end;

{*******************************************************************************
function Leo_WalkTo: Boolean;
by: IceFire908
Description: Finds Leo's NPC yellow dot on the MM and walks to it.
*******************************************************************************}

function Leo_WalkTo: Boolean;
var
TPA: TPointArray;
LWT: TPoint;
begin
Result := FindColors(TPA, 195836, MMX1, MMY1, MMX2, MMY2);
if (not (Result)) then
Exit;
FilterPointsPie(TPA, 0, 360, 0, 75, MMCX, MMCY);
LWT := MiddleTPA(TPA);
if (Distance(MMCX, MMCY, LWT.X, LWT.Y) < 5) then
Exit;
Mouse(LWT.X, LWT.Y, 2, 2, True);
Wait(RandomRange(300, 500));
FFlag(0);
Wait(RandomRange(1500, 2000));
end;

{*******************************************************************************
function Leo_DepositMausoleum: Boolean;
by: IceFire908
Description: Deposits your last 5 items if needed into your bank.
*******************************************************************************}

function Leo_DepositMausoleum: Boolean;
var
TPAA: T2DPointArray;
TPA: TPointArray;
DM, P: TPoint;
I: LongInt;
II: Byte;
B: TBox;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.42, 0.08);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5066321, MSX1, MSY1, MSX2, MSCY, 10);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
TPAA := TPAToATPAEx(TPA, 50, 50);
SortATPASize(TPAA, True);
for I := 0 to High(TPAA) do
begin
DM := MiddleTPA(TPAA[I]);
MMouse(DM.X, DM.Y, 3, 3);
Wait(200 + Random(50));
if (CountColorTolerance(14342657, 7, 7, 100, 25, 70) > 100) then
begin
Result := True;
GetMousePos(DM.X, DM.Y);
Mouse(DM.X, DM.Y, 0, 0, True);
Wait(RandomRange(2000, 3000));
ClickContinue(True, True);
Wait(RandomRange(2000, 3000));
for II := 0 to 4 do
begin
B := IntToBox(383 - (II * 48), 218, 431 - (II * 48), 256);
if (FindColor(P.X, P.Y, srl_OutLine_Black, B.X1, B.Y1, B.X2, B.Y2)) then
begin
Mouse((B.X1 + B.X2) div 2, (B.Y1 + B.Y2) div 2, 2, 2, False);
Wait(RandomRange(400, 600));
ChooseOption('Deposit-All');
Wait(RandomRange(600, 800));
end;
end;
Mouse(434, 40, 0, 0, True);
Wait(RandomRange(1200, 1400));
Exit;
end;
end;
end;

{*******************************************************************************
function Leo_TalkTo: Boolean;
By: IceFire908
Description: Finds Leo and talks to him.
*******************************************************************************}

function Leo_TalkTo: Boolean;
var
TPAA: T2DPointArray;
TPA: TPointArray;
LTT: TPoint;
I: LongInt;
begin
MMouse(MSCX, MSCY, 0, 0);
Wait(200 + Random(50));
if (CountColorTolerance(648165, 7, 7, 100, 25, 50) > 40) then
begin
Result := True;
GetMousePos(LTT.X, LTT.Y);
Mouse(LTT.X, LTT.Y, 0, 0, True);
Wait(RandomRange(1000, 2000));
Exit;
end;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15, 0.21);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3624531, MSX1, MSY1, MSX2, MSY2, 4);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
TPAA := TPAToATPAEx(TPA, 15, 15);
SortATPASize(TPAA, True);
for I := 0 to High(TPAA) do
begin
LTT := MiddleTPA(TPAA[I]);
MMouse(LTT.X, LTT.Y, 3, 3);
Wait(200 + Random(50));
if (CountColorTolerance(648165, 7, 7, 100, 25, 50) > 40) then
begin
Result := True;
GetMousePos(LTT.X, LTT.Y);
Mouse(LTT.X, LTT.Y, 0, 0, True);
Wait(RandomRange(1000, 2000));
Exit;
end;
end;
end;

{*******************************************************************************
procedure Leo_GrabCoffins;
By: Nielsie95 and SKy Scripter
Description: Grabs all coffins from the screen.
*******************************************************************************}

procedure Leo_GrabCoffins;
var
i, x, y, c, Time, f: Integer;
p: TPointArray;
t: T2DPointArray;
begin
Time := GetSystemTime;

while (CountItems('dtm', LeoDTM_Coffin, []) < 5) and ((GetSystemTime - Time) <= (60 * 1000)) and (f < 5) do
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Leo_CoffinHue, Leo_CoffinSat);
FindColorsTolerance(p, leo_CoffinColour, MSX1, MSY1, MSX2, MSY2, Leo_CoffinTol);
if (Length(p) < 30) then Continue;
t := SplitTPAEx(p, 7, 7);
SortATPAFromFirstPoint(t, Point(MSCX, MSCY));
for i := 0 to High(t) do
begin
MiddleTPAEx(t[i], x, y);
MMouse(x, y, 5, 15);
Wait(200 + Random(50));
if (InRange(CountColorTolerance(14342657, 7, 7, 100, 25, 70), 10, 70)) then
begin
GetMousePos(x, y);
c := InvCount;
Mouse(x, y, 0, 0, True);
Wait(500);
FFlag(0);
Wait(1500);
y := 0;
while (c = InvCount) and (y < 20) do
begin
Inc(y);
Wait(500);
end;
if (c < InvCount) then
Break;
end;
end;
if (i > High(t)) then
begin
Inc(f);
Leo_ToCenter;
end;
ColorToleranceSpeed(1);
end;
end;

{*******************************************************************************
function Leo_ClickNearestGrave(cx, cy: Integer): Boolean;
By: Nielsie95 and SKy Scripter
Description: Puts the coffin inside the grave.
*******************************************************************************}

function Leo_ClickNearestGrave(cx, cy: Integer): Boolean;
var
i, c, x, y: Integer;
p: TPointArray;
t: T2DPointArray;
b: TBox;
begin
Result := False;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.33);
FindColorsTolerance(p, 4609120, MSX1, MSY1, MSX2, MSY2, 13);
SetColorSpeed2Modifiers(0.1, 0.2);
t := SplitTPAEx(p, 3, 3);
SortATPAFrom(t, Point(cx, cy));
SortATPAFromFirstPoint(t, Point(cx, cy));

for i := 0 to High(t) do
if (Length(t[i]) > 150) then
begin
b := GetTPABounds(t[i]);
if (CountColorTolerance(3563122, b.x1 + 10, b.y1 + 10, b.x2 -10, b.y2 -10, 13) > 5) then Continue;
MiddleTPAEx(t[i], x, y);
MMouse(x -4, y -4, 10, 10);
Wait(200 + Random(150));
if (not (InRange(CountColorTolerance(14342657, 7, 7, 100, 25, 70), 10, 70))) then Continue;
GetMousePos(x, y);
c := InvCount;
Mouse(x, y, 0, 0, True);
Result := True;
Wait(500);
FFLag(0);
y := 0;
while (c = InvCount) and (y < 20) do
begin
Inc(y);
Wait(500);
end;
if (c > InvCount) then
Break
else
Leo_ClickNearestGrave(cx, cy);
end;
end;

{*******************************************************************************
function Leo_AnalyzeCoffin2(GetClientCanvas.Handle): string;
By: Iroki
Description: Indentifys the coffin, should work first try, if not fail safe :-)
*******************************************************************************}

{*******************************************************************************
function Leo_AnalyzeGraveStone2(GetClientCanvas.Handle): string;
By: Iroki
Description: Indentifys the grave stone, 3 trys and you're good.
*******************************************************************************}

{*******************************************************************************
function Leo_BurryCoffins: Boolean;
By: IceFire908 & Iroki
Description: Finds and identifies coffins and graves.
*******************************************************************************}

function Leo_BuryCoffins: Boolean;
var
GraveTypeCount: array [0..4] of array [0..4] of Integer;
GraveNames: array [0..4] of array [0..2] of string;
CofNames, GraveName: array [0..4] of string;
InvLoc: array [0..4] of Integer;
I, Coffin, II, III, T: Integer;
C, Center, RGS, UWG: TPoint;
GraveSkills: TStringArray;
StoneLoc: array of TBox;
TPAA: T2DPointArray;
TPA: TPointArray;
BadName: Boolean;
B: TBox;
begin
Leo_GrabCoffins;
if (CountItems('dtm', LeoDTM_Coffin, []) < 5) then
begin
WriteLn('Could not find all coffins!');
LogOut;
Exit;
end;
for I := 1 to 28 do
begin
if (not (ExistsItem(I))) then
Continue;
B := InvBox(I);
if (FindDTM(LeoDTM_Coffin, C.X, C.Y, B.X1, B.Y1, B.X2, B.Y2)) then
begin
InvLoc[Coffin] := I;
for II := 0 to 4 do
begin
BadName := False;
Mouse(C.X, C.Y, 2, 2, True);
Leo_WaitForScreen('coffin');
CofNames[Coffin] := Leo_AnalyzeCoffin2(GetClientCanvas.Handle);
Wait(RandomRange(1000, 2000));
Mouse(490, 26, 2, 2, True);
for III := 0 to 4 do
if ((CofNames[III] = CofNames[Coffin]) and (III <> Coffin)) then
BadName := True;
if ((CofNames[Coffin] <> 'error') and (CofNames[Coffin] <> '') and (not (BadName))) then
begin
WriteLn('Coffin ' + IntToStr(Coffin + 1) + ' ' + CofNames[Coffin] + ' identified!');
Inc(Coffin);
Break;
end;
if (II = 4) then
begin
WriteLn('Unable to identify coffin!');
LogOut;
Exit;
end;
end;
end;
end; //NW[0], NE[1], SW[2], SM[3], SE[4] for the loc indexes
GraveSkills := ['cooking', 'crafting', 'farming', 'mining', 'woodcutting'];
StoneLoc := [IntToBox(123, 45, 264, 161), IntToBox(274, 48, 402, 169), IntToBox(14, 162, 178, 317),
IntToBox(232, 149, 333, 331), IntToBox(367, 158, 509, 331)];
for I := 0 to 4 do
begin
Center := Point((StoneLoc[I].X1 + StoneLoc[I].X2) div 2, (StoneLoc[I].Y1 + StoneLoc[I].Y2) div 2);
Leo_ToCenter;
for II := 0 to 2 do
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.42, 0.08);
if (II = 0) then
FindColorsSpiralTolerance(Center.X, Center.Y, TPA, 6908269, StoneLoc[I].X1, StoneLoc[I].Y1, StoneLoc[I].X2, StoneLoc[I].Y2, 17)
else
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 6908269, MSCX - 50, MSCY - 50, MSCX + 50, MSCY + 50, 14);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
TPAA := TPAToATPAEx(TPA, 10, 10);
if (II = 0) then
SortATPAFromFirstPoint(TPAA, Center)
else
SortATPAFromFirstPoint(TPAA, Point(MSCX, MSCY));
for III := 0 to High(TPAA) do
begin
RGS := MiddleTPA(TPAA[III]);
MMouse(RGS.X, RGS.Y, 2, 2);
Wait(250 + Random(50));
if (CountColorTolerance(14342657, 7, 7, 100, 25, 70) > 100) then
begin
GetMousePos(RGS.X, RGS.Y);
Mouse(RGS.X, RGS.Y, 0, 0, True);
Leo_WaitForScreen('');
GraveNames[I][II] := Leo_AnalyzeGraveStone2(GetClientCanvas.Handle);
if (GraveNames[I][II] = '') then
GraveNames[I][II] := 'error';
WriteLn('Grave ' + IntToStr(I + 1) + ' ' + IntToStr(II + 1) + ' ' + GraveNames[I][II] + ' identified!');
Wait(RandomRange(2000, 3000));
Mouse(490, 26, 2, 2, True);
Break;
end;
if (III = High(TPAA)) then
begin
WriteLn('Could not find grave stone!');
LogOut;
Exit;
end;
end;
end;
end;
for I := 0 to 4 do //Count em up
for II := 0 to 2 do
if (InStrArrEx(GraveNames[I][II], GraveSkills, III)) then
Inc(GraveTypeCount[I][III]);
for I := 0 to 4 do //Found a 3 of one
for II := 0 to 4 do
if (GraveTypeCount[I][II] > 2) then
if (not (StrInArr(GraveSkills[II], GraveName))) then
GraveName[I] := GraveSkills[II];
for I := 0 to 4 do //Found a 2 of one
for II := 0 to 4 do
if (GraveTypeCount[I][II] > 1) then
if (not (StrInArr(GraveSkills[II], GraveName))) then
GraveName[I] := GraveSkills[II];
for I := 0 to 4 do //Maybe one of them
begin
if (GraveName[I] <> '') then
Continue;
for II := 0 to 2 do
if (not (StrInArr(GraveNames[I][II], GraveName))) then
if (StrInArr(GraveNames[I][II], GraveSkills)) then
GraveName[I] := GraveNames[I][II];
end;
for I := 0 to 4 do //randomize the rest and pray
begin
if (GraveName[I] <> '') then
Continue;
for II := 0 to 4 do
if (not (StrInArr(GraveSkills[II], GraveName))) then
begin
GraveName[I] := GraveSkills[II];
Break;
end;
end;
for I := 0 to 4 do
WriteLn(IntToStr(I + 1) + ' = ' + GraveName[I]);
for I := 0 to 4 do //bury coffins
begin
Leo_ToCenter;
InStrArrEx(GraveName[I], CofNames, II);
MouseItem(InvLoc[II], False);
Wait(250 + Random(50));
ChooseOption('se');
Wait(RandomRange(500, 800));
Center := Point((StoneLoc[I].X1 + StoneLoc[I].X2) div 2, (StoneLoc[I].Y1 + StoneLoc[I].Y2) div 2);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.11, 0.19);
FindColorsSpiralTolerance(Center.X, Center.Y, TPA, 3490382, StoneLoc[I].X1, StoneLoc[I].Y1, StoneLoc[I].X2, StoneLoc[I].Y2, 7);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
TPAA := TPAToATPAEx(TPA, 30, 30);
SortATPAFromFirstPoint(TPAA, Center)
for II := 0 to High(TPAA) do
begin
UWG := MiddleTPA(TPAA[II]);
MMouse(UWG.X, UWG.Y, 2, 2);
Wait(250 + Random(50));
if (InRange(CountColorTolerance(14342657, 7, 7, 250, 25, 70), 100, 200)) then
begin
III := InvCount;
GetMousePos(UWG.X, UWG.Y);
Mouse(UWG.X, UWG.Y, 0, 0, True);
T := GetSystemTime;
while (((GetSystemTime - T) < 15000) and (InvCount = III)) do
Wait(RandomRange(500, 1500));
Wait(RandomRange(2000, 3000));
Break;
end;
if (II = High(TPAA)) then
begin
WriteLn('Could not find grave!');
LogOut; //Deselect coffin
Wait(RandomRange(500, 1000));
LogOut;
Exit;
end;
end;
end;
Result := True;
end;

{*******************************************************************************
function SolveLeo: Boolean;
By: IceFire908, Iroki, Nielsie95, & SKy Scripter
Description: Solves the Leo random.
*******************************************************************************}

function SolveLeo: Boolean;
var
X, Y, Leo_Trys: Integer;
KeepGoin: Boolean;
begin
Leo_LoadDTMs;
for Leo_Trys := 1 to 10 do
begin
WriteLn('Leo try # ' + IntToStr(Leo_Trys));
SetAngle(True);
MakeCompass('N');
GameTab(tab_Inv);
Wait(2000);
if (Leo_Trys = 1) then
begin
while (InConvo) do
ClickContinue(True, True);
Wait(1000);
if (FindColor(X, Y, 65535, MSX1, MSY1, MSX2, MSY2)) then
Mouse(455, 45, 5, 5, True);
Wait(RandomRange(1000, 1500));
if (InvCount > 23) then
Leo_DepositMausoleum;
end;
if Leo_BuryCoffins then
if Leo_WalkTo then
if Leo_TalkTo then
begin
while (InConvo) do
begin
ClickContinue(True, True);
if (FindNPCChatText('want', ClickLeft)) then
KeepGoin := True;
Wait(RandomRange(1500, 2500));
end;
end;
if (not (KeepGoin)) then
Break;
KeepGoin := False;
if (Leo_Trys = 10) then
begin
WriteLn('Failed to solve Leo!');
LogOut;
end;
end;
FreeDTM(LeoDTM_Coffin);
Result := (LoggedIn);
if (Result) then
WriteLn('Solved Leo!')
else
begin
WriteLn('Failed to solve Leo!');
LogOut;
end;
end;

tarajunky

2009-12-20 01:10:21

I tried it 3 times and it never completed.

-Analyze coffin was correct for every coffin every time, even though it only analyzed for like 1/5th of a second each.
-Walking to center works most of the time.
-After clicking the headstone, it only checked for a split second each time. It was usually right if part of the front was visible, but otherwise it was often wrong. Each headstone was analyzed 3? times.
-After the first headstone click, your character walks to the grave and analyze starts as soon as the spinning headstone comes up. But after closing the first spinning screen, your player often has not finished walking to the side of the headstone and will continue walking a bit. This makes the main screen headstone search miss sometimes, which makes the solver abort and log out.

So, I suggest you have the headstone solver sample each spinning headstone more than once over a longer period of time, and repeat that 3 times. I also suggest that you add a 1+ second wait between the first and second headstone analysis to allow your character to finish walking if necessary.

Wanted

2009-12-20 01:14:18

From: tarajunky
I tried it 3 times and it never completed.

-Analyze coffin was correct for every coffin every time, even though it only analyzed for like 1/5th of a second each.
-Walking to center works most of the time.
-After clicking the headstone, it only checked for a split second each time. It was usually right if part of the front was visible, but otherwise it was often wrong. Each headstone was analyzed 3? times.
-After the first headstone click, your character walks to the grave and analyze starts as soon as the spinning headstone comes up. But after closing the first spinning screen, your player often has not finished walking to the side of the headstone and will continue walking a bit. This makes the main screen headstone search miss sometimes, which makes the solver abort and log out.

So, I suggest you have the headstone solver sample each spinning headstone more than once over a longer period of time, and repeat that 3 times. I also suggest that you add a 1+ second wait between the first and second headstone analysis to allow your character to finish walking if necessary.


Iroki told me to do it exactly this way for some reason, wait minimum and search the gravestones 3 times and make the best guess. I really need him to better explain how his plugin works… because I designed this entirely around what he told me on MSN.

If he could post here then I would know what to do, but moving around components to make it work wouldn't help much because I don't know what I am doing, all this aside… the success rate is till 70%+ vs the old one where the InGraveYard function didn't work at all. I'd be willing to edit the code myself once I know what Iroki wants. Idk if this matters but there is no SetAngle(True)… I did everything at high north angle.

tarajunky

2009-12-20 02:47:10

The biggest problem is the lack of waiting between analyses. It should be easy to add a wait after the analysis and before the next headstone click without messing up Iroki's code.

Wanted

2009-12-20 11:00:58

Alright I did as you suggested Tara, and I talked to Iroki.. he said it's supposed to check the screen the second it comes up because its always the same at that instant. Updated first post+attachment.

Larger wait at end of tocenter

Wait(2500 + Random(500));

Wait before close coffin

Wait(RandomRange(1000, 2000));

Wait before close gravestone

Wait(RandomRange(2000, 3000));

beginning of main function

SetAngle(True);
MakeCompass('N');


Works just like you would like it :)

Between Tara and I we have like 5 accounts still in the random, if you want to start from the very beginning put all the coffins in randoms graves then logout then login.

tarajunky

2009-12-20 12:03:54

I tried it again, and it was able to complete the grave analysis okay this time. However, it didn't get the graves right, and when it talked to Leo it just froze after a couple of dialog screens.

It stopped at the screen that asks if you want to try again, or just to leave and be teleported somewhere random. That's a new screen AFAIK, so some code to handle it may just need to be added.

It definitely works better for me now.

Wanted

2009-12-20 16:03:14

From: tarajunky
I tried it again, and it was able to complete the grave analysis okay this time. However, it didn't get the graves right, and when it talked to Leo it just froze after a couple of dialog screens.

It stopped at the screen that asks if you want to try again, or just to leave and be teleported somewhere random. That's a new screen AFAIK, so some code to handle it may just need to be added.

It definitely works better for me now.


If it had them right it would of exited the random, I didn't know what happens if you get them wrong just thought he teleports you to some random godawful place. I'll add something to click try again or whatever…more detections. :)

Edit: Updated first post's script/attachment


I put in a longer wait for walk to leo, put an invcount check waiter thingy in the bury coffins so it waits the right amount of time, and I realized you can retry leo as many times as you want and added a retry system that will go up to 10. It will automatically do what it needs to leave/click retry. Please test it now Tara :)

swisspking

2009-12-20 16:21:30

I read your script, I'm not completely sure, but doesnt this just deposit all your items in the 5 first inv spaces? What would the lvl 3 Powermining-Skiller do with his Pickaxe in his first inventory slot? ;)

From: IceFire908

function Leo_DepositMausoleum: Boolean;
var
TPAA: T2DPointArray;
TPA: TPointArray;
DM, P: TPoint;
I: LongInt;
II: Byte;
B: TBox;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.42, 0.08);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5066321, MSX1, MSY1, MSX2, MSCY, 10);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
TPAA := TPAToATPAEx(TPA, 50, 50);
SortATPASize(TPAA, True);
for I := 0 to High(TPAA) do
begin
DM := MiddleTPA(TPAA[I]);
MMouse(DM.X, DM.Y, 3, 3);
Wait(200 + Random(50));
if (CountColorTolerance(14342657, 7, 7, 100, 25, 70) > 100) then
begin
Result := True;
GetMousePos(DM.X, DM.Y);
Mouse(DM.X, DM.Y, 0, 0, True);
Wait(RandomRange(2000, 3000));
ClickContinue(True, True);
Wait(RandomRange(2000, 3000));
for II := 0 to 4 do
begin
B := IntToBox(383 - (II * 48), 218, 431 - (II * 48), 256);
if (FindColor(P.X, P.Y, srl_OutLine_Black, B.X1, B.Y1, B.X2, B.Y2)) then
begin
Mouse((B.X1 + B.X2) div 2, (B.Y1 + B.Y2) div 2, 2, 2, False);
Wait(RandomRange(400, 600));
ChooseOption('Deposit-All');
Wait(RandomRange(600, 800));
end;
end;
Mouse(434, 40, 0, 0, True);
Wait(RandomRange(1200, 1400));
Exit;
end;
end;
end;


If i made a mistake, don't mind this.

Wanted

2009-12-20 18:16:18

It deposits the last 5 items if needed room for coffins

tarajunky

2009-12-21 03:00:22

Another bug/suggestion.

This time it correctly identified all coffins, tried to guess the headstones and messed up a bit, and then had a new error.

This time it went to select the first coffin to put in the grave, clicked the coffin in the inventory, immediately moved the mouse to the grave, and then logged out. Apparently the inventory click had not yet fully registered, so when it moved to the grave it did not detect the use coffin -> grave uptext it was looking for and spit out an error. So, I suggest that after you click the coffin in the inventory that you add a short wait there before it moves to the grave. Maybe 250 ms or so. Alternatively, you could move the mouse to the grave immediately, but wait ~250 ms before checking the uptext.

It looks like it's working very well overall. These are minor bugs, but you might as well squash them.

Wanted

2009-12-21 12:42:20

From: tarajunky
Another bug/suggestion.

This time it correctly identified all coffins, tried to guess the headstones and messed up a bit, and then had a new error.

This time it went to select the first coffin to put in the grave, clicked the coffin in the inventory, immediately moved the mouse to the grave, and then logged out. Apparently the inventory click had not yet fully registered, so when it moved to the grave it did not detect the use coffin -> grave uptext it was looking for and spit out an error. So, I suggest that after you click the coffin in the inventory that you add a short wait there before it moves to the grave. Maybe 250 ms or so. Alternatively, you could move the mouse to the grave immediately, but wait ~250 ms before checking the uptext.

It looks like it's working very well overall. These are minor bugs, but you might as well squash them.


Fixed

    Wait(250 + Random(50));
ChooseOption('se');
Wait(RandomRange(500, 800));

Updated first post/attachment again, I've never had that problem but it was a painless fix so :)

Also remember if it puts the wrong coffins in the graves you got unlimited retrys so I set it to 10 max…by the it should work for sure or it just logs out and leaves the account in the random for development or manual solving so you don't teleport to some godawful place.

Town

2009-12-21 19:55:42

Leo try # 1
Coffin 1 cooking identified!
Coffin 2 crafting identified!
Coffin 3 farming identified!
Coffin 4 mining identified!
Coffin 5 woodcutting identified!
Grave 1 1 woodcutting identified!
Grave 1 2 cooking identified!
Grave 1 3 farming identified!
Grave 2 1 woodcutting identified!
Grave 2 2 cooking identified!
Grave 2 3 error identified!
Grave 3 1 woodcutting identified!
Grave 3 2 crafting identified!
Grave 3 3 error identified!
Grave 4 1 woodcutting identified!
Grave 4 2 woodcutting identified!
Grave 4 3 woodcutting identified!
Grave 5 1 woodcutting identified!
Grave 5 2 mining identified!
Grave 5 3 mining identified!
1 = farming
2 = cooking
3 = crafting
4 = woodcutting
5 = mining
Solved Leo!

Success! Consider adding some sort of randomness to how many times it checks each coffin and gravestone, even if it isn't actually checked the extra 1 or 2 times. It's somewhat repetitive in that sense.

Wanted

2009-12-21 20:22:56

From: Town
Leo try # 1
Coffin 1 cooking identified!
Coffin 2 crafting identified!
Coffin 3 farming identified!
Coffin 4 mining identified!
Coffin 5 woodcutting identified!
Grave 1 1 woodcutting identified!
Grave 1 2 cooking identified!
Grave 1 3 farming identified!
Grave 2 1 woodcutting identified!
Grave 2 2 cooking identified!
Grave 2 3 error identified!
Grave 3 1 woodcutting identified!
Grave 3 2 crafting identified!
Grave 3 3 error identified!
Grave 4 1 woodcutting identified!
Grave 4 2 woodcutting identified!
Grave 4 3 woodcutting identified!
Grave 5 1 woodcutting identified!
Grave 5 2 mining identified!
Grave 5 3 mining identified!
1 = farming
2 = cooking
3 = crafting
4 = woodcutting
5 = mining
Solved Leo!

Success! Consider adding some sort of randomness to how many times it checks each coffin and gravestone, even if it isn't actually checked the extra 1 or 2 times. It's somewhat repetitive in that sense.


It only checks coffins once unless it senses a problem with the name i.e. error or already in the array… but the gravestone random amount of checks might be a good idea.. I don't know how that will affect the sorting method but I'll look into it.

Wanted

2009-12-22 22:42:24

Ran again
Leo try # 1
Coffin 1 crafting identified!
Coffin 2 woodcutting identified!
Coffin 3 mining identified!
Coffin 4 farming identified!
Coffin 5 cooking identified!
Grave 1 1 crafting identified!
Grave 1 2 crafting identified!
Grave 1 3 crafting identified!
Grave 2 1 error identified!
Grave 2 2 error identified!
Grave 2 3 woodcutting identified!
Grave 3 1 error identified!
Grave 3 2 cooking identified!
Grave 3 3 error identified!
Grave 4 1 cooking identified!
Grave 4 2 cooking identified!
Grave 4 3 cooking identified!
Grave 5 1 mining identified!
Grave 5 2 mining identified!
Grave 5 3 mining identified!
1 = crafting
2 = woodcutting
3 = farming
4 = cooking
5 = mining
Solved Leo!
1

Works pretty well, commit or something?

tarajunky

2009-12-23 01:08:57

Committed. Good work.:thumbsup:

SKy Scripter

2009-12-23 04:19:37

lol whats the differ between Leo_AnalyzeGraveStone and Leo_AnalyzeGraveStone2?

Wanted

2009-12-23 13:33:09

From: SKy Scripter
lol whats the differ between Leo_AnalyzeGraveStone and Leo_AnalyzeGraveStone2?


Ask Iroki.. I have no idea

Wanted

2010-01-03 23:14:30

Hey I noticed there was a small bug in this when it has to try more than once

It needs to add this line after the Break; :


    if (not (KeepGoin)) then
Break;
KeepGoin := False;

I have updated it in the first post and attachment on this this thread.


Also, in antirandoms.scar, The RewardBox's DTM needs to be changed to this:

  bDTM := DTMFromString('78DA63CC61626078C68002DA452219FE03694' + 
'620FE0F048C9940355719D00013986484F2187388509300E4DF23' +
'A0A69C083520F77C20C2AED704D45400F96FF1AB0100750B108B');

If someone could please commit that would we awesome.