SRL Archive - SRL Archives

Molly Solver


Naum

2009-12-12 07:24:53

This is the end result of the molly solver which I started a month back. It was mainly for submission in the scripting competition. But since I've been asked quite a few times to release it, I'm going to.

When I put out my 'plea' for accounts I did not expect many to pick up. However, I was seriously wrong. The community responded with tremendous results :)! Thanks very much guys :D. In no particular order:

  • IceFire908 - Thanks a lot for your support :D
  • YoHoJo - Thanks a lot as well :)
  • Zeph - being a pro, as usual
  • Mormonman - Thanks for the account :)
  • Brain - thanks alot for the account :)
  • Zyt3x - thanks for the account, as well :D
  • Simtoon - Veyr first person to help me with an account, so thanks
  • Anyone I've left out thank-you soo much :D
  • Wizzup - for some of the code I borrowed. And the old solver (which was 1337)
  • Ray, Niels, Sum - For the help

In total I received 8 accounts and that's really fantastic! I can not thank everyone enough!

New:
Const
FullDebug = True; //Debug it all?
M_DefaultHeight = 62; //Molly's Height (Used in M_FindMS)
M_CrossColor = 2438909; //The crosshair color, should be fine..
M_CrossTol = 5; //The tolerance of the cross, should be fine..


Var
MollyColors : TIntegerArray; //Variables
M_TileWidth : Extended;
M_CrossPoint : TPoint;
BlondeMolly : Boolean;

Type
TMollyControl = Record //Molly record.
Direction : (_Up, Down, _Right, _Left);
Times : Byte;
End;

{*******************************************************************************
Function FindMollyDoor(DP : TPoint; SortBy : Integer) : Boolean;
by: Naum
Description: Opens the door in molly.
SortBy is which direction to sort it from (Left or Right)
Used in entering and exiting (included for one-click opening)
*******************************************************************************}

const
srl_Molly_DoorMin = 15;
srl_Molly_DoorMax = 1 shl 20;
srl_Molly_DoorW = 10;
srl_Molly_DoorH = 14;
srl_Molly_HeightF = 2.443;

function FindMollyDoor(Var DP : TPoint; SortBy : Integer) : Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
ii, h : Integer;
begin
If Not LoggedIn Then Exit;
{ To be replaced with global TAutoColorInfo array. }
SetColorspeed2Modifiers(0.21, 0.44);
FindColorsTolerance(TPA, 7838641, MSX1, MSY1, MSX2, MSY2, 15);
ATPA := TPAToATPAEx(TPA, srl_Molly_DoorW, srl_Molly_DoorH);

SortATPASize(ATPA, True);
SortATPAFromFirstPoint(ATPA, Point(MSCX + (SortBy * Round(M_DefaultHeight * srl_Molly_HeightF)), MSCY - 15));

h := High(ATPA);
for ii := 0 to h do
if MiddleTPAEx(ATPA[ii], DP.X, DP.Y) then
begin
if InRange(GetArrayLength(ATPA[II]),
srl_Molly_DoorMin,
srl_Molly_DoorMax) then
Begin
MMouse(DP.X, DP.Y, 4, 4);
Wait(300 + Random(400));
if WaitUpText('oor', srl_MaxWaitTime) then
begin
Result := True;
GetMousePos(DP.X, DP.Y);
Exit;
end;
end;
end;
SetColorspeed2Modifiers(0.2, 0.2);
end;

{*******************************************************************************
Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean
by: Naum
Description: Finds the position of the crosshair in the TBox 'Inn'
*******************************************************************************}

Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean;
Var TPA : TPointArray;
Begin //Finds cross colors
If Not LoggedIn Then Exit;
FindColorsTolerance(TPA, M_CrossColor, Inn.x1, Inn.y1, Inn.x2, Inn.y2, M_CrossTol)
If FullDebug Then
WriteLn('Length of Cross Count = '+IntToStr(Length(TPA)));
If Length(TPA) > 0 Then
Begin
Cross := MiddleTPA(TPA);
If FullDebug Then
WriteLn('Cross found at '+IntToStr(Cross.X)+', '+IntToStr(Cross.Y));
Result := True;
Exit;
End Else
If FullDebug Then
WriteLn('Cross not found');
End;

{*******************************************************************************
Procedure Molly_FindMS(Var Molly : TPoint);
by: Naum
Description: Finds the position of molly on the main screen
*******************************************************************************}

Procedure Molly_FindMS(Var Molly : TPoint);
Label Begining;
Var //
ATPA : T2DPointArray;
TPA : TPointArray;
I, II : Integer;
P : TPoint;
NotFound : Boolean;
AddOn : Integer;

Begin
If Not LoggedIn Then Exit;
Begining : I := 0;
SetLength(ATPA, Length(MollyColors)); //sets length the same as colors
For I := 0 To High(MollyColors) Do
FindColors(ATPA[I], MollyColors[I], MSX1, MSY1, MSX2, MSY2); //finds colors

TPA := MergeATPA(ATPA); //Merges all the seperate TPA's into one
ATPA := TPAToATPA(TPA, 20); //20 radius circles
For I := 0 To High(ATPA) Do
Begin
If FullDebug Then WriteLn('Found '+IntToStr(Length(ATPA))+' Similars.');
If Not InAbstractBox(400, 8, 503, 0, 514, 96, 500, 130, ATPA[I][0].X, ATPA[I][0].Y) Then //Removes problem points for l-brown
If GetArraylength(ATPA[I]) >= 3 Then //length check
Begin
P := MiddleTPA(ATPA[I]);
Begin
If FullDebug Then
WriteLn('Molly found at index '+IntToStr(I));
// \/ Mollys height
For II := 0 To 3 Do
If PointInBox(P, IntToBox(0, II * 30, 520, ((II + 1) * 30) + (Integer(II = 3)*10) )) Then
AddOn := M_DefaultHeight + ((II - 1) * (10 - II));

If AddOn = 52 Then
DecEx(AddOn, 6);

Molly := Point(P.x, P.y + AddOn);

If FullDebug Then
WriteLn('Molly found at '+IntToStr(Molly.X)+', '+IntToStr(Molly.Y));

If FullDebug Then
WriteLn('Mollys Height is : '+IntToStr(AddOn));
Exit;
End;
NotFound := (I >= 3);
If NotFound Then Break;
End;
End;

If NotFound Then
GoTo Begining;
End;

{*******************************************************************************
Function IsMollyOnDot(CP : TPoint) : Boolean;
by: Naum
Description: Results true if molly is standing on dot.
*******************************************************************************}

Function IsMollyOnDot(CP : TPoint) : Boolean;
Var MollysPosition : TPoint;
Begin
Molly_FindMS(MollysPosition); //If some of the points are inrange of mollys feet
Result := (PointInBox(MollysPosition, IntToBox(Cp.x - 6, Cp.y - 6, Cp.x + 6, Cp.y + 6)))
Or (InRange(iAbs(CP.X - MollysPosition.X), 0, 7) And InRange(iAbs(CP.Y - MollysPosition.Y), 0, 7));
End;

{*******************************************************************************
Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
by: Naum
Description: Turns the two points (crosshair and molly) into directions.
*******************************************************************************}

Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
Begin
Case Vertical Of //determines direction
True : If (Point1.y - Point2.y) < 0 Then
Result.Direction := _Up
Else
Result.Direction := Down;
//determines direction
False : If (Point1.x - Point2.x) > 0 Then
Result.Direction := _Left
Else
Result.Direction := _Right;
End;


M_TileWidth := 33.8; //default for sideways
If Result.Direction = Down Then M_TileWidth := 24.3; //greater width
If Result.Direction = _Up Then M_TileWidth := 17.9;

If FullDebug Then
WriteLn('Tile Width (perspective) is: '+FloatToStr(M_TileWidth));

Result.Times := Round(Distance(Point1.x, Point1.y, Point2.x, Point2.y) / M_TileWidth); //number of times to move

If FullDebug Then
If Vertical Then
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Up/Down ')
Else
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Left/Right ')
End;

{*******************************************************************************
Procedure Molly_Operate(Information : TMollyControl);
by: Naum and Wizzup
Description: Clicks a direction based on the input
*******************************************************************************}

Procedure Molly_Operate(Information : TMollyControl);
Var I : Byte;
Mark : Integer;
Begin
I := 0; //operating proc
Mark := GetSystemTime + 2800; //timeout to avoid spasms
Repeat
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Exit;
If Information.Times = 0 Then
Exit;
If IsMollyOnDot(M_CrossPoint) Or (M_CrossPoint.X = 0) Then
Exit;

Case Information.Direction Of //co-ords taken from wizzups
_Up : Mouse(RandomRange(630, 650), RandomRange(260, 275), 0, 0, True); // Up
Down : Mouse(RandomRange(627, 655), RandomRange(383, 411), 0, 0, True); // Down
_Right : Mouse(RandomRange(705, 720), RandomRange(315, 340), 0, 0, True); // Right
_Left : Mouse(RandomRange(563, 583), RandomRange(323, 341), 0, 0, True); // Left
End;

Inc(I);
Until(I >= Information.Times) Or (Mark < GetSystemTime);
End;

{*******************************************************************************
Procedure Molly_MoveCrossTo;
by: Naum
Description: Moves the crosshair to molly
*******************************************************************************}

Procedure Molly_MoveCrossTo;
Var MollyP: TPoint;
Point3 : TPoint;
Begin // gets pos of crosshair
If Not LoggedIn Then Exit;
Molly_CrosshairPos(M_CrossPoint, IntToBox(MSX1, MSY1, 515, 200));
If Not IsMollyOnDot(M_CrossPoint) Then
Begin
Molly_FindMS(MollyP); //finds molly
Point3 := Point(MollyP.x, M_CrossPoint.y); //completes the r-a triangle

Molly_Operate(Molly_PtsToCtrl(M_CrossPoint, Point3, False)); //proc
Molly_Operate(Molly_PtsToCtrl(MollyP, Point3, True)); //proc

Wait(250 + Random(30));
End;
End;


Function BMolly : Boolean;
Var TempBMP, Rubbish : Integer;
Begin
TempBMP := BitmapFromString(11, 10, 'beNptjlEOgyAQRA+H7S0K6A27iBh' +
'7CgI1RtOmxot06hpqlOR9zbyFIT1Z8WqKtys+7WXu/iDhPNsCJLgF' +
'XC2PKzgIuB1IpPbsQBiN2LcHB19nheTwjFBrf1dZh2dASHhSwei9A' +
'8GTRPW0JdhMW0GLJAFm9K4EoVar+XuBzUi3aGT4AgMZzoo=');
Result := FindBitmapToleranceIn(TempBMP, Rubbish, Rubbish, 15, 377, 104, 470, 30);
FreeBitmap(TempBMP);
End;

{*******************************************************************************
Function SolveMolly : Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

Function SolveMolly : Boolean;
Label IfNot_CivilianCaught;

Var P : TPoint;
T, Tries, MolMark, I, TX, TY : Integer;
MCaught : Boolean;
CTS : Integer;
Begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);
If InConvo Then
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown

BlondeMolly := BMolly
If BlondeMolly Then
MollyColors := GetColorsBox(33, 414, 47, 428, True);

For I := 0 To Random(7) Do
ClickContinue(True, True);

SetRun(False);
If FindMollyDoor(P, 1) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Open Door');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;

Begin
I := 0;
Repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft);
ClickContinue(True, True);
Until(I >= 5 + Random(2));
End;
Wait(1);
Begin
If FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Find Machine');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;
End;
I := 0;
While (I < 10) Do
Begin
Wait(1000 + Random(200));
Inc(I);
If GetColor(561, 221) = 6918288 Then
Break;
End;

If GetColor(561, 221) = 6918288 Then
Begin
If FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) Then
Tries := StrToInt(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)));

If Tries = 0 Then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

IfNot_CivilianCaught :
While Not (MCaught) And (T > GetSystemTime) Do
Begin
If Not LoggedIn Then Exit;
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
If IsMollyOnDot(P) Then
Begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
End;
If Tries = 0 Then
Begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
End;
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Begin
WriteLn('We got the Twin.');
MCaught := True;
Break;
End;
If FindBlackChatMessage('cent') Or FindBlackChatMessage('illian') Then
Begin
WriteLn('We Caught a Civilian.');
Dec(Tries);
MCaught := False;
Break;
End;
If FindBlackChatMessage('target!') Or FindBlackChatMessage('upposed') Then
Begin
MCaught := False;
Break;
End;
Result := (GetSystemTime > T);
End;
If Not MCaught Then GoTo IfNot_CivilianCaught;

If GetSystemTime > T Then
Begin
Result := False;
WriteLn('Could NOT find Molly!');
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
End;

If MCaught Then
Begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000);
T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;

If Not FindMollyDoor(P, -1) Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;
Result := True;

If Result Then
Begin
WriteLn('Solved Molly Random Event.');
Wait(10000);
ColorToleranceSpeed(CTS);
End;
End;
End;
End;


Old :
Const
FullDebug = True; //Debug it all?
M_DefaultHeight = 62; //Molly's Height (Used in M_FindMS)
M_CrossColor = 2438909; //The crosshair color, should be fine..
M_CrossTol = 5; //The tolerance of the cross, should be fine..


Var
MollyColors : TIntegerArray; //Variables
M_TileWidth : Extended;
M_CrossPoint : TPoint;

Type
TMollyControl = Record //Molly record.
Direction : (_Up, Down, _Right, _Left);
Times : Byte;
End;

{*******************************************************************************
Function FindMollyDoor(DP : TPoint) : Boolean;
by: Naum
Description: Opens the door in molly
*******************************************************************************}

Function FindMollyDoor(Var DP : TPoint) : Boolean;
Var
TPA : TPointArray;
ATPA : T2DPointArray;
II : Integer;
Begin
SetColorspeed2Modifiers(0.21, 0.44);
FindColorsTolerance(TPA, 7838641, MSX1, MSY1, MSX2, MSY2, 15);
ATPA := SplitTPAEx(TPA, 10, 14);

SortATPASize(ATPA, True);
SortATPAFrom(ATPA, Point(MSCX + Round(M_DefaultHeight * 2.443), MSCY));

For II := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[II], DP.X, DP.Y) Then
Begin
If InRange(GetArrayLength(ATPA[II]), 15, 1 Shl 20) Then
Begin
MMouse(DP.X, DP.Y, 4, 4);
Wait(300 + Random(400));
If WaitUpText('oor', 360) Then
Begin
Result := True;
GetMousePos(DP.X, DP.Y);
Exit;
End;
End;
End;
SetColorspeed2Modifiers(0.2, 0.2);
End;

{*******************************************************************************
Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean
by: Naum
Description: Finds the position of the crosshair in the TBox 'Inn'
*******************************************************************************}

Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean;
Var TPA : TPointArray;
Begin //Finds cross colors
FindColorsTolerance(TPA, M_CrossColor, Inn.x1, Inn.y1, Inn.x2, Inn.y2, M_CrossTol)
If FullDebug Then
WriteLn('Length of Cross Count = '+IntToStr(Length(TPA)));
If Length(TPA) > 0 Then
Begin
Cross := MiddleTPA(TPA);
If FullDebug Then
WriteLn('Cross found at '+IntToStr(Cross.X)+', '+IntToStr(Cross.Y));
Result := True;
Exit;
End Else
If FullDebug Then
WriteLn('Cross not found');
End;

{*******************************************************************************
Procedure Molly_FindMS(Var Molly : TPoint);
by: Naum
Description: Finds the position of molly on the main screen
*******************************************************************************}

Procedure Molly_FindMS(Var Molly : TPoint);
Label Begining;
Var //
ATPA : T2DPointArray;
TPA : TPointArray;
I, II : Integer;
P : TPoint;
NotFound : Boolean;
AddOn : Integer;

Begin
Begining : I := 0;
SetLength(ATPA, Length(MollyColors)); //sets length the same as colors
For I := 0 To High(MollyColors) Do
FindColors(ATPA[I], MollyColors[I], MSX1, MSY1, MSX2, MSY2); //finds colors

TPA := MergeATPA(ATPA); //Merges all the seperate TPA's into one
ATPA := TPAToATPA(TPA, 20); //20 radius circles
For I := 0 To High(ATPA) Do
Begin
If FullDebug Then WriteLn('Found '+IntToStr(Length(ATPA))+' Similars.');
If Not InAbstractBox(400, 8, 503, 0, 514, 96, 500, 130, ATPA[I][0].X, ATPA[I][0].Y) Then //Removes problem points for l-brown
If GetArraylength(ATPA[I]) >= 3 Then //length check
Begin
P := MiddleTPA(ATPA[I]);
Begin
If FullDebug Then
WriteLn('Molly found at index '+IntToStr(I));
// \/ Mollys height
For II := 0 To 3 Do
If PointInBox(P, IntToBox(0, II * 30, 520, ((II + 1) * 30) + (Integer(II = 3)*10) )) Then
AddOn := M_DefaultHeight + ((II - 1) * (10 - II));

If AddOn = 52 Then
DecEx(AddOn, 6);

Molly := Point(P.x, P.y + AddOn);

If FullDebug Then
WriteLn('Molly found at '+IntToStr(Molly.X)+', '+IntToStr(Molly.Y));

If FullDebug Then
WriteLn('Mollys Height is : '+IntToStr(AddOn));
Exit;
End;
NotFound := (I >= 3);
If NotFound Then Break;
End;
End;

If NotFound Then
GoTo Begining;
End;

{*******************************************************************************
Function IsMollyOnDot(CP : TPoint) : Boolean;
by: Naum
Description: Results true if molly is standing on dot.
*******************************************************************************}

Function IsMollyOnDot(CP : TPoint) : Boolean;
Var MollysPosition : TPoint;
Begin
Molly_FindMS(MollysPosition); //If some of the points are inrange of mollys feet
Result := (PointInBox(MollysPosition, IntToBox(Cp.x - 6, Cp.y - 6, Cp.x + 6, Cp.y + 6)))
Or (InRange(iAbs(CP.X - MollysPosition.X), 0, 7) And InRange(iAbs(CP.Y - MollysPosition.Y), 0, 7));
End;

{*******************************************************************************
Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
by: Naum
Description: Turns the two points (crosshair and molly) into directions.
*******************************************************************************}

Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
Begin
Case Vertical Of //determines direction
True : If (Point1.y - Point2.y) < 0 Then
Result.Direction := _Up
Else
Result.Direction := Down;
//determines direction
False : If (Point1.x - Point2.x) > 0 Then
Result.Direction := _Left
Else
Result.Direction := _Right;
End;


M_TileWidth := 33.8; //default for sideways
If Result.Direction = Down Then M_TileWidth := 24.3; //greater width
If Result.Direction = _Up Then M_TileWidth := 17.9;

If FullDebug Then
WriteLn('Tile Width (perspective) is: '+FloatToStr(M_TileWidth));

Result.Times := Round(Distance(Point1.x, Point1.y, Point2.x, Point2.y) / M_TileWidth); //number of times to move

If FullDebug Then
If Vertical Then
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Up/Down ')
Else
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Left/Right ')
End;

{*******************************************************************************
Procedure Molly_Operate(Information : TMollyControl);
by: Naum and Wizzup
Description: Clicks a direction based on the input
*******************************************************************************}

Procedure Molly_Operate(Information : TMollyControl);
Var I : Byte;
Mark : Integer;
Begin
I := 0; //operating proc
Mark := GetSystemTime + 2800; //timeout to avoid spasms
Repeat
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Exit;
If Information.Times = 0 Then
Exit;
If IsMollyOnDot(M_CrossPoint) Or (M_CrossPoint.X = 0) Then
Exit;

Case Information.Direction Of //co-ords taken from wizzups
_Up : Mouse(RandomRange(630, 650), RandomRange(260, 275), 0, 0, True); // Up
Down : Mouse(RandomRange(627, 655), RandomRange(383, 411), 0, 0, True); // Down
_Right : Mouse(RandomRange(705, 720), RandomRange(315, 340), 0, 0, True); // Right
_Left : Mouse(RandomRange(563, 583), RandomRange(323, 341), 0, 0, True); // Left
End;

Inc(I);
Until(I >= Information.Times) Or (Mark < GetSystemTime);
End;

{*******************************************************************************
Procedure Molly_MoveCrossTo;
by: Naum
Description: Moves the crosshair to molly
*******************************************************************************}

Procedure Molly_MoveCrossTo;
Var MollyP: TPoint;
Point3 : TPoint;
Begin // gets pos of crosshair
Molly_CrosshairPos(M_CrossPoint, IntToBox(MSX1, MSY1, 515, 200));
If Not IsMollyOnDot(M_CrossPoint) Then
Begin
Molly_FindMS(MollyP); //finds molly
Point3 := Point(MollyP.x, M_CrossPoint.y); //completes the r-a triangle

Molly_Operate(Molly_PtsToCtrl(M_CrossPoint, Point3, False)); //proc
Molly_Operate(Molly_PtsToCtrl(MollyP, Point3, True)); //proc

Wait(250 + Random(30));
End;
End;

{*******************************************************************************
Function SolveMolly : Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

Function SolveMolly : Boolean;
Label IfNot_CivilianCaught;

Var P : TPoint;
T, Tries, MolMark, I, TX, TY : Integer;
MCaught : Boolean;
CTS : Integer;
Begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);
If InConvo Then
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown

For I := 0 To Random(7) Do
ClickContinue(True, True);

SetRun(False);
If FindMollyDoor(P) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Open Door');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;

Begin
I := 0;
Repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft);
ClickContinue(True, True);
Until(I >= 8 + Random(2));
End;
Wait(1);
Begin
If FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Find Machine');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;
End;
I := 0;
While (I < 10) Do
Begin
Wait(1000 + Random(200));
Inc(I);
If GetColor(561, 221) = 6918288 Then
Break;
End;

If GetColor(561, 221) = 6918288 Then
Begin
If FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) Then
Tries := StrToInt(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)));

If Tries = 0 Then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

IfNot_CivilianCaught :
While Not (MCaught) And (T > GetSystemTime) Do
Begin
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
If IsMollyOnDot(P) Then
Begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
End;
If Tries = 0 Then
Begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
End;
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Begin
WriteLn('We got the Twin.');
MCaught := True;
Break;
End;
If FindBlackChatMessage('cent') Or FindBlackChatMessage('illian') Then
Begin
WriteLn('We Caught a Civilian.');
Dec(Tries);
MCaught := False;
Break;
End;
If FindBlackChatMessage('target!') Or FindBlackChatMessage('upposed') Then
Begin
MCaught := False;
Break;
End;
Result := (GetSystemTime > T);
End;
If Not MCaught Then GoTo IfNot_CivilianCaught;

If GetSystemTime > T Then
Begin
Result := False;
WriteLn('Could NOT find Molly!');
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
End;

If MCaught Then
Begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000);
T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;

If Not FindMollyDoor(P) Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;
Result := True;

If Result Then
Begin
WriteLn('Solved Molly Random Event.');
Wait(10000);
ColorToleranceSpeed(CTS);
End;
End;
End;
End;

^ That's it, I've tried to use as many constants as possible and tried to make as most efficient as I could.

Current Bugs
  • Rarely, it might spaz off and do its own thing. Goes back on track though (this is because of the screen's tilt, however).
  • Only been tested ''extensively'' with 3/5 hair colors
  • Around about 90% 'ish' success rate

Since I like writing tutorials, I'll write a small one on how it works:


The Solver Theory

    The solver finds molly's hair colour and stores its middle tpa (co-ordinate) as 'MollyPoint'.
  • The solver finds the crosshair on the ground and stores its middle tpa (co-ordinate) as 'CrossPoint'.
  • The solver then makes a right angle triangle by using that information and making a third point 'Point3'. This is basically MollyPoint's x coordinate and CrossPoint's y coordinate.
  • It then divides the distances between them by the tile width, respectively.
  • Using the previous information is converts this information into control usage. I 'think' this was how the last solver worked(?)

Graphical representation:



If anyone has any problems, just post.
I would appreciate testing and bug reports :), so I can fix it up.

Thanks everyone!

Gu3st...

2009-12-12 07:47:22

Great piece of work right there :)
Good job, Naum, as usual! ;D

marpis

2009-12-12 08:02:29

From: Naum
This is basically MollyPoint's x coordinate and CrossPoint's y coordinate.


The other way round!

~~

Great job man, can't wait till I get a mollyevent to try this out! :)

wesleyxD

2009-12-12 08:21:33

awesome

noidea

2009-12-12 09:32:20

Math! I massive applause for NaumanAkhlaQ!

Baked0420

2009-12-12 09:42:42

nice naum, I see you making random coding in the includes more efficient all the time, I bet this is about as efficient as it can get.

But when you said, "The solver then makes a right angle triangle by using that information and making a third point 'Point3'. This is basically CrossPoint's x coordinate and MollyPoint's y coordinate"

I think you have it mixed up, I think it's Molly's X-Coord. Since Y-coords go up and down, and molly is above Point3, so they don't share the same y-coord, but they are even from the left of the screen, making them share the same x-coord. So Point3 must be (Molly.x, CrossPoint.y), unless I understood something wrong.

Naum

2009-12-12 10:18:35

From: Baked0420
nice naum, I see you making random coding in the includes more efficient all the time, I bet this is about as efficient as it can get.

But when you said, "The solver then makes a right angle triangle by using that information and making a third point 'Point3'. This is basically CrossPoint's x coordinate and MollyPoint's y coordinate"

I think you have it mixed up, I think it's Molly's X-Coord. Since Y-coords go up and down, and molly is above Point3, so they don't share the same y-coord, but they are even from the left of the screen, making them share the same x-coord. So Point3 must be (Molly.x, CrossPoint.y), unless I understood something wrong.


Yeah, thanks.

Lol about the second part. I had it right before in the text before the edit, the picture's just wrong. Will change it, soon… :p

Thanks for all the other comments. I have an account in molly if you would like to test (provided by the sexy yohojo) :D

Bionicle

2009-12-12 10:24:35

WOW.
I haven't seen any work on randoms at all…and now three randoms are fixed! (one only in the beta stage, but still!)
Great job! I'm glad to see the people taking the initiative to wright these randoms, it is a sure sign that SRL is slowly getting back in it's feet!

Heavenguard

2009-12-12 10:29:05

Nice job dude !!!! Omg your more of a master now, master lv 2 >.>

mastaraymond

2009-12-12 10:31:12

Looks nice!

Just one question; When I attempted to make a solver I ran into the issue that the hair color of my Molly was the same color as the ground.. How did you fix that?

Baked0420

2009-12-12 10:34:56

From: Naum
Yeah, thanks.

Lol about the second part. I had it right before in the text before the edit, the picture's just wrong. Will change it, soon… :p

Thanks for all the other comments. I have an account in molly if you would like to test (provided by the sexy yohojo) :D


no problem, when I read it I was just like, wait what? lol

I think I see a random solver cup coming :p and I'd put money down that you'd be the next new dev

Naum

2009-12-12 10:39:42

From: mastaraymond
Looks nice!

Just one question; When I attempted to make a solver I ran into the issue that the hair color of my Molly was the same color as the ground.. How did you fix that?


Hmm, the only problems I encountered were hair colours which put one or two points on the wall, I got rid of these by doing a length check. The main problem was with the brown hair colour - as that would put some points on the brown wall tiles. I solved this (pretty cheap, I know :p), by using InAbstractBox to remove them.
However, the reason, I think, that I didn't find many points on the ground would be due to the fact that I used GetColorsBox to grab a small portion of the hair and grabbed the unique ones (ClearSameIntegers). And that, I did not use any tolerance, this (using tolerance) tended to muck up the finding.

Thanks for the compliment, it means so much coming from a coder of your standard :).

Method

2009-12-12 10:46:08

Looks pretty good, Naum. Nice job on it. :)

Wizzup?

2009-12-12 10:56:32

From: mastaraymond
Looks nice!

Just one question; When I attempted to make a solver I ran into the issue that the hair color of my Molly was the same color as the ground.. How did you fix that?


I already wrote a function in my old solver that would pick hair colours when you talked to Molly. ;)

Wanted

2009-12-12 11:34:49

I've tested this personally, good work naum.

/Me hands you

Coh3n

2009-12-12 12:44:12

Meh, it's okay I guess. JK, it's awesome, <3 you.

Correct me if I'm wrong, but it's it slightly more efficient to use an if..then..else statement instead of code like this?

Case Vertical Of //determines direction
True : If (Point1.y - Point2.y) < 0 Then
Result.Direction := _Up
Else
Result.Direction := Down;
//determines direction
False : If (Point1.x - Point2.x) > 0 Then
Result.Direction := _Left
Else
Result.Direction := _Right;
End;

NCDS

2009-12-12 15:54:27

Glad to see you finally release this man, Look's good :)

YoHoJo

2009-12-12 17:15:47

Naum, the autocolor for the door is still off. Mouse moves along the north wall, and then eventually to the door.
Also, after clicking the door, the whole thing just lags to hell, and dies.
:/ I know it works, ive tested it for you! Keep on tweaking!

SRL Compiled in 16 msec
***** STR: FOUND RANDOM: 'Molly's Evil Twin' *****
We seem to be in the molly random
Found 17 hair colors.


Frozen/Lag after that.

Wanted

2009-12-12 17:23:12

Lol the door fails, I forgot to tell u I made my own, ill post it here soon

Gu3st...

2009-12-12 17:32:55

From: Coh3n
Meh, it's okay I guess. JK, it's awesome, <3 you.

Correct me if I'm wrong, but it's it slightly more efficient to use an if..then..else statement instead of code like this?

Case Vertical Of //determines direction
True : If (Point1.y - Point2.y) < 0 Then
Result.Direction := _Up
Else
Result.Direction := Down;
//determines direction
False : If (Point1.x - Point2.x) > 0 Then
Result.Direction := _Left
Else
Result.Direction := _Right;
End;
var
X, T, Y, T1, T2, TW : Integer;

const
Bool = True;

begin
for Y := 0 to 99 do
begin
T := GetSystemTime;
for X := 0 to 9999 do
if Bool then
begin end else
begin end;
T1 := GetSystemTime-T;
T := GetSystemTime;
for X := 0 to 9999 do
case Bool of
True: begin end;
False: begin end;
end;
T2 := GetSystemTime-T;
if T1 > T2 then Inc(TW);
end;
WriteLn(IntToStr(TW));
end.
Try running the script, the result will vary but what scar writes in the debug box is how many times case…of is faster than if…else

With Bool set to true my result was an average of 18, but with the Bool set to false it was at 9. Therefore, if..then is faster.

TRiLeZ

2009-12-12 17:36:04

Very nice! I guess I can stop working on my molly solver.

People are saying that the open door function isn't working so I'll mod your function with my color and hue + sat.



{*******************************************************************************
Function FindMollyDoor(DP : TPoint) : Boolean;
by: Naum
Description: Opens the door in molly
*******************************************************************************}

Function FindMollyDoor(Var DP : TPoint) : Boolean;
Var
TPA : TPointArray;
ATPA : T2DPointArray;
II : Integer;
Begin
SetColorspeed2Modifiers(0.04, 0.32);
FindColorsTolerance(TPA, 6588057, MSX1, MSY1, MSX2, MSY2, 10);
ATPA := SplitTPAEx(TPA, 10, 14);

SortATPASize(ATPA, True);
SortATPAFrom(ATPA, Point(MSCX + Round(M_DefaultHeight * 2.443), MSCY));

For II := 0 To High(ATPA) Do
If MiddleTPAEx(ATPA[II], DP.X, DP.Y) Then
Begin
If InRange(GetArrayLength(ATPA[II]), 15, 1 Shl 20) Then
Begin
MMouse(DP.X, DP.Y, 4, 4);
Wait(300 + Random(400));
If WaitUpText('oor', 360) Then
Begin
Result := True;
GetMousePos(DP.X, DP.Y);
Exit;
End;
End;
End;
SetColorspeed2Modifiers(0.2, 0.2);
End;

I take pictures of all randoms that I get and I tested my colors with the pics and they only get the door. :D

I'll test next time I get a molly random.

Nava2

2009-12-12 17:42:53

Great explaination, your code has greatly improved. I will edit this next time I take a study break, fix up a few things to make it faster.

Looks awesome, my friend. Well done.

Oh, and I am willing to commit it once I see some proofs. :)

Naum

2009-12-13 04:03:36

From: YoHoJo
Naum, the autocolor for the door is still off. Mouse moves along the north wall, and then eventually to the door.
Also, after clicking the door, the whole thing just lags to hell, and dies.
:/ I know it works, ive tested it for you! Keep on tweaking!

Frozen/Lag after that.


Your running the old solver :p. But thanks for testing :)

From: IceFire908
Lol the door fails, I forgot to tell u I made my own, ill post it here soon


Above ^

From: TRiLeZ
Very nice! I guess I can stop working on my molly solver.

People are saying that the open door function isn't working so I'll mod your function with my color and hue + sat.

-snip-

I take pictures of all randoms that I get and I tested my colors with the pics and they only get the door. :D

I'll test next time I get a molly random.


Thanks for the revamped one, but frankly the door opener should work 100%. I just had YoHoJo to test it for me:

YoHoJo says:
loll
it owrks ;/


Turns out, using MSN and PasteBin, he wasn't using my one. I would love if you could test :D


From: Nava2
Great explaination, your code has greatly improved. I will edit this next time I take a study break, fix up a few things to make it faster.

Looks awesome, my friend. Well done.

Oh, and I am willing to commit it once I see some proofs. :)


Thanks man :). I'll get some time today and put up a tweaked version, which means getting rid off some long waits.
<3 everyone who tested.

Wanted

2009-12-13 11:58:27

{*******************************************************************************
function FindMollyDoor(P: TPoint): Boolean;
by: IceFire908
Description: Opens the door between the control room and first twin.
*******************************************************************************}

function FindMollyDoor(P: TPoint): Boolean;
var
TPAA: T2DPointArray;
TPA: TPointArray;
I, CTS: LongInt;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.46);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 6260123, MSX1, MSY1, MSX2, MSY2, 10);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
TPAA := TPAToATPAEx(TPA, 10, 40);
SortATPASize(TPAA, True);
for I := 0 to High(TPAA) do
begin
P := MiddleTPA(TPAA[I]);
MMouse(P.X, P.Y, 3, 3);
Wait(200 + Random(50));
if (IsUpTextMultiCustom(['oor', 'pen'])) then
begin
Result := True;
GetMousePos(P.X, P.Y);
Exit;
end;
end;
end;

Town

2009-12-13 18:17:06

/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
| SRL 38 Randoms Report |
| [url]www.villavu.com[/url] |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| SRL Logs : 61 |
| Molly's Missed : 6 |

It needs to change Players[].Active and Players[].Loc on failure.

Wanted

2009-12-13 19:23:40

From: Town
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
| SRL 38 Randoms Report |
| [url]www.villavu.com[/url] |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| SRL Logs : 61 |
| Molly's Missed : 6 |

It needs to change Players[].Active and Players[].Loc on failure.


Did you change antirandoms.scar where it says under molly stuff under loadtelerandoms

SolveRandom nil to Solve random @SolveMolly; ?

Town

2009-12-13 22:31:47

I hadn't, so this comment obviously isn't related to this thread. It seems as if SolveTeleportRandoms is not made to support any TeleRandoms with both IsInRandom and SolveRandom set as nil, though.

Wanted

2009-12-14 00:50:01

From: Town
I hadn't, so this comment obviously isn't related to this thread. It seems as if SolveTeleportRandoms is not made to support any TeleRandoms with both IsInRandom and SolveRandom set as nil, though.


Nope, some of the IsInRandoms are supposed to be nil

Sir R. M8gic1an

2009-12-14 01:33:50

On Zeph's confirmation that this works…. i hand you :)

~RM

YoHoJo

2009-12-14 02:37:19

Woo woo naum! <3!

Nava2

2009-12-14 06:12:13

Would you mind commenting in the code itself?

{*******************************************************************************
Function SolveMolly : Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

Function SolveMolly : Boolean;
Label IfNot_CivilianCaught;

Var P : TPoint;
T, Tries, MolMark, I, TX, TY : Integer;
MCaught : Boolean;
CTS : Integer;
Begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);
If InConvo Then
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown

For I := 0 To Random(7) Do
ClickContinue(True, True);

SetRun(False);
If FindMollyDoor(P) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Open Door');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;

Begin
I := 0;
Repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft);
ClickContinue(True, True);
Until(I >= 8 + Random(2));
End;
Wait(1);
Begin
If FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Find Machine');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;
End;
I := 0;
While (I < 10) Do
Begin
Wait(1000 + Random(200));
Inc(I);
If GetColor(561, 221) = 6918288 Then
Break;
End;

If GetColor(561, 221) = 6918288 Then
Begin
If FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) Then
Tries := StrToInt(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)));

If Tries = 0 Then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

IfNot_CivilianCaught :
While Not (MCaught) And (T > GetSystemTime) Do
Begin
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
If IsMollyOnDot(P) Then
Begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
End;
If Tries = 0 Then
Begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
End;
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Begin
WriteLn('We got the Twin.');
MCaught := True;
Break;
End;
If FindBlackChatMessage('cent') Or FindBlackChatMessage('illian') Then
Begin
WriteLn('We Caught a Civilian.');
Dec(Tries);
MCaught := False;
Break;
End;
If FindBlackChatMessage('target!') Or FindBlackChatMessage('upposed') Then
Begin
MCaught := False;
Break;
End;
Result := (GetSystemTime > T);
End;
If Not MCaught Then GoTo IfNot_CivilianCaught;

If GetSystemTime > T Then
Begin
Result := False;
WriteLn('Could NOT find Molly!');
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
End;

If MCaught Then
Begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000);
T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;

If Not FindMollyDoor(P) Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;
Result := True;

If Result Then
Begin
WriteLn('Solved Molly Random Event.');
Wait(10000);
ColorToleranceSpeed(CTS);
End;
End;
End;
End;

Big wall of no comments ;)

Also, that could probably be broken down into a few functions for clarities sake.

Naum

2009-12-14 06:16:40

From: Nava2
Would you mind commenting in the code itself?

{*******************************************************************************
Function SolveMolly : Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

Function SolveMolly : Boolean;
Label IfNot_CivilianCaught;

Var P : TPoint;
T, Tries, MolMark, I, TX, TY : Integer;
MCaught : Boolean;
CTS : Integer;
Begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);
If InConvo Then
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown

For I := 0 To Random(7) Do
ClickContinue(True, True);

SetRun(False);
If FindMollyDoor(P) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Open Door');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;

Begin
I := 0;
Repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft);
ClickContinue(True, True);
Until(I >= 8 + Random(2));
End;
Wait(1);
Begin
If FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Find Machine');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;
End;
I := 0;
While (I < 10) Do
Begin
Wait(1000 + Random(200));
Inc(I);
If GetColor(561, 221) = 6918288 Then
Break;
End;

If GetColor(561, 221) = 6918288 Then
Begin
If FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) Then
Tries := StrToInt(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)));

If Tries = 0 Then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

IfNot_CivilianCaught :
While Not (MCaught) And (T > GetSystemTime) Do
Begin
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
If IsMollyOnDot(P) Then
Begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
End;
If Tries = 0 Then
Begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
End;
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Begin
WriteLn('We got the Twin.');
MCaught := True;
Break;
End;
If FindBlackChatMessage('cent') Or FindBlackChatMessage('illian') Then
Begin
WriteLn('We Caught a Civilian.');
Dec(Tries);
MCaught := False;
Break;
End;
If FindBlackChatMessage('target!') Or FindBlackChatMessage('upposed') Then
Begin
MCaught := False;
Break;
End;
Result := (GetSystemTime > T);
End;
If Not MCaught Then GoTo IfNot_CivilianCaught;

If GetSystemTime > T Then
Begin
Result := False;
WriteLn('Could NOT find Molly!');
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
End;

If MCaught Then
Begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000);
T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;

If Not FindMollyDoor(P) Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;
Result := True;

If Result Then
Begin
WriteLn('Solved Molly Random Event.');
Wait(10000);
ColorToleranceSpeed(CTS);
End;
End;
End;
End;

Big wall of no comments ;)

Also, that could probably be broken down into a few functions for clarities sake.



The lovely tarajunky lent me an account, so I'm gonna tweak it loads anyway :). I'll get the commenting done as well, most of it was taken from the old molly solver.
Bear with, I'll edit this post when I'm done :).

Nava2

2009-12-14 07:53:43

const
FullDebug = True; //Debug it all?
M_DefaultHeight = 62; //Molly's Height (Used in M_FindMS)
M_CrossColor = 2438909; //The crosshair color, should be fine..
M_CrossTol = 5; //The tolerance of the cross, should be fine..


var
MollyColors : TIntegerArray; //Variables
M_TileWidth : Extended;
M_CrossPoint : TPoint;

type
TMollyControl = record //Molly record.
Direction : (_Up, _Down, _Right, _Left);
Times : Byte;
end;

{*******************************************************************************
Function FindMollyDoor(DP : TPoint) : Boolean;
by: Naum
Description: Opens the door in molly
*******************************************************************************}

const
srl_Molly_DoorMin = 15;
srl_Molly_DoorMax = 1 shl 20;
srl_Molly_DoorW = 10;
srl_Molly_DoorH = 14;
srl_Molly_HeightF = 2.443;

function FindMollyDoor(var DP : TPoint) : Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
ii, h : Integer;
begin
{ To be replaced with global TAutoColorInfo array. }
SetColorspeed2Modifiers(0.21, 0.44);
FindColorsTolerance(TPA, 7838641, MSX1, MSY1, MSX2, MSY2, 15);
ATPA := SplitTPAEx(TPA, srl_Molly_DoorW, srl_Molly_DoorH);

SortATPASize(ATPA, True);
SortATPAFrom(ATPA, Point(MSCX + Round(M_DefaultHeight * 2.443), MSCY));

h := High(ATPA);
for ii := 0 to High(h) do
if MiddleTPAEx(ATPA[ii], DP.X, DP.Y) then
begin
if InRange(GetArrayLength(ATPA[II]),
srl_Molly_DoorMin,
srl_Molly_DoorMax) then
Begin
MMouse(DP.X, DP.Y, 4, 4);
Wait(300 + Random(400));
if WaitUpText('oor', srl_MaxWaitTime) then
begin
Result := True;
GetMousePos(DP.X, DP.Y);
Exit;
end;
end;
end;
SetColorspeed2Modifiers(0.2, 0.2);
end;

{*******************************************************************************
Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean
by: Naum
Description: Finds the position of the crosshair in the TBox 'Inn'
*******************************************************************************}

function Molly_CrosshairPos(var Cross: TPoint; Inn: TBox): Boolean;
var
TPA: TPointArray;
begin //Finds cross colors
FindColorsTolerance(TPA, M_CrossColor, Inn.x1, Inn.y1, Inn.x2, Inn.y2, M_CrossTol)
if FullDebug then
WriteLn('Length of Cross Count = '+IntToStr(Length(TPA)));
if (Length(TPA) > 0) then
begin
Cross := MiddleTPA(TPA);
if FullDebug then
WriteLn('Cross found at '+IntToStr(Cross.X)+', '+IntToStr(Cross.Y));
Result := True;
Exit;
end else
if FullDebug then
WriteLn('Cross not found');
end;

{*******************************************************************************
Procedure Molly_FindMS(Var Molly : TPoint);
by: Naum
Description: Finds the position of molly on the main screen
*******************************************************************************}

procedure Molly_FindMS(var Molly : TPoint);
label Begining;
var //
ATPA: T2DPointArray;
TPA: TPointArray;
I, II, h: Integer;
P: TPoint;
NotFound: Boolean;
AddOn: Integer;
begin
Begining : I := 0;
h := High(MollyColors);
SetLength(ATPA, h + 1); //sets length the same as colors
for I := 0 to h do
FindColors(ATPA[I], MollyColors[I], MSX1, MSY1, MSX2, MSY2); //finds colors

TPA := MergeATPA(ATPA); //Merges all the seperate TPA's into one
ATPA := TPAToATPA(TPA, 20); //20 radius circles

for I := 0 To High(ATPA) Do
begin
if FullDebug then
WriteLn('Found '+IntToStr(Length(ATPA))+' Similars.');
{ Filter out points not valid. }
if (not InAbstractBox(400, 8, 503, 0, 514, 96, 500, 130,
ATPA[I][0].X, ATPA[I][0].Y)) then
if (GetArraylength(ATPA[I]) >= 3) then
begin
P := MiddleTPA(ATPA[I]);
begin
if FullDebug then
WriteLn('Molly found at index '+IntToStr(I));

for II := 0 to 3 do
{ EXPLAIN THIS }
if PointInBox(P, IntToBox(0, II * 30, 520,
((II + 1) * 30) + (Integer(II = 3) * 10)))
then
AddOn := M_DefaultHeight + ((II - 1) * (10 - II));

if (AddOn = 52) then
DecEx(AddOn, 6);

Molly := Point(P.x, P.y + AddOn);

if FullDebug then
WriteLn('Molly found at '+IntToStr(Molly.X)+', '+IntToStr(Molly.Y));

if FullDebug then
WriteLn('Mollys Height is : '+IntToStr(AddOn));
Exit;
end;
NotFound := (I >= 3);
if NotFound then Break;
end;
end;

if NotFound then
goto Begining; // should use a loop instead.
end;

{*******************************************************************************
Function IsMollyOnDot(CP : TPoint) : Boolean;
by: Naum
Description: Results true if molly is standing on dot.
*******************************************************************************}

function IsMollyOnDot(CP : TPoint) : Boolean;
var
MollysPosition: TPoint;
begin
Molly_FindMS(MollysPosition); //If some of the points are inrange of mollys feet
Result := (PointInBox(MollysPosition,
IntToBox(Cp.x - 6, Cp.y - 6, Cp.x + 6, Cp.y + 6))) or
(InRange(iAbs(CP.X - MollysPosition.X), 0, 7) and
InRange(iAbs(CP.Y - MollysPosition.Y), 0, 7));
end;

{*******************************************************************************
Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
by: Naum
Description: Turns the two points (crosshair and molly) into directions.
*******************************************************************************}

function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean): TMollyControl;
begin
{ Determine the direction }
if (Vertical) then
begin
if ((Point1.y - Point2.y) < 0) then
Result.Direction := _Up
else
Result.Direction := _Down;
end else
begin
if (Point1.x - Point2.x) > 0 then
Result.Direction := _Left
else
Result.Direction := _Right;
end;

M_TileWidth := 33.8; //default for sideways
if (Result.Direction = _Down) then
M_TileWidth := 24.3; //greater width
if (Result.Direction = _Up) then
M_TileWidth := 17.9;

if (FullDebug) then
WriteLn('Tile Width (perspective) is: '+FloatToStr(M_TileWidth));

Result.Times := Round(Distance(Point1.x, Point1.y, Point2.x, Point2.y) / M_TileWidth); //number of times to move

if FullDebug then
if Vertical then
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Up/Down ')
else
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Left/Right ');
end;

{*******************************************************************************
Procedure Molly_Operate(Information : TMollyControl);
by: Naum
Description: Clicks a direction based on the input
*******************************************************************************}

procedure Molly_Operate(Information : TMollyControl);
var
I: Byte;
Mark: Integer;
curChat: String;
ValChats: TStringArray;
begin
I := 0; //operating proc
Mark := GetSystemTime + 2800; //timeout to avoid spasms
valChats := ['win', 'Evil'];
repeat
if (ArrInStr(valChats, GetChatBoxText(8, clMessage)) or
ClickContinue(False, False)) or
(Information.Times = 0) or
(IsMollyOnDot(M_CrossPoint) Or (M_CrossPoint.X = 0))
then
Exit;

{ Click the joy stick }
case Information.Direction of //co-ords taken from wizzups
_Up : Mouse(RandomRange(630, 650), RandomRange(260, 275), 0, 0, True);
_Down : Mouse(RandomRange(627, 655), RandomRange(383, 411), 0, 0, True);
_Right : Mouse(RandomRange(705, 720), RandomRange(315, 340), 0, 0, True);
_Left : Mouse(RandomRange(563, 583), RandomRange(323, 341), 0, 0, True);
end;

Inc(I);
until((I >= Information.Times) or (Mark < GetSystemTime));
end;

{*******************************************************************************
Procedure Molly_MoveCrossTo;
by: Naum
Description: Moves the crosshair to molly
*******************************************************************************}

procedure Molly_MoveCrossTo;
var
MollyP: TPoint;
Point3: TPoint;
begin // gets pos of crosshair
Molly_CrosshairPos(M_CrossPoint, IntToBox(MSX1, MSY1, 515, 200));
if (not IsMollyOnDot(M_CrossPoint)) then
begin
Molly_FindMS(MollyP); //finds molly
Point3 := Point(MollyP.x, M_CrossPoint.y); //completes the r-a triangle

Molly_Operate(Molly_PtsToCtrl(M_CrossPoint, Point3, False)); //proc
Molly_Operate(Molly_PtsToCtrl(MollyP, Point3, True)); //proc

Wait(250 + Random(30));
end;
end;

{*******************************************************************************
Procedure Molly_FilterColors;
by: Nava2
Description: Filters the found MollyHair colours removing the background and
complexion noise.
*******************************************************************************}
{
Molly Filter Noise Arrays:
Background:
[10798549, 10274005, 10469330, 10206670, 10601943, 10995674, 9284540,
9021369, 10864599];
Complexion:
[6983885, 7311804, 7577290, 5668010, 7905744, 6258597, 5668010, 7312056];
}

procedure Molly_FilterColors;
var
i, h, j, k, kF, newColCounter: Integer;
minR, maxR, minG, maxG, minB, maxB: Integer;
RGB: TIntegerArray;
newCols: TIntegerArray;
minMaxArr: T2DIntegerArray;
badCol: Boolean;
begin
{ Create the new array, as well setup the vars. }
ClearSameIntegers(MollyColors);
h := High(MollyColors);
SetLength(newCols, h + 1);
SetLength(RGB, 3);
{ RGB Values: miR, maR, miG, maG, miB, maB }
minMaxArr := [TIntegerArray(185, 218, 167, 199, 137, 167), { Background. }
TIntegerArray(165, 208, 124, 161, 86, 120)]; { Complexion. }
filterColLength := high(minMaxArr);
newColCounter := 0;

for i := 0 to h do
begin
ColorToRGB(MollyColor[i], RGB[0], RGB[1], RGB[2]);
{
Sort through the different filter colours, if the colour is represented by
one of the filter colours, it will not be added.
}
for j := 0 to filterColLength do
begin
for k := 0 to 2 do
begin
kF := k shl 1;
if (not InRange(RGB[k], minMaxArr[j][kF], minMaxArr[j][kF + 1])) then
begin
badCol := True;
Break;
end;
if (badCol) then Break;
end;
end;
if (badCol) then
begin
badCol := False;
Continue;
end;

{ Add the new colour if it passes. }
newCols[newColCounter] := MollyColor[i];
inc(newColCounter);
badCol:
end;
setLength(newCols, c);
MollyColors := newCols;
end;

{*******************************************************************************
function SolveMolly: Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

function SolveMolly : Boolean;
label
IfNot_CivilianCaught;
var
P: TPoint;
T, Tries, MolMark, I, TX, TY: Integer;
MCaught: Boolean;
CTS: Integer;
curChatMsg: String;
valChats: T2DStringArray;
begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);

{ Get Molly's hair colour. }
while ((not InConvo) and (TimeFromMark(MolMark) < 10000)) do
Wait(50 + Random(20));
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown
Molly_FilterColors;

{
Randomly stop talking to Molly, most players will not talk the entire time.
}
tries := Random(7);
for I := 0 to tries do
ClickContinue(True, True);
tries := 0;

SetRun(False);
if (FindMollyDoor(P)) then
Mouse(P.X, P.Y, 0, 0, True)
else
begin
srl_Warn('SolveMolly', 'Could NOT Open Door', srl_warnAllVersions);
ColorToleranceSpeed(CTS);
Result := False;
Exit;
end;

I := 0;
repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft); // What is this doing, should string be a constant?
ClickContinue(True, True);
until(I >= 8 + Random(2));

if FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
else
begin
srl_Warn('SolveMolly', 'Could NOT Find Machine', srl_WarnAllVersions);
ColorToleranceSpeed(CTS);
Result := False;
Exit;
end;

I := 0;
while (I < 10) do
begin
Wait(1000 + Random(200)); // seems too large.
Inc(I);
if (GetColor(561, 221) = 6918288) then // what is this colour? Make it const
Break;
end;

if (GetColor(561, 221) = 6918288) then // same thing here.
begin
if FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) then
Tries := StrToIntEx(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)), 0);

if (Tries = 0) then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

while ((not (MCaught)) and (T > GetSystemTime)) do
begin
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
if IsMollyOnDot(P) then
begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
end;
if (Tries = 0) then
begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
end;

curChatMsg := GetChatBoxText(8, clMessage);
valChats := [TStringArray('win', 'Evil'),
TStringArray('cent', 'illian'),
TStringArray('arget!', 'upposed')];
for i := 0 to 2 do
begin
if (i = 0) then
MCaught := ClickContinue(False, False);
MCaught := (MCaught or ArrInStr(validTexts[i], curChatMsg));
if (MCaught) then
begin
case (i) of
0: Writeln('We got the twin');
1:
begin
Writeln('We caught a civilian');
Dec(Tries);
end;
2: begin end;
end;
break;
end;
end;
end;

if (GetSystemTime > T) then
begin
Result := False;
srl_Warn('SolveMolly', 'Could NOT find Molly!', warn_AllVersions);
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
end;

if (MCaught) then
begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000); // why so high? while..do loop w/ a timeout perhaps?
T := GetSystemTime;
while (GetSystemTime - T < 15000) do
begin
if (not ClickContinue(True, True) then
Break;
Wait(200 + Random(100));
end;

if (not FindMollyDoor(P)) then
begin
SRL_Warn('SolveMolly', 'Could not find Door.', srl_WarnAllVersions);
ColorToleranceSpeed(CTS);
Exit;
end;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
while (GetSystemTime - T < 15000) do
begin
if (not ClickContinue(True, True) then
Break;
Wait(200 + Random(100));
end;
Result := True;

WriteLn('Solved Molly Random Event.');
Wait(10000); // while..do timeout?
ColorToleranceSpeed(CTS);
end;
end;
end;

Up to commitable standards.. now tweak that stuff up. ;)

Gu3st...

2009-12-14 07:55:22

Grats on cup :D
well deserved

noidea

2009-12-14 07:59:56

From: Nava2
const
FullDebug = True; //Debug it all?
M_DefaultHeight = 62; //Molly's Height (Used in M_FindMS)
M_CrossColor = 2438909; //The crosshair color, should be fine..
M_CrossTol = 5; //The tolerance of the cross, should be fine..


var
MollyColors : TIntegerArray; //Variables
M_TileWidth : Extended;
M_CrossPoint : TPoint;

type
TMollyControl = record //Molly record.
Direction : (_Up, _Down, _Right, _Left);
Times : Byte;
end;

{*******************************************************************************
Function FindMollyDoor(DP : TPoint) : Boolean;
by: Naum
Description: Opens the door in molly
*******************************************************************************}

const
srl_Molly_DoorMin = 15;
srl_Molly_DoorMax = 1 shl 20;
srl_Molly_DoorW = 10;
srl_Molly_DoorH = 14;
srl_Molly_HeightF = 2.443;

function FindMollyDoor(var DP : TPoint) : Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
ii, h : Integer;
begin
{ To be replaced with global TAutoColorInfo array. }
SetColorspeed2Modifiers(0.21, 0.44);
FindColorsTolerance(TPA, 7838641, MSX1, MSY1, MSX2, MSY2, 15);
ATPA := SplitTPAEx(TPA, srl_Molly_DoorW, srl_Molly_DoorH);

SortATPASize(ATPA, True);
SortATPAFrom(ATPA, Point(MSCX + Round(M_DefaultHeight * 2.443), MSCY));

h := High(ATPA);
for ii := 0 to High(h) do
if MiddleTPAEx(ATPA[ii], DP.X, DP.Y) then
begin
if InRange(GetArrayLength(ATPA[II]),
srl_Molly_DoorMin,
srl_Molly_DoorMax) then
Begin
MMouse(DP.X, DP.Y, 4, 4);
Wait(300 + Random(400));
if WaitUpText('oor', srl_MaxWaitTime) then
begin
Result := True;
GetMousePos(DP.X, DP.Y);
Exit;
end;
end;
end;
SetColorspeed2Modifiers(0.2, 0.2);
end;

{*******************************************************************************
Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean
by: Naum
Description: Finds the position of the crosshair in the TBox 'Inn'
*******************************************************************************}

function Molly_CrosshairPos(var Cross: TPoint; Inn: TBox): Boolean;
var
TPA: TPointArray;
begin //Finds cross colors
FindColorsTolerance(TPA, M_CrossColor, Inn.x1, Inn.y1, Inn.x2, Inn.y2, M_CrossTol)
if FullDebug then
WriteLn('Length of Cross Count = '+IntToStr(Length(TPA)));
if (Length(TPA) > 0) then
begin
Cross := MiddleTPA(TPA);
if FullDebug then
WriteLn('Cross found at '+IntToStr(Cross.X)+', '+IntToStr(Cross.Y));
Result := True;
Exit;
end else
if FullDebug then
WriteLn('Cross not found');
end;

{*******************************************************************************
Procedure Molly_FindMS(Var Molly : TPoint);
by: Naum
Description: Finds the position of molly on the main screen
*******************************************************************************}

procedure Molly_FindMS(var Molly : TPoint);
label Begining;
var //
ATPA: T2DPointArray;
TPA: TPointArray;
I, II, h: Integer;
P: TPoint;
NotFound: Boolean;
AddOn: Integer;
begin
Begining : I := 0;
h := High(MollyColors);
SetLength(ATPA, h + 1); //sets length the same as colors
for I := 0 to h do
FindColors(ATPA[I], MollyColors[I], MSX1, MSY1, MSX2, MSY2); //finds colors

TPA := MergeATPA(ATPA); //Merges all the seperate TPA's into one
ATPA := TPAToATPA(TPA, 20); //20 radius circles

for I := 0 To High(ATPA) Do
begin
if FullDebug then
WriteLn('Found '+IntToStr(Length(ATPA))+' Similars.');
{ Filter out points not valid. }
if (not InAbstractBox(400, 8, 503, 0, 514, 96, 500, 130,
ATPA[I][0].X, ATPA[I][0].Y)) then
if (GetArraylength(ATPA[I]) >= 3) then
begin
P := MiddleTPA(ATPA[I]);
begin
if FullDebug then
WriteLn('Molly found at index '+IntToStr(I));

for II := 0 to 3 do
{ EXPLAIN THIS }
if PointInBox(P, IntToBox(0, II * 30, 520,
((II + 1) * 30) + (Integer(II = 3) * 10)))
then
AddOn := M_DefaultHeight + ((II - 1) * (10 - II));

if (AddOn = 52) then
DecEx(AddOn, 6);

Molly := Point(P.x, P.y + AddOn);

if FullDebug then
WriteLn('Molly found at '+IntToStr(Molly.X)+', '+IntToStr(Molly.Y));

if FullDebug then
WriteLn('Mollys Height is : '+IntToStr(AddOn));
Exit;
end;
NotFound := (I >= 3);
if NotFound then Break;
end;
end;

if NotFound then
goto Begining; // should use a loop instead.
end;

{*******************************************************************************
Function IsMollyOnDot(CP : TPoint) : Boolean;
by: Naum
Description: Results true if molly is standing on dot.
*******************************************************************************}

function IsMollyOnDot(CP : TPoint) : Boolean;
var
MollysPosition: TPoint;
begin
Molly_FindMS(MollysPosition); //If some of the points are inrange of mollys feet
Result := (PointInBox(MollysPosition,
IntToBox(Cp.x - 6, Cp.y - 6, Cp.x + 6, Cp.y + 6))) or
(InRange(iAbs(CP.X - MollysPosition.X), 0, 7) and
InRange(iAbs(CP.Y - MollysPosition.Y), 0, 7));
end;

{*******************************************************************************
Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
by: Naum
Description: Turns the two points (crosshair and molly) into directions.
*******************************************************************************}

function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean): TMollyControl;
begin
{ Determine the direction }
if (Vertical) then
begin
if ((Point1.y - Point2.y) < 0) then
Result.Direction := _Up
else
Result.Direction := _Down;
end else
begin
if (Point1.x - Point2.x) > 0 then
Result.Direction := _Left
else
Result.Direction := _Right;
end;

M_TileWidth := 33.8; //default for sideways
if (Result.Direction = _Down) then
M_TileWidth := 24.3; //greater width
if (Result.Direction = _Up) then
M_TileWidth := 17.9;

if (FullDebug) then
WriteLn('Tile Width (perspective) is: '+FloatToStr(M_TileWidth));

Result.Times := Round(Distance(Point1.x, Point1.y, Point2.x, Point2.y) / M_TileWidth); //number of times to move

if FullDebug then
if Vertical then
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Up/Down ')
else
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Left/Right ');
end;

{*******************************************************************************
Procedure Molly_Operate(Information : TMollyControl);
by: Naum
Description: Clicks a direction based on the input
*******************************************************************************}

procedure Molly_Operate(Information : TMollyControl);
var
I: Byte;
Mark: Integer;
curChat: String;
ValChats: TStringArray;
begin
I := 0; //operating proc
Mark := GetSystemTime + 2800; //timeout to avoid spasms
valChats := ['win', 'Evil'];
repeat
if (ArrInStr(valChats, GetChatBoxText(8, clMessage)) or
ClickContinue(False, False)) or
(Information.Times = 0) or
(IsMollyOnDot(M_CrossPoint) Or (M_CrossPoint.X = 0))
then
Exit;

{ Click the joy stick }
case Information.Direction of //co-ords taken from wizzups
_Up : Mouse(RandomRange(630, 650), RandomRange(260, 275), 0, 0, True);
_Down : Mouse(RandomRange(627, 655), RandomRange(383, 411), 0, 0, True);
_Right : Mouse(RandomRange(705, 720), RandomRange(315, 340), 0, 0, True);
_Left : Mouse(RandomRange(563, 583), RandomRange(323, 341), 0, 0, True);
end;

Inc(I);
until((I >= Information.Times) or (Mark < GetSystemTime));
end;

{*******************************************************************************
Procedure Molly_MoveCrossTo;
by: Naum
Description: Moves the crosshair to molly
*******************************************************************************}

procedure Molly_MoveCrossTo;
var
MollyP: TPoint;
Point3: TPoint;
begin // gets pos of crosshair
Molly_CrosshairPos(M_CrossPoint, IntToBox(MSX1, MSY1, 515, 200));
if (not IsMollyOnDot(M_CrossPoint)) then
begin
Molly_FindMS(MollyP); //finds molly
Point3 := Point(MollyP.x, M_CrossPoint.y); //completes the r-a triangle

Molly_Operate(Molly_PtsToCtrl(M_CrossPoint, Point3, False)); //proc
Molly_Operate(Molly_PtsToCtrl(MollyP, Point3, True)); //proc

Wait(250 + Random(30));
end;
end;

{*******************************************************************************
Procedure Molly_FilterColors;
by: Nava2
Description: Filters the found MollyHair colours removing the background and
complexion noise.
*******************************************************************************}
{
Molly Filter Noise Arrays:
Background:
[10798549, 10274005, 10469330, 10206670, 10601943, 10995674, 9284540,
9021369, 10864599];
Complexion:
[6983885, 7311804, 7577290, 5668010, 7905744, 6258597, 5668010, 7312056];
}

procedure Molly_FilterColors;
var
i, h, j, k, kF, newColCounter: Integer;
minR, maxR, minG, maxG, minB, maxB: Integer;
RGB: TIntegerArray;
newCols: TIntegerArray;
minMaxArr: T2DIntegerArray;
badCol: Boolean;
begin
{ Create the new array, as well setup the vars. }
ClearSameIntegers(MollyColors);
h := High(MollyColors);
SetLength(newCols, h + 1);
SetLength(RGB, 3);
{ RGB Values: miR, maR, miG, maG, miB, maB }
minMaxArr := [TIntegerArray(185, 218, 167, 199, 137, 167), { Background. }
TIntegerArray(165, 208, 124, 161, 86, 120)]; { Complexion. }
filterColLength := high(minMaxArr);
newColCounter := 0;

for i := 0 to h do
begin
ColorToRGB(MollyColor[i], RGB[0], RGB[1], RGB[2]);
{
Sort through the different filter colours, if the colour is represented by
one of the filter colours, it will not be added.
}
for j := 0 to filterColLength do
begin
for k := 0 to 2 do
begin
kF := k shl 1;
if (not InRange(RGB[k], minMaxArr[j][kF], minMaxArr[j][kF + 1])) then
begin
badCol := True;
Break;
end;
if (badCol) then Break;
end;
end;
if (badCol) then
begin
badCol := False;
Continue;
end;

{ Add the new colour if it passes. }
newCols[newColCounter] := MollyColor[i];
inc(newColCounter);
badCol:
end;
setLength(newCols, c);
MollyColors := newCols;
end;

{*******************************************************************************
function SolveMolly: Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

function SolveMolly : Boolean;
label
IfNot_CivilianCaught;
var
P: TPoint;
T, Tries, MolMark, I, TX, TY: Integer;
MCaught: Boolean;
CTS: Integer;
curChatMsg: String;
valChats: T2DStringArray;
begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);

{ Get Molly's hair colour. }
while ((not InConvo) and (TimeFromMark(MolMark) < 10000)) do
Wait(50 + Random(20));
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown
Molly_FilterColors;

{
Randomly stop talking to Molly, most players will not talk the entire time.
}
tries := Random(7);
for I := 0 to tries do
ClickContinue(True, True);
tries := 0;

SetRun(False);
if (FindMollyDoor(P)) then
Mouse(P.X, P.Y, 0, 0, True)
else
begin
srl_Warn('SolveMolly', 'Could NOT Open Door', srl_warnAllVersions);
ColorToleranceSpeed(CTS);
Result := False;
Exit;
end;

I := 0;
repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft); // What is this doing, should string be a constant?
ClickContinue(True, True);
until(I >= 8 + Random(2));

if FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
else
begin
srl_Warn('SolveMolly', 'Could NOT Find Machine', srl_WarnAllVersions);
ColorToleranceSpeed(CTS);
Result := False;
Exit;
end;

I := 0;
while (I < 10) do
begin
Wait(1000 + Random(200)); // seems too large.
Inc(I);
if (GetColor(561, 221) = 6918288) then // what is this colour? Make it const
Break;
end;

if (GetColor(561, 221) = 6918288) then // same thing here.
begin
if FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) then
Tries := StrToIntEx(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)), 0);

if (Tries = 0) then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

while ((not (MCaught)) and (T > GetSystemTime)) do
begin
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
if IsMollyOnDot(P) then
begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
end;
if (Tries = 0) then
begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
end;

curChatMsg := GetChatBoxText(8, clMessage);
valChats := [TStringArray('win', 'Evil'),
TStringArray('cent', 'illian'),
TStringArray('arget!', 'upposed')];
for i := 0 to 2 do
begin
if (i = 0) then
MCaught := ClickContinue(False, False);
MCaught := (MCaught or ArrInStr(validTexts[i], curChatMsg));
if (MCaught) then
begin
case (i) of
0: Writeln('We got the twin');
1:
begin
Writeln('We caught a civilian');
Dec(Tries);
end;
2: begin end;
end;
break;
end;
end;
end;

if (GetSystemTime > T) then
begin
Result := False;
srl_Warn('SolveMolly', 'Could NOT find Molly!', warn_AllVersions);
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
end;

if (MCaught) then
begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000); // why so high? while..do loop w/ a timeout perhaps?
T := GetSystemTime;
while (GetSystemTime - T < 15000) do
begin
if (not ClickContinue(True, True) then
Break;
Wait(200 + Random(100));
end;

if (not FindMollyDoor(P)) then
begin
SRL_Warn('SolveMolly', 'Could not find Door.', srl_WarnAllVersions);
ColorToleranceSpeed(CTS);
Exit;
end;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
while (GetSystemTime - T < 15000) do
begin
if (not ClickContinue(True, True) then
Break;
Wait(200 + Random(100));
end;
Result := True;

WriteLn('Solved Molly Random Event.');
Wait(10000); // while..do timeout?
ColorToleranceSpeed(CTS);
end;
end;
end;

Up to commitable standards.. now tweak that stuff up. ;)



Really? You wont commit stuff if it doesn't have enough commentary and constants? I find that outrageous tbh. I know SRL is opensource; so it has to be readable, but common..

Nava2

2009-12-14 08:11:59

From: noidea
Really? You wont commit stuff if it doesn't have enough commentary and constants? I find that outrageous tbh. I know SRL is opensource; so it has to be readable, but common..


Hate to say this, sounds a bit harsh.. Deal with it.

SRL Needs to be legible and readable. Standards need to be upkept and everything needs to be the same so one can read/learn.

I didn't change a whole lot, I got rid of some ugly things, and made some things faster. Its my job here at SRL.

If you want to do better, please do ;)

Wizzup?

2009-12-14 11:13:32

From: noidea
Really? You wont commit stuff if it doesn't have enough commentary and constants? I find that outrageous tbh. I know SRL is opensource; so it has to be readable, but common..


I agree with noidea.

HyperSecret

2009-12-14 11:44:18

From: Nava2
Hate to say this, sounds a bit harsh.. Deal with it.

SRL Needs to be legible and readable. Standards need to be upkept and everything needs to be the same so one can read/learn.

I didn't change a whole lot, I got rid of some ugly things, and made some things faster. Its my job here at SRL.

If you want to do better, please do ;)


From: Wizzup?
I agree with noidea.



I Agree with Nava, there are several times when looking through the include and thinking to myself, now why this way or why that color, what is that for, etc…

Either way, gj on the solver Naum.

Naum

2009-12-14 12:41:13

:confused: After reading those comments I'm not sure what to do.

I spent some time on it today and tried to merge some of the functions. However, that is not to say that I didn't test them. Nava, your one seems to exit the whole procedure when just as you click on the capture button molly moves and you get a 'nobody there' message. Whereas mine carries on.

Because I have my life is (20 shr 5), I decided I would do something cool and make videos of both of them.

Nava's: http://www.youtube.com/watch?v=sWJIbWSPCvk

My one: http://www.youtube.com/watch?v=VxVe0jzMU1o

Both completed it in under 50 seconds (from the starting point). I would have made them longer, but they take ages to upload :<.

A further big hand goes to Tarajunky, without his account none of this would have been possible.. :)

Molly Solver A:
Const
FullDebug = True; //Debug it all?
M_DefaultHeight = 62; //Molly's Height (Used in M_FindMS)
M_CrossColor = 2438909; //The crosshair color, should be fine..
M_CrossTol = 5; //The tolerance of the cross, should be fine..


Var
MollyColors : TIntegerArray; //Variables
M_TileWidth : Extended;
M_CrossPoint : TPoint;

Type
TMollyControl = Record //Molly record.
Direction : (_Up, Down, _Right, _Left);
Times : Byte;
End;

{*******************************************************************************
Function FindMollyDoor(DP : TPoint; SortBy : Integer) : Boolean;
by: Naum
Description: Opens the door in molly.
SortBy is which direction to sort it from (Left or Right)
Used in entering and exiting (included for one-click opening)
*******************************************************************************}

const
srl_Molly_DoorMin = 15;
srl_Molly_DoorMax = 1 shl 20;
srl_Molly_DoorW = 10;
srl_Molly_DoorH = 14;
srl_Molly_HeightF = 2.443;
srl_MaxWaitTime = 300;

function FindMollyDoor(Var DP : TPoint; SortBy : Integer) : Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
ii, h : Integer;
begin
{ To be replaced with global TAutoColorInfo array. }
SetColorspeed2Modifiers(0.21, 0.44);
FindColorsTolerance(TPA, 7838641, MSX1, MSY1, MSX2, MSY2, 15);
ATPA := SplitTPAEx(TPA, srl_Molly_DoorW, srl_Molly_DoorH);

SortATPASize(ATPA, True);
SortATPAFromFirstPoint(ATPA, Point(MSCX + (SortBy * Round(M_DefaultHeight * srl_Molly_HeightF)), MSCY - 15));

h := High(ATPA);
for ii := 0 to High(h) do
if MiddleTPAEx(ATPA[ii], DP.X, DP.Y) then
begin
if InRange(GetArrayLength(ATPA[II]),
srl_Molly_DoorMin,
srl_Molly_DoorMax) then
Begin
MMouse(DP.X, DP.Y, 4, 4);
Wait(300 + Random(400));
if WaitUpText('oor', srl_MaxWaitTime) then
begin
Result := True;
GetMousePos(DP.X, DP.Y);
Exit;
end;
end;
end;
SetColorspeed2Modifiers(0.2, 0.2);
end;

{*******************************************************************************
Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean
by: Naum
Description: Finds the position of the crosshair in the TBox 'Inn'
*******************************************************************************}

Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean;
Var TPA : TPointArray;
Begin //Finds cross colors
FindColorsTolerance(TPA, M_CrossColor, Inn.x1, Inn.y1, Inn.x2, Inn.y2, M_CrossTol)
If FullDebug Then
WriteLn('Length of Cross Count = '+IntToStr(Length(TPA)));
If Length(TPA) > 0 Then
Begin
Cross := MiddleTPA(TPA);
If FullDebug Then
WriteLn('Cross found at '+IntToStr(Cross.X)+', '+IntToStr(Cross.Y));
Result := True;
Exit;
End Else
If FullDebug Then
WriteLn('Cross not found');
End;

{*******************************************************************************
Procedure Molly_FindMS(Var Molly : TPoint);
by: Naum
Description: Finds the position of molly on the main screen
*******************************************************************************}

Procedure Molly_FindMS(Var Molly : TPoint);
Label Begining;
Var //
ATPA : T2DPointArray;
TPA : TPointArray;
I, II : Integer;
P : TPoint;
NotFound : Boolean;
AddOn : Integer;

Begin
Begining : I := 0;
SetLength(ATPA, Length(MollyColors)); //sets length the same as colors
For I := 0 To High(MollyColors) Do
FindColors(ATPA[I], MollyColors[I], MSX1, MSY1, MSX2, MSY2); //finds colors

TPA := MergeATPA(ATPA); //Merges all the seperate TPA's into one
ATPA := TPAToATPA(TPA, 20); //20 radius circles
For I := 0 To High(ATPA) Do
Begin
If FullDebug Then WriteLn('Found '+IntToStr(Length(ATPA))+' Similars.');
If Not InAbstractBox(400, 8, 503, 0, 514, 96, 500, 130, ATPA[I][0].X, ATPA[I][0].Y) Then //Removes problem points for l-brown
If GetArraylength(ATPA[I]) >= 3 Then //length check
Begin
P := MiddleTPA(ATPA[I]);
Begin
If FullDebug Then
WriteLn('Molly found at index '+IntToStr(I));
// \/ Mollys height
For II := 0 To 3 Do
If PointInBox(P, IntToBox(0, II * 30, 520, ((II + 1) * 30) + (Integer(II = 3)*10) )) Then
AddOn := M_DefaultHeight + ((II - 1) * (10 - II));

If AddOn = 52 Then
DecEx(AddOn, 6);

Molly := Point(P.x, P.y + AddOn);

If FullDebug Then
WriteLn('Molly found at '+IntToStr(Molly.X)+', '+IntToStr(Molly.Y));

If FullDebug Then
WriteLn('Mollys Height is : '+IntToStr(AddOn));
Exit;
End;
NotFound := (I >= 3);
If NotFound Then Break;
End;
End;

If NotFound Then
GoTo Begining;
End;

{*******************************************************************************
Function IsMollyOnDot(CP : TPoint) : Boolean;
by: Naum
Description: Results true if molly is standing on dot.
*******************************************************************************}

Function IsMollyOnDot(CP : TPoint) : Boolean;
Var MollysPosition : TPoint;
Begin
Molly_FindMS(MollysPosition); //If some of the points are inrange of mollys feet
Result := (PointInBox(MollysPosition, IntToBox(Cp.x - 6, Cp.y - 6, Cp.x + 6, Cp.y + 6)))
Or (InRange(iAbs(CP.X - MollysPosition.X), 0, 7) And InRange(iAbs(CP.Y - MollysPosition.Y), 0, 7));
End;

{*******************************************************************************
Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
by: Naum
Description: Turns the two points (crosshair and molly) into directions.
*******************************************************************************}

Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
Begin
Case Vertical Of //determines direction
True : If (Point1.y - Point2.y) < 0 Then
Result.Direction := _Up
Else
Result.Direction := Down;
//determines direction
False : If (Point1.x - Point2.x) > 0 Then
Result.Direction := _Left
Else
Result.Direction := _Right;
End;


M_TileWidth := 33.8; //default for sideways
If Result.Direction = Down Then M_TileWidth := 24.3; //greater width
If Result.Direction = _Up Then M_TileWidth := 17.9;

If FullDebug Then
WriteLn('Tile Width (perspective) is: '+FloatToStr(M_TileWidth));

Result.Times := Round(Distance(Point1.x, Point1.y, Point2.x, Point2.y) / M_TileWidth); //number of times to move

If FullDebug Then
If Vertical Then
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Up/Down ')
Else
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Left/Right ')
End;

{*******************************************************************************
Procedure Molly_Operate(Information : TMollyControl);
by: Naum and Wizzup
Description: Clicks a direction based on the input
*******************************************************************************}

Procedure Molly_Operate(Information : TMollyControl);
Var I : Byte;
Mark : Integer;
Begin
I := 0; //operating proc
Mark := GetSystemTime + 2800; //timeout to avoid spasms
Repeat
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Exit;
If Information.Times = 0 Then
Exit;
If IsMollyOnDot(M_CrossPoint) Or (M_CrossPoint.X = 0) Then
Exit;

Case Information.Direction Of //co-ords taken from wizzups
_Up : Mouse(RandomRange(630, 650), RandomRange(260, 275), 0, 0, True); // Up
Down : Mouse(RandomRange(627, 655), RandomRange(383, 411), 0, 0, True); // Down
_Right : Mouse(RandomRange(705, 720), RandomRange(315, 340), 0, 0, True); // Right
_Left : Mouse(RandomRange(563, 583), RandomRange(323, 341), 0, 0, True); // Left
End;

Inc(I);
Until(I >= Information.Times) Or (Mark < GetSystemTime);
End;

{*******************************************************************************
Procedure Molly_MoveCrossTo;
by: Naum
Description: Moves the crosshair to molly
*******************************************************************************}

Procedure Molly_MoveCrossTo;
Var MollyP: TPoint;
Point3 : TPoint;
Begin // gets pos of crosshair
Molly_CrosshairPos(M_CrossPoint, IntToBox(MSX1, MSY1, 515, 200));
If Not IsMollyOnDot(M_CrossPoint) Then
Begin
Molly_FindMS(MollyP); //finds molly
Point3 := Point(MollyP.x, M_CrossPoint.y); //completes the r-a triangle

Molly_Operate(Molly_PtsToCtrl(M_CrossPoint, Point3, False)); //proc
Molly_Operate(Molly_PtsToCtrl(MollyP, Point3, True)); //proc

Wait(250 + Random(30));
End;
End;


{*******************************************************************************
Function SolveMolly : Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

Function SolveMolly : Boolean;
Label IfNot_CivilianCaught;

Var P : TPoint;
T, Tries, MolMark, I, TX, TY : Integer;
MCaught : Boolean;
CTS : Integer;
Begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);
If InConvo Then
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown

For I := 0 To Random(7) Do
ClickContinue(True, True);

SetRun(False);
If FindMollyDoor(P, 1) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Open Door');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;

Begin
I := 0;
Repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft);
ClickContinue(True, True);
Until(I >= 5 + Random(2));
End;
Wait(1);
Begin
If FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Find Machine');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;
End;
I := 0;
While (I < 10) Do
Begin
Wait(1000 + Random(200));
Inc(I);
If GetColor(561, 221) = 6918288 Then
Break;
End;

If GetColor(561, 221) = 6918288 Then
Begin
If FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) Then
Tries := StrToInt(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)));

If Tries = 0 Then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

IfNot_CivilianCaught :
While Not (MCaught) And (T > GetSystemTime) Do
Begin
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
If IsMollyOnDot(P) Then
Begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
End;
If Tries = 0 Then
Begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
End;
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Begin
WriteLn('We got the Twin.');
MCaught := True;
Break;
End;
If FindBlackChatMessage('cent') Or FindBlackChatMessage('illian') Then
Begin
WriteLn('We Caught a Civilian.');
Dec(Tries);
MCaught := False;
Break;
End;
If FindBlackChatMessage('target!') Or FindBlackChatMessage('upposed') Then
Begin
MCaught := False;
Break;
End;
Result := (GetSystemTime > T);
End;
If Not MCaught Then GoTo IfNot_CivilianCaught;

If GetSystemTime > T Then
Begin
Result := False;
WriteLn('Could NOT find Molly!');
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
End;

If MCaught Then
Begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000);
T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;

If Not FindMollyDoor(P, -1) Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;
Result := True;

If Result Then
Begin
WriteLn('Solved Molly Random Event.');
Wait(10000);
ColorToleranceSpeed(CTS);
End;
End;
End;
End;

Molly Solver B: Nava's one above ^.


I couldn't exit the random with my one, because I'd changed a procedure. but I know it works as I've tested it on 8 accounts.

EDIT: Video's are loooowww quality :/

Nava2

2009-12-14 13:13:16

The issue is probably when I got rid of the ugly if's :)

I can look at it later, good to see it works.. kinda :P

Edit: Clicking the lever thing should be faster :)

Edit: Also don't call it mine. its yours I just played with some code. ;)

marpis

2009-12-14 15:44:51

Naums works, is readable ergo no need to change it cause it takes time and might screw something up. Every single color as a constant is not necessary, just a comment on the line where the hard value is used is enough. These constants are after all only used in this one file and should never be used by a regular user. Tab_Inv etc. are a completely different thing…

Just commit it if it already isn't. I'm at my girlfriends place now so I can't check it.
Btw, bus to airport 4:00 AM (GMT +2), plane to Egypt 8:05 AM (GMT +2)! :)

Sir R. M8gic1an

2009-12-14 15:53:15

Naum… MSI Standards. Always.

Other than that, I think I've already said good job ;)

~RM

Iroki

2009-12-14 16:28:32

Nice work Naum, as usuall, I always believed in you :P

Naum

2009-12-14 16:47:19

Thanks for all the help, I'll take it into account and will have a refined version done within 18 hours.

Thanks :)

Bionicle

2009-12-14 17:15:09

woo j00 gets cup! well deserved :)

Nava2

2009-12-16 08:42:19

Committed!

Please keep updating this, and please goto the same standards as the include for the most part. Feel free to work on the version I posted, I would prefer that, but that's my opinion.

Anyways, keep working on this, and I will commit later versions as well.

blackelvis

2009-12-16 14:57:38

Hey, I tried to fire up scar with today's update and I get something weird when I try to run any script. I wasn't sure if this was really the best spot to post this but I couldn't think of a better place.

So anyway, with today's update I get this message on seemingly every script I've tested:
Line 33: [Error] (17277:1): Duplicate identifier 'srl_MaxWaitTime' in script C:\Users\erik\Desktop\scarprerelease\includes\SRL\SRL\Core\AntiRandoms\Molly.scar
And then it opens up molly.scar…

So I tried deleteing that file. and also just tried removing the offending line, but that just brings up PrisonPete.scar when I press play on a script. I get this error now: Line 261: [Error] (19776:1): Unknown identifier 'Pete_AnalyzeAnimal' in script C:\Users\erik\Desktop\scarprerelease\includes\SRL\SRL\Core\AntiRandoms\PrisonPete.scar

I'm kind of at a loss as to what to do..

edit: I also tried reverting to revision 315 and 314 in SRL just to see if it had any positive effects, but no dice.

Alek000

2009-12-16 14:59:39

From: blackelvis
Hey, I tried to fire up scar with today's update and I get something weird when I try to run any script. I wasn't sure if this was really the best spot to post this but I couldn't think of a better place.

So anyway, with today's update I get this message on seemingly every script I've tested:
Line 33: [Error] (17277:1): Duplicate identifier 'srl_MaxWaitTime' in script C:\Users\erik\Desktop\scarprerelease\includes\SRL\SRL\Core\AntiRandoms\Molly.scar
And then it opens up molly.scar…

So I tried deleteing that file. and also just tried removing the offending line, but that just brings up PrisonPete.scar when I press play on a script. I get this error now: Line 261: [Error] (19776:1): Unknown identifier 'Pete_AnalyzeAnimal' in script C:\Users\erik\Desktop\scarprerelease\includes\SRL\SRL\Core\AntiRandoms\PrisonPete.scar

I'm kind of at a loss as to what to do..


I am getting this too. I tried a number of different things but nothing worked. Hopefully everyone gets it figured out soon.

Naum

2009-12-16 15:35:23

Partially my fault, srl_MaxWaitTime was added in the rev before my solver, I had it in there and was using it as a const.

The way to fix it, replace molly.scar with this :

Const
FullDebug = True; //Debug it all?
M_DefaultHeight = 62; //Molly's Height (Used in M_FindMS)
M_CrossColor = 2438909; //The crosshair color, should be fine..
M_CrossTol = 5; //The tolerance of the cross, should be fine..


Var
MollyColors : TIntegerArray; //Variables
M_TileWidth : Extended;
M_CrossPoint : TPoint;

Type
TMollyControl = Record //Molly record.
Direction : (_Up, Down, _Right, _Left);
Times : Byte;
End;

{*******************************************************************************
Function FindMollyDoor(DP : TPoint; SortBy : Integer) : Boolean;
by: Naum
Description: Opens the door in molly.
SortBy is which direction to sort it from (Left or Right)
Used in entering and exiting (included for one-click opening)
*******************************************************************************}

const
srl_Molly_DoorMin = 15;
srl_Molly_DoorMax = 1 shl 20;
srl_Molly_DoorW = 10;
srl_Molly_DoorH = 14;
srl_Molly_HeightF = 2.443;

function FindMollyDoor(Var DP : TPoint; SortBy : Integer) : Boolean;
var
TPA : TPointArray;
ATPA : T2DPointArray;
ii, h : Integer;
begin
{ To be replaced with global TAutoColorInfo array. }
SetColorspeed2Modifiers(0.21, 0.44);
FindColorsTolerance(TPA, 7838641, MSX1, MSY1, MSX2, MSY2, 15);
ATPA := TPAToATPAEx(TPA, srl_Molly_DoorW, srl_Molly_DoorH);

SortATPASize(ATPA, True);
SortATPAFromFirstPoint(ATPA, Point(MSCX + (SortBy * Round(M_DefaultHeight * srl_Molly_HeightF)), MSCY - 15));

h := High(ATPA);
for ii := 0 to High(h) do
if MiddleTPAEx(ATPA[ii], DP.X, DP.Y) then
begin
if InRange(GetArrayLength(ATPA[II]),
srl_Molly_DoorMin,
srl_Molly_DoorMax) then
Begin
MMouse(DP.X, DP.Y, 4, 4);
Wait(300 + Random(400));
if WaitUpText('oor', srl_MaxWaitTime) then
begin
Result := True;
GetMousePos(DP.X, DP.Y);
Exit;
end;
end;
end;
SetColorspeed2Modifiers(0.2, 0.2);
end;

{*******************************************************************************
Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean
by: Naum
Description: Finds the position of the crosshair in the TBox 'Inn'
*******************************************************************************}

Function Molly_CrosshairPos(Var Cross : TPoint; Inn : TBox) : Boolean;
Var TPA : TPointArray;
Begin //Finds cross colors
FindColorsTolerance(TPA, M_CrossColor, Inn.x1, Inn.y1, Inn.x2, Inn.y2, M_CrossTol)
If FullDebug Then
WriteLn('Length of Cross Count = '+IntToStr(Length(TPA)));
If Length(TPA) > 0 Then
Begin
Cross := MiddleTPA(TPA);
If FullDebug Then
WriteLn('Cross found at '+IntToStr(Cross.X)+', '+IntToStr(Cross.Y));
Result := True;
Exit;
End Else
If FullDebug Then
WriteLn('Cross not found');
End;

{*******************************************************************************
Procedure Molly_FindMS(Var Molly : TPoint);
by: Naum
Description: Finds the position of molly on the main screen
*******************************************************************************}

Procedure Molly_FindMS(Var Molly : TPoint);
Label Begining;
Var //
ATPA : T2DPointArray;
TPA : TPointArray;
I, II : Integer;
P : TPoint;
NotFound : Boolean;
AddOn : Integer;

Begin
Begining : I := 0;
SetLength(ATPA, Length(MollyColors)); //sets length the same as colors
For I := 0 To High(MollyColors) Do
FindColors(ATPA[I], MollyColors[I], MSX1, MSY1, MSX2, MSY2); //finds colors

TPA := MergeATPA(ATPA); //Merges all the seperate TPA's into one
ATPA := TPAToATPA(TPA, 20); //20 radius circles
For I := 0 To High(ATPA) Do
Begin
If FullDebug Then WriteLn('Found '+IntToStr(Length(ATPA))+' Similars.');
If Not InAbstractBox(400, 8, 503, 0, 514, 96, 500, 130, ATPA[I][0].X, ATPA[I][0].Y) Then //Removes problem points for l-brown
If GetArraylength(ATPA[I]) >= 3 Then //length check
Begin
P := MiddleTPA(ATPA[I]);
Begin
If FullDebug Then
WriteLn('Molly found at index '+IntToStr(I));
// \/ Mollys height
For II := 0 To 3 Do
If PointInBox(P, IntToBox(0, II * 30, 520, ((II + 1) * 30) + (Integer(II = 3)*10) )) Then
AddOn := M_DefaultHeight + ((II - 1) * (10 - II));

If AddOn = 52 Then
DecEx(AddOn, 6);

Molly := Point(P.x, P.y + AddOn);

If FullDebug Then
WriteLn('Molly found at '+IntToStr(Molly.X)+', '+IntToStr(Molly.Y));

If FullDebug Then
WriteLn('Mollys Height is : '+IntToStr(AddOn));
Exit;
End;
NotFound := (I >= 3);
If NotFound Then Break;
End;
End;

If NotFound Then
GoTo Begining;
End;

{*******************************************************************************
Function IsMollyOnDot(CP : TPoint) : Boolean;
by: Naum
Description: Results true if molly is standing on dot.
*******************************************************************************}

Function IsMollyOnDot(CP : TPoint) : Boolean;
Var MollysPosition : TPoint;
Begin
Molly_FindMS(MollysPosition); //If some of the points are inrange of mollys feet
Result := (PointInBox(MollysPosition, IntToBox(Cp.x - 6, Cp.y - 6, Cp.x + 6, Cp.y + 6)))
Or (InRange(iAbs(CP.X - MollysPosition.X), 0, 7) And InRange(iAbs(CP.Y - MollysPosition.Y), 0, 7));
End;

{*******************************************************************************
Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
by: Naum
Description: Turns the two points (crosshair and molly) into directions.
*******************************************************************************}

Function Molly_PtsToCtrl(Point1, Point2 : TPoint; Vertical : Boolean) : TMollyControl;
Begin
Case Vertical Of //determines direction
True : If (Point1.y - Point2.y) < 0 Then
Result.Direction := _Up
Else
Result.Direction := Down;
//determines direction
False : If (Point1.x - Point2.x) > 0 Then
Result.Direction := _Left
Else
Result.Direction := _Right;
End;


M_TileWidth := 33.8; //default for sideways
If Result.Direction = Down Then M_TileWidth := 24.3; //greater width
If Result.Direction = _Up Then M_TileWidth := 17.9;

If FullDebug Then
WriteLn('Tile Width (perspective) is: '+FloatToStr(M_TileWidth));

Result.Times := Round(Distance(Point1.x, Point1.y, Point2.x, Point2.y) / M_TileWidth); //number of times to move

If FullDebug Then
If Vertical Then
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Up/Down ')
Else
WriteLn('This means that the crosshair must be moved '+IntToStr(Result.Times)+' Left/Right ')
End;

{*******************************************************************************
Procedure Molly_Operate(Information : TMollyControl);
by: Naum and Wizzup
Description: Clicks a direction based on the input
*******************************************************************************}

Procedure Molly_Operate(Information : TMollyControl);
Var I : Byte;
Mark : Integer;
Begin
I := 0; //operating proc
Mark := GetSystemTime + 2800; //timeout to avoid spasms
Repeat
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Exit;
If Information.Times = 0 Then
Exit;
If IsMollyOnDot(M_CrossPoint) Or (M_CrossPoint.X = 0) Then
Exit;

Case Information.Direction Of //co-ords taken from wizzups
_Up : Mouse(RandomRange(630, 650), RandomRange(260, 275), 0, 0, True); // Up
Down : Mouse(RandomRange(627, 655), RandomRange(383, 411), 0, 0, True); // Down
_Right : Mouse(RandomRange(705, 720), RandomRange(315, 340), 0, 0, True); // Right
_Left : Mouse(RandomRange(563, 583), RandomRange(323, 341), 0, 0, True); // Left
End;

Inc(I);
Until(I >= Information.Times) Or (Mark < GetSystemTime);
End;

{*******************************************************************************
Procedure Molly_MoveCrossTo;
by: Naum
Description: Moves the crosshair to molly
*******************************************************************************}

Procedure Molly_MoveCrossTo;
Var MollyP: TPoint;
Point3 : TPoint;
Begin // gets pos of crosshair
Molly_CrosshairPos(M_CrossPoint, IntToBox(MSX1, MSY1, 515, 200));
If Not IsMollyOnDot(M_CrossPoint) Then
Begin
Molly_FindMS(MollyP); //finds molly
Point3 := Point(MollyP.x, M_CrossPoint.y); //completes the r-a triangle

Molly_Operate(Molly_PtsToCtrl(M_CrossPoint, Point3, False)); //proc
Molly_Operate(Molly_PtsToCtrl(MollyP, Point3, True)); //proc

Wait(250 + Random(30));
End;
End;


{*******************************************************************************
Function SolveMolly : Boolean;
by: Wizzup and Naum
Description: Solves the Molly Random
*******************************************************************************}

Function SolveMolly : Boolean;
Label IfNot_CivilianCaught;

Var P : TPoint;
T, Tries, MolMark, I, TX, TY : Integer;
MCaught : Boolean;
CTS : Integer;
Begin
SetAngle(True);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
Players[CurrentPlayer].Rand := 'Molly';
MarkTime(MolMark);
If InConvo Then
MollyColors := GetColorsBox(41, 374, 84, 382, True); //GetColorsBox(42, 372, 60, 385, True); light brown

For I := 0 To Random(7) Do
ClickContinue(True, True);

SetRun(False);
If FindMollyDoor(P, 1) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Open Door');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;

Begin
I := 0;
Repeat
Wait(740 + Random(100));
Inc(I);
FindNPCChatText('now', ClickLeft);
ClickContinue(True, True);
Until(I >= 5 + Random(2));
End;
Wait(1);
Begin
If FindObjTPAMulti(P.x, P.y, [2379300, 4015557, 3697078, 5140596], 15, -1, 20,
20, 10, ['ontr', 'anel', 'se']) Then
Mouse(P.X, P.Y, 0, 0, True)
Else
Begin
WriteLn('Molly : Could NOT Find Machine');
ColorToleranceSpeed(CTS);
Result := False;
Exit;
End;
End;
I := 0;
While (I < 10) Do
Begin
Wait(1000 + Random(200));
Inc(I);
If GetColor(561, 221) = 6918288 Then
Break;
End;

If GetColor(561, 221) = 6918288 Then
Begin
If FindText(TX, TY, 'Tries', SmallChars, 555, 216, 600, 240) Then
Tries := StrToInt(GetNumbers(GetTextAtEx(TX, TY, 0, SmallChars,
False, False, 0, 1, 6918288, 50, False, tr_AllChars)));

If Tries = 0 Then
Tries := 2;

T := GetSystemTime + 120000; //2 minutes timeout.

IfNot_CivilianCaught :
While Not (MCaught) And (T > GetSystemTime) Do
Begin
Molly_MoveCrossTo;
Molly_CrosshairPos(P, IntToBox(MSX1, MSY1, 515, 200));
If IsMollyOnDot(P) Then
Begin
Mouse(700, 423, 10, 10, True);
Wait(1000 + Random(1000));
End;
If Tries = 0 Then
Begin
WriteLn('Tries are finished, we were not able to get the twin');
Exit;
End;
If FindBlackChatMessage('win') Or FindBlackChatMessage('Evil') Or ClickContinue(False, False) Then
Begin
WriteLn('We got the Twin.');
MCaught := True;
Break;
End;
If FindBlackChatMessage('cent') Or FindBlackChatMessage('illian') Then
Begin
WriteLn('We Caught a Civilian.');
Dec(Tries);
MCaught := False;
Break;
End;
If FindBlackChatMessage('target!') Or FindBlackChatMessage('upposed') Then
Begin
MCaught := False;
Break;
End;
Result := (GetSystemTime > T);
End;
If Not MCaught Then GoTo IfNot_CivilianCaught;

If GetSystemTime > T Then
Begin
Result := False;
WriteLn('Could NOT find Molly!');
ColorToleranceSpeed(CTS);
Players[CurrentPlayer].Loc := 'NoMolly';
Exit;
End;

If MCaught Then
Begin
WriteLn('Found Molly in ' +IntToStr(TimeFromMark(MolMark))+' msec!');
Wait(20000);
T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;

If Not FindMollyDoor(P, -1) Then
Begin
ColorToleranceSpeed(CTS);
Exit;
End;

Mouse(P.X, P.Y, 0, 0, True);
Wait(10000);
If FindObjTPAMulti(P.X, P.Y, MollyColors, 5, -1, 6, 8, 4,
['alk', 'olly']) Then
Mouse(P.X, P.Y, 0, 0, True);
Wait(5000);

T := GetSystemTime;
While (GetSystemTime - T < 15000) Do
Begin
If Not ClickContinue(True, True) Then
Break;
Wait(1000);
End;
Result := True;

If Result Then
Begin
WriteLn('Solved Molly Random Event.');
Wait(10000);
ColorToleranceSpeed(CTS);
End;
End;
End;
End;

Thanks, my mistake.

^ That also contains some tweaks, so is the latest version.

Alek000

2009-12-16 15:47:24

Alright, that fixed Molly. Pete's still broken, I am going to make a new thread in the bugs section for it so this one doesn't get filled with it.

blackelvis

2009-12-16 16:05:06

From: Alek000
Alright, that fixed Molly. Pete's still broken, I am going to make a new thread in the bugs section for it so this one doesn't get filled with it.

I'm almost certain it's more than just molly and pete, I think it's all of the ones that were recently updated. So that would be.. Abyss, Molly, Pete, and Quiz.

Alek000

2009-12-16 16:07:48

From: blackelvis
I'm almost certain it's more than just molly and pete, I think it's all of the ones that were recently updated. So that would be.. Abyss, Molly, Pete, and Quiz.


I actually figured out why Pete isn't working. Go here and download the plugin and put it into the Plugins folder.
http://www.villavu.com/forum/showthread.php?t=53411

MylesMadness

2009-12-16 17:33:01

Line 33: [Error] (17406:1): Duplicate identifier 'srl_MaxWaitTime' in script C:\Program Files\SCAR 3.23\includes\SRL\SRL\Core\AntiRandoms\Molly.scar

Nava2

2009-12-16 17:42:21

Fixed.

tarajunky

2009-12-18 03:17:57

***** STR: FOUND RANDOM: 'Molly's Evil Twin' *****
[Runtime Error] : Out Of Range in line 50 in script C:\scarprerelease\includes\SRL\SRL\Core\AntiRandoms\Molly.scar

Naum

2009-12-18 03:21:29

/me slaps NAVA :p:

  h := High(ATPA);
for ii := 0 to High(h) do

Should be:

  h := High(ATPA);
for ii := 0 to h do

Don't need two 'Highs'

Wanted

2009-12-20 14:09:39

There really needs to be something like if (not (LoggedIn)) then Exit more often because if it takes to long or fails it just sits there and my script doesn't go to the next player.

Mining in South West.
***** STR: FOUND RANDOM: 'Molly's Evil Twin' *****
Length of Cross Count = 81
Cross found at 259, 186
Found 1 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 294, 60
Mollys Height is : 46
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 1 Left/Right
Found 1 Similars.
Molly found at index 0
Molly found at 294, 56
Mollys Height is : 46
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 7 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 293, 54
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 293, 53
Mollys Height is : 46
Found 1 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 293, 54
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 294, 57
Mollys Height is : 46
Length of Cross Count = 35
Cross found at 298, 101
Found 1 Similars.
Length of Cross Count = 30
Cross found at 295, 86
Found 1 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 293, 53
Mollys Height is : 46
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 0 Left/Right
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 2 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 293, 53
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 293, 54
Mollys Height is : 46
Length of Cross Count = 23
Cross found at 292, 61
Found 1 Similars.
Molly found at index 0
Molly found at 292, 57
Mollys Height is : 46
Length of Cross Count = 22
Cross found at 291, 61
Found 1 Similars.
Molly found at index 0
Molly found at 303, 136
Mollys Height is : 70
Found 1 Similars.
Molly found at index 0
Molly found at 304, 143
Mollys Height is : 70
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 0 Left/Right
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 304, 143
Mollys Height is : 70
Found 1 Similars.
Molly found at index 0
Molly found at 305, 147
Mollys Height is : 70
Found 2 Similars.
Molly found at index 0
Molly found at 305, 147
Mollys Height is : 70
Length of Cross Count = 18
Cross found at 290, 86
Found 2 Similars.
Molly found at index 0
Molly found at 306, 147
Mollys Height is : 70
Length of Cross Count = 14
Cross found at 292, 100
Found 1 Similars.
Molly found at index 0
Molly found at 305, 148
Mollys Height is : 70
Found 2 Similars.
Molly found at index 0
Molly found at 305, 147
Mollys Height is : 70
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 0 Left/Right
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 2 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 305, 147
Mollys Height is : 70
Found 3 Similars.
Molly found at index 0
Molly found at 353, 170
Mollys Height is : 76
Length of Cross Count = 38
Cross found at 299, 118
Found 2 Similars.
Molly found at index 0
Molly found at 428, 174
Mollys Height is : 76
Length of Cross Count = 50
Cross found at 303, 138
Found 2 Similars.
Molly found at index 0
Molly found at 471, 173
Mollys Height is : 76
Found 2 Similars.
Found 2 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 9 Left/Right
Found 2 Similars.
Found 2 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 8 Up/Down
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Length of Cross Count = 20
Cross found at 158, 73
Found 1 Similars.
Length of Cross Count = 15
Cross found at 160, 72
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 5 Left/Right
Found 1 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 433, 120
Mollys Height is : 62
Found 1 Similars.
Found 2 Similars.
Found 2 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 4 Up/Down
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Length of Cross Count = 14
Cross found at 226, 50
Found 1 Similars.
Length of Cross Count = 14
Cross found at 226, 50
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 424, 110
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 425, 131
Mollys Height is : 70
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 427, 150
Mollys Height is : 70
Found 1 Similars.
Molly found at index 0
Molly found at 429, 170
Mollys Height is : 76
Found 1 Similars.
Molly found at index 0
Molly found at 429, 170
Mollys Height is : 76
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Molly found at index 0
Molly found at 429, 170
Mollys Height is : 76
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Molly found at index 0
Molly found at 429, 169
Mollys Height is : 76
Found 1 Similars.
Molly found at index 0
Molly found at 429, 170
Mollys Height is : 76
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 6 Left/Right
Found 1 Similars.
Molly found at index 0
Molly found at 429, 170
Mollys Height is : 76
Found 1 Similars.
Molly found at index 0
Molly found at 429, 170
Mollys Height is : 76
Found 2 Similars.
Molly found at index 0
Molly found at 402, 173
Mollys Height is : 76
Found 1 Similars.
Molly found at index 0
Molly found at 399, 173
Mollys Height is : 76
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 5 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 453, 172
Mollys Height is : 76
Length of Cross Count = 28
Cross found at 223, 86
Length of Cross Count = 35
Cross found at 221, 101
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 6 Up/Down
Found 1 Similars.
Length of Cross Count = 19
Cross found at 222, 59
Length of Cross Count = 19
Cross found at 230, 50
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Length of Cross Count = 14
Cross found at 226, 50
Found 1 Similars.
Length of Cross Count = 14
Cross found at 226, 50
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 423, 97
Mollys Height is : 62
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Molly found at index 0
Molly found at 423, 112
Mollys Height is : 62
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Molly found at index 0
Molly found at 425, 121
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 426, 133
Mollys Height is : 70
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 6 Left/Right
Found 1 Similars.
Molly found at index 0
Molly found at 426, 140
Mollys Height is : 70
Found 1 Similars.
Molly found at index 0
Molly found at 428, 158
Mollys Height is : 70
Found 1 Similars.
Molly found at index 0
Molly found at 368, 152
Mollys Height is : 70
Found 2 Similars.
Molly found at index 0
Molly found at 306, 147
Mollys Height is : 70
Found 1 Similars.
Molly found at index 0
Molly found at 305, 147
Mollys Height is : 70
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 306, 147
Mollys Height is : 70
Found 2 Similars.
Molly found at index 0
Molly found at 306, 147
Mollys Height is : 70
Found 2 Similars.
Molly found at index 0
Molly found at 317, 153
Mollys Height is : 70
Length of Cross Count = 26
Cross found at 259, 72
Found 2 Similars.
Molly found at index 0
Molly found at 391, 173
Mollys Height is : 76
Length of Cross Count = 25
Cross found at 259, 85
Found 2 Similars.
Molly found at index 0
Molly found at 426, 173
Mollys Height is : 76
Found 2 Similars.
Molly found at index 0
Molly found at 442, 175
Mollys Height is : 76
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 5 Left/Right
Found 2 Similars.
Molly found at index 0
Molly found at 469, 173
Mollys Height is : 76
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 4 Up/Down
Found 1 Similars.
Found 2 Similars.
Molly found at index 0
Molly found at 453, 156
Mollys Height is : 70
Found 2 Similars.
Molly found at index 0
Molly found at 454, 156
Mollys Height is : 70
Found 1 Similars.
Molly found at index 0
Molly found at 452, 157
Mollys Height is : 70
Length of Cross Count = 62
Cross found at 392, 151
Found 1 Similars.
Molly found at index 0
Molly found at 441, 156
Mollys Height is : 70
Length of Cross Count = 62
Cross found at 392, 151
Found 1 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 396, 140
Mollys Height is : 70
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 0 Left/Right
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 1 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 396, 140
Mollys Height is : 70
Length of Cross Count = 62
Cross found at 392, 151
Found 1 Similars.
Length of Cross Count = 52
Cross found at 376, 130
Found 1 Similars.
Molly found at index 0
Molly found at 360, 102
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 361, 105
Mollys Height is : 62
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 0 Left/Right
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 1 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 361, 105
Mollys Height is : 62
Length of Cross Count = 54
Cross found at 376, 130
Found 1 Similars.
Molly found at index 0
Molly found at 360, 104
Mollys Height is : 62
Length of Cross Count = 13
Cross found at 356, 110
Found 2 Similars.
Molly found at index 0
Molly found at 361, 103
Mollys Height is : 62
Length of Cross Count = 13
Cross found at 351, 109
Found 2 Similars.
Molly found at index 0
Molly found at 361, 103
Mollys Height is : 62
Length of Cross Count = 37
Cross found at 362, 113
Found 2 Similars.
Found 2 Similars.
Found 2 Similars.
Found 2 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 11 Left/Right
Found 2 Similars.
Found 2 Similars.
Found 1 Similars.
Molly found at index 0
Molly found at 360, 104
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 376, 95
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 6 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 332, 67
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Length of Cross Count = 15
Cross found at 258, 70
Found 1 Similars.
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Length of Cross Count = 12
Cross found at 256, 58
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 8 Left/Right
Found 2 Similars.
Molly found at index 0
Molly found at 332, 67
Mollys Height is : 46
Found 2 Similars.
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Found 2 Similars.
Found 2 Similars.
Found 2 Similars.
Molly found at index 0
Molly found at 294, 60
Mollys Height is : 46
Found 2 Similars.
Molly found at index 0
Molly found at 292, 55
Mollys Height is : 46
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 355, 53
Mollys Height is : 46
Found 1 Similars.
Found 1 Similars.
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Found 1 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 3 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 423, 104
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 425, 116
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 426, 139
Mollys Height is : 70
Length of Cross Count = 19
Cross found at 230, 50
Found 1 Similars.
Molly found at index 0
Molly found at 429, 169
Mollys Height is : 76

Wanted

2009-12-20 21:26:01

Got another molly that wasn't blonde, solved it during run time and continued to mine ess until 42 trips later hit evil bob island and messed up

Worked quite well (when it's not blonde) I PMed you the blonde molly account Naum, here is the debug from the one that worked (nonblonde)

Mining in North East.
***** STR: FOUND RANDOM: 'Molly's Evil Twin' *****
Length of Cross Count = 0
Cross not found
Length of Cross Count = 0
Cross not found
Found 1 Similars.
Molly found at index 0
Molly found at 164, 63
Mollys Height is : 46
Length of Cross Count = 81
Cross found at 259, 186
Found 1 Similars.
Molly found at index 0
Molly found at 164, 63
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 164, 63
Mollys Height is : 46
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 3 Left/Right
Found 1 Similars.
Molly found at index 0
Molly found at 164, 63
Mollys Height is : 46
Found 1 Similars.
Molly found at index 0
Molly found at 223, 96
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 258, 95
Mollys Height is : 62
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 7 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 292, 97
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 333, 95
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 376, 96
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 375, 95
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 375, 95
Mollys Height is : 62
Length of Cross Count = 21
Cross found at 144, 87
Found 1 Similars.
Molly found at index 0
Molly found at 377, 96
Mollys Height is : 62
Length of Cross Count = 13
Cross found at 152, 83
Found 1 Similars.
Molly found at index 0
Molly found at 377, 96
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 377, 96
Mollys Height is : 62
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 7 Left/Right
Found 1 Similars.
Molly found at index 0
Molly found at 377, 95
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 375, 95
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 376, 95
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 376, 96
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 377, 96
Mollys Height is : 62
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 1 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 375, 95
Mollys Height is : 62
Length of Cross Count = 35
Cross found at 337, 101
Found 1 Similars.
Molly found at index 0
Molly found at 352, 102
Mollys Height is : 62
Length of Cross Count = 25
Cross found at 334, 102
Found 1 Similars.
Molly found at index 0
Molly found at 343, 107
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 342, 109
Mollys Height is : 62
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 0 Left/Right
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 0 Up/Down
Length of Cross Count = 11
Cross found at 328, 98
Found 1 Similars.
Molly found at index 0
Molly found at 346, 118
Mollys Height is : 62
Length of Cross Count = 15
Cross found at 330, 99
Found 1 Similars.
Molly found at index 0
Molly found at 347, 120
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 347, 121
Mollys Height is : 62
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 1 Left/Right
Found 1 Similars.
Molly found at index 0
Molly found at 347, 121
Mollys Height is : 62
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 1 Up/Down
Found 1 Similars.
Molly found at index 0
Molly found at 347, 130
Mollys Height is : 70
Length of Cross Count = 35
Cross found at 377, 101
Found 1 Similars.
Molly found at index 0
Molly found at 347, 120
Mollys Height is : 62
Length of Cross Count = 41
Cross found at 384, 118
Found 1 Similars.
Molly found at index 0
Molly found at 347, 120
Mollys Height is : 62
Found 1 Similars.
Molly found at index 0
Molly found at 347, 120
Mollys Height is : 62
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 1 Left/Right
Found 1 Similars.
Molly found at index 0
Molly found at 347, 120
Mollys Height is : 62
Tile Width (perspective) is: 24.3
This means that the crosshair must be moved 0 Up/Down
Length of Cross Count = 28
Cross found at 340, 118
Found 1 Similars.
Molly found at index 0
Molly found at 347, 130
Mollys Height is : 70
Length of Cross Count = 28
Cross found at 340, 118
Found 1 Similars.
Molly found at index 0
Molly found at 347, 121
Mollys Height is : 62
Length of Cross Count = 28
Cross found at 340, 118
Found 1 Similars.
Molly found at index 0
Molly found at 347, 121
Mollys Height is : 62
We got the Twin.
Found Molly in 42782 msec!
Solved Molly Random Event.
***** STR: 'Molly's Evil Twin' RANDOM SOLVED SUCCESSFULLY! *****
Random found! Performing anti-ban. Playing sound to alert script user.

Naum

2009-12-21 13:01:13

Done with your account :).

Just optimizing it a bit more :D:

Length of Cross Count = 81
Cross found at 259, 186
Found 2 Similars.
Found 2 Similars.
Found 2 Similars.
6
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 2 Left/Right
Found 2 Similars.
5
Molly found at index 0
Molly found at 332, 67
Mollys Height is : 46
Found 2 Similars.
Found 2 Similars.
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 7 Up/Down
Found 2 Similars.
3
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Found 2 Similars.
Found 2 Similars.
Found 2 Similars.
4
Molly found at index 0
Molly found at 333, 67
Mollys Height is : 46
Found 2 Similars.
Found 2 Similars.
Found 1 Similars.
Length of Cross Count = 29
Cross found at 332, 86
Found 1 Similars.
Length of Cross Count = 29
Cross found at 332, 86
Found 1 Similars.
4
Molly found at index 0
Molly found at 332, 67
Mollys Height is : 46
Found 1 Similars.
4
Molly found at index 0
Molly found at 332, 68
Mollys Height is : 46
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 0 Left/Right
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 1 Up/Down
Found 1 Similars.
Length of Cross Count = 29
Cross found at 332, 86
Found 1 Similars.
4
Molly found at index 0
Molly found at 295, 59
Mollys Height is : 46
Length of Cross Count = 29
Cross found at 332, 86
Found 1 Similars.
Found 1 Similars.
5
Molly found at index 0
Molly found at 293, 55
Mollys Height is : 46
Tile Width (perspective) is: 33.8
This means that the crosshair must be moved 1 Left/Right
Found 1 Similars.
4
Molly found at index 0
Molly found at 293, 53
Mollys Height is : 46
Tile Width (perspective) is: 17.9
This means that the crosshair must be moved 2 Up/Down
Found 1 Similars.
7
Molly found at index 0
Molly found at 293, 53
Mollys Height is : 46
Found 1 Similars.
4
Molly found at index 0
Molly found at 293, 55
Mollys Height is : 46
Length of Cross Count = 23
Cross found at 292, 61
Found 1 Similars.
4
Molly found at index 0
Molly found at 293, 53
Mollys Height is : 46
Length of Cross Count = 18
Cross found at 289, 50
Found 1 Similars.
9
Molly found at index 0
Molly found at 293, 54
Mollys Height is : 46
Length of Cross Count = 18
Cross found at 289, 50
Found 1 Similars.
4
Molly found at index 0
Molly found at 293, 53
Mollys Height is : 46
We got the Twin.
Found Molly in 39287 msec!
Solved Molly Random Event.

Wanted

2009-12-21 13:03:53

Did you update the first post of the thread? tell someone so they can fix it or post it so I can put it in my antirandoms folder.

Naum

2009-12-21 13:10:49

From: IceFire908
Did you update the first post of the thread? tell someone so they can fix it or post it so I can put it in my antirandoms folder.


I'm not done yet.

Blonde Molly with a blonde robe is a killer.

Okay, added some failsafes, fixed the door solver and tweaked some other stuff up. I also added the lines for it to logout if it failed :p. I added a crude bitmap function to detect the 'blonde' molly. I can work something out in a few days…

Updated First Post.