SRL Archive - Research & Development Lounge

Molly random


J J

2012-05-25 12:18:17

The Solver has been finished!
- Big thanks to Bolshask25 for lending me multiple Molly accounts!!


The code has been added to this post:
http://villavu.com/forum/showthread.php?t=83175&page=3

Video of the solver in action:
www.youtube.com/watch?v=VG-59gsKQi0
[youtube]VG-59gsKQi0[/youtube]



From: J J
I hope to make a Molly Random Event Solver in the future, I just don't get in there often. I'm not sure if this method even works, but try it out.

Well, I decided to make it considering it would help out a lot of people :)

Normal grid system

I've now finished the code to define what grid to make. There are a couple spots where the hook can be where the angle is normal. My grid for that is already done as seen above. Now I will need to make grids for when the angles change. Once those grids are done I can get the exact hook position. Once that is done I think the biggest part is done already, just need to know what molly to grab and with some maths I can calculate the things to do with the joystick to grab molly.

program Test;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

procedure NormalGridSystem;
var
i: Integer;
Row: Array[0..8] of Array[0..6] of TBox;
Debug: Boolean;

begin
Debug := True;
for i:=0 to 6 do
begin
Row[0][i] := IntToBox(83 + (i * 52), 178, 121 + (i * 52), 199);
Row[1][i] := IntToBox(97 + (i * 48), 152, 132 + (i * 48), 171);
Row[2][i] := IntToBox(109 + (i * 45), 130, 141 + (i * 45), 145);
Row[3][i] := IntToBox(120 + (i * 41), 112, 148 + (i * 41), 124);
Row[4][i] := IntToBox(129 + (i * 39), 95, 156 + (i * 39), 106);
Row[5][i] := IntToBox(137 + (i * 36), 81, 162 + (i * 36), 90);
Row[6][i] := IntToBox(144 + (i * 34), 68, 167 + (i * 34), 77);
Row[7][i] := IntToBox(150 + (i * 32), 57, 173 + (i * 32), 64);
Row[8][i] := IntToBox(156 + (i * 31), 47, 177 + (i * 31), 53);

if Debug then
begin
SMART_DrawBoxes(False, [Row[0][i]], clRed);
SMART_DrawBoxes(False, [Row[1][i]], clRed);
SMART_DrawBoxes(False, [Row[2][i]], clRed);
SMART_DrawBoxes(False, [Row[3][i]], clRed);
SMART_DrawBoxes(False, [Row[4][i]], clRed);
SMART_DrawBoxes(False, [Row[5][i]], clRed);
SMART_DrawBoxes(False, [Row[6][i]], clRed);
SMART_DrawBoxes(False, [Row[7][i]], clRed);
SMART_DrawBoxes(False, [Row[8][i]], clRed);
end;
end;
end;

function FenceAngle: Boolean;
var
Debug: Boolean;
FenceColors: TPointArray;
FenceSplit: T2DPointArray;
Opposite, Adjacent, Angle: Extended;

begin
Debug := True;
SMART_ClearCanvas;

if FindColorsSpiralTolerance(MSCX, MSCY, FenceColors, 2574713, MSX1, MSY1, MSX2, MSY2, 15) then
begin
SplitTPAExWrap(FenceColors, 15, 15, FenceSplit);
SortATPASize(FenceSplit, True);
Opposite := (GetTPABounds(FenceSplit[0]).Y2 - GetTPABounds(FenceSplit[0]).X1);
Adjacent := (GetTPABounds(FenceSplit[0]).X2 - GetTPABounds(FenceSplit[0]).X1);
Angle := ArcTan((Opposite/Adjacent));

if Debug then
begin
SMART_DrawDotsEx(False, FenceSplit[0], clPurple);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1, GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2)], ClRed);
SMART_DrawLine(False, Point(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1), Point(GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2), clYellow);
WriteLn('Opposite: '+ToStr(Opposite)+'');
WriteLn('Adjacent: '+ToStr(Adjacent)+'');
WriteLn('Angle: '+ToStr(Angle)+'');
end;

if (Angle > 0.412) and (Angle < 0.418) then
Result := True;
end;
end;

function HookPosition: String;
var
Debug: Boolean;
X1, Y1, X2, Y2: Array of Integer;
i, CountedColors, Highest: Integer;

begin
Debug := True;
X1 := [85, 74, 417, 429];
Y1 := [26, 30, 25, 28];
X2 := [99, 89, 430, 443];
Y2 := [36, 40, 36, 40];

if not(FenceAngle) then
begin
if Debug then
begin
SMART_DrawBoxes(False, [IntToBox(85, 26, 99, 36)], clRed); // Left 2 steps
SMART_DrawBoxes(False, [IntToBox(74, 30, 89, 40)], clYellow); // Left 1 step
SMART_DrawBoxes(False, [IntToBox(417, 25, 430, 36)], clPurple); // Right 2 steps
SMART_DrawBoxes(False, [IntToBox(429, 28, 443, 40)], clAqua); // Right 1 step
end;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.13);
for i:=0 to 3 do
begin
CountedColors := CountColorTolerance(3437619, X1[i], Y1[i], X2[i], Y2[i], 10);
if CountedColors > Highest then
begin
Highest := CountedColors;
case i of
0: Result := 'TwoLeft';
1: Result := 'OneLeft';
2: Result := 'TwoRight';
3: Result := 'OneRight';
end;
end;
if Debug then
WriteLn('Counted colors in Box '+IntToStr(i)+': '+IntToStr(CountColorTolerance(3437619, X1[i], Y1[i], X2[i], Y2[i], 10))+'');
end;
end else
begin
Result := 'Normal';
end;
end;


begin
SetUpLogin;
case HookPosition of
'Normal': NormalGridSystem;
'TwoLeft': WriteLn('TwoLeft');
'OneLeft': WriteLn('OneLeft');
'TwoRight': WriteLn('TwoRight');
'OneRight': WriteLn('OneRight');
end;
end.

Results:

Been working on it for around 3-4 hours so far I think so there is some nice progress. Finishing the other grids tomorrow which will take like 30 mins per grid = 2 hours. Then I'll work on checking in what box the hook is etc. so I will have the hook location done tomorrow definately. Excited to finish this, and I enjoy the maths :)

10/06/2012
A new day :)
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

function GetNearestToZero(TEA: Array of Extended): Extended;
var
L: Extended;
i: Integer;
begin
for i := 0 to High(TEA) do begin
if (i = 0) then begin
L := TEA[i];
Continue;
end;
if (Abs(TEA[i]) < L) then
L := TEA[i];
end;
Result := L;
end;

function HookPosition: String;
var
Debug: Boolean;
i: Integer;
Angles: Array of Extended;
AngleDifferences: Array[0..4] of Extended;
FenceColors: TPointArray;
FenceSplit: T2DPointArray;
Opposite, Adjacent, Angle, Lowest: Extended;

begin
Debug := True;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.57);

if FindColorsSpiralTolerance(MSCX, MSCY, FenceColors, 2837108, MSX1, MSY1, MSX2, MSY2, 15) then
begin
SplitTPAExWrap(FenceColors, 15, 15, FenceSplit);
SortATPASize(FenceSplit, True);
Opposite := (GetTPABounds(FenceSplit[0]).Y2 - GetTPABounds(FenceSplit[0]).Y1);
Adjacent := (GetTPABounds(FenceSplit[0]).X2 - GetTPABounds(FenceSplit[0]).X1);
Angle := ArcTan((Opposite/Adjacent));

if Debug then
begin
SMART_DrawDotsEx(False, FenceSplit[0], clPurple);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1, GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2)], ClRed);
SMART_DrawLine(False, Point(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1), Point(GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2), clYellow);
WriteLn('Opposite: '+ToStr(Opposite)+'');
WriteLn('Adjacent: '+ToStr(Adjacent)+'');
WriteLn('Angle: '+ToStr(Angle)+'');
end;

Angles := [0.1990, 0.1323, 0.0684, 0.1342, 0.2011];
Lowest := 1;

for i:=0 to 4 do
begin
AngleDifferences[i] := Abs((Angle - Angles[i]));

if Debug then
WriteLn('Angle difference: '+ToStr(AngleDifferences[i])+'');

if AngleDifferences[i] < Lowest then
begin
Lowest := AngleDifferences[i];
case i of
0: Result := 'TwoLeft';
1: Result := 'OneLeft';
2: Result := 'Normal';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
end;
end;
Writeln('Lowest: ' + ToStr(Lowest));
end;
end;

function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (80 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (80 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

procedure GetHookBoxes;
var
RedHook: TPointArray;

begin
// SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
SMART_ClearCanvas;
FindColorsSpiralTolerance(MSCX, MSCY, RedHook, 2373117, MSX1, MSY1, MSX2, MSY2, 5);
SMART_DrawDotsEx(False, RedHook, clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(RedHook).X1, GetTPABounds(RedHook).Y1, GetTPABounds(RedHook).X2, GetTPABounds(RedHook).Y2)], clYellow);
WriteLn(''+IntToStr(GetTPABounds(RedHook).X1)+', '+IntToStr(GetTPABounds(RedHook).Y1)+', '+IntToStr(GetTPABounds(RedHook).X2)+', '+IntToStr(GetTPABounds(RedHook).Y2)+'');
end;


begin
SetUpLogin;
//GetHookBoxes;

SMART_ClearCanvas;
case HookPosition of
'Normal': NormalHook;
'TwoLeft': TwoLeftHook;
'OneLeft': OneLeftHook;
'TwoRight': TwoRightHook;
'OneRight': OneRightHook;
end;
end.
Detects in what box the hook is located according to this grid

Will be uploading a video soon.
Ok here is the video
http://www.youtube.com/watch?v=SLFIVyBWDgM
[youtube]SLFIVyBWDgM[/youtube]

~~~~~~~~~~~~~~~~~~~~
Late update for 10-06-2012 (actually 11-06-2012 already!)
This moves your hook to your desired position of this grid:

Simply change the number and it will move there :D
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

function MoveHook(Box: Integer): Boolean;
var
Debug: Boolean;
H, V, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
Debug := True;
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
if Debug then
begin
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');
end;

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
MouseBox(700, 325, 720, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
MouseBox(570, 325, 590, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
if Debug then
begin
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');
end;

if not(BoxSpot = HookBoxSpot) then
begin
WriteLn('Difference');
if (BoxSpot > HookBoxSpot) then
begin
WriteLn('BoxSpot > HookBoxSpot');
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 265, 650, 280, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 385, 650, 405, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
end;

procedure GetHookBoxes;
var
RedHook: TPointArray;

begin
// SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
SMART_ClearCanvas;
FindColorsSpiralTolerance(MSCX, MSCY, RedHook, 2373117, MSX1, MSY1, MSX2, MSY2, 5);
SMART_DrawDotsEx(False, RedHook, clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(RedHook).X1, GetTPABounds(RedHook).Y1, GetTPABounds(RedHook).X2, GetTPABounds(RedHook).Y2)], clYellow);
WriteLn(''+IntToStr(GetTPABounds(RedHook).X1)+', '+IntToStr(GetTPABounds(RedHook).Y1)+', '+IntToStr(GetTPABounds(RedHook).X2)+', '+IntToStr(GetTPABounds(RedHook).Y2)+'');
end;

begin
SetUpLogin;
SMART_ClearCanvas;
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
MoveHook(68);
end.

Will be working on Molly detection tomorrow. Once I can convert Molly's position to a box on the map above I can just input that in the MoveHook function and grab Molly :) Detecting Molly will be hard though but the progress is nice!

————————————————-
11/06/2012
————————————————-
This is the day to work on the actual Molly detection. I will be posting some of my brainwaves here to get the right molly. Eventually I will choose one of the methods and grab all the colors etc.
When Molly has a long skirt you can't see her leg color
[8:06:32] JJ: so if Molly has a long skirt I can just find the hair color
[8:06:44] JJ: and check Y pixels below if the skin color of the legs exist
[8:06:49] JJ: if not it is the right molly
[8:07:01] JJ: With short skirt I can do the exact opposite
[8:07:26] JJ: Check hair color, move Y pixels below then if the skin colors exist it is the right molly


I started by using the account that [J]ustin has lended me:
Light green skirt:
SetColorSpeed2Modifiers(0.61, 1.00)
3043661, 14

Short blond hair in chat:
SetColorSpeed2Modifiers(0.01, 1.62)
2605537, 14

Short blond hair mainscreen:
SetColorSpeed2Modifiers(0.07, 0.86)
2009270, 22

ShortBlondHair / LongGreenSkirt ;; skin:
SetColorSpeed2Modifiers(0.10, 0.82);
4818102, 18

Found some interesting things, long skirt with a light green part is unique. If Molly has this long skirt w/ light green I can find the right molly by only using that detail. Also, the blond hair is unique and it barely matches the other blond hair from long hair. I'm not sure about the other hair styles with blond hair, I will check that out soon on the other Molly account I have.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New details from another account I lend, thanks bolshak25.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Molly with a brown knot and long skirt w/ dark green parts
———————————————–
———————————————–
Dark green skirt part:
SetColorSpeed2Modifiers(0.12, 2.77);
2240266, 5

Brown Knot mainscreen:
SetColorSpeed2Modifiers(0.24, 0.75);
1451564, 10

Brown Knot InChat:
SetColorSpeed2Modifiers(0.08, 0.22);
1650234, 7
———————————————–
———————————————–
Using these details @ start:

Using the dark green skirt part and molly hair part

Hopped around 8 times to get these colors so they should work well. The dark green skirt part is definately interesting, it is unique so I can easily use that to detect the Mollys. Another good thing to know is that the colors are the same, outside the grabber and inside the grabber. This means that I have to spend less time grabbing the colors.

I'm also surprised that the hair colors work so well. It won't be that hard to find the right hair colors inside because they aren't matching other hair colors. I expected that they matched so this makes it easier :)

If I can get the hair color and a special thing about the clothes of each Molly this will be easier to make than expected. It will still be hard though, but I expected the colors to mix up with eachother. Yet again, if anyone has an account that is in the Molly random event it would really help me about because I'm stuck with picking the colors right now as I have used my two accounts.

I will be going to the gym now and once I come back I'll work on the actual detecting using the details I have now!

——————————————————
Update for 11-06-2012
——————————————————
I've made a new breakthrough, it actually detects Molly now and gives it a tile and moves the hook there. It doesn't work 100% yet because I need to expand my tile system but it works when Molly is on the right grid. Now I have to combine the grids which will take some hours because of the different angles.. but I'll get that done today. Once that is done I will make a video of it navigating to my desired Molly.

I still need more accounts, I got 2 lended accounts & 2 of my own accounts right now.

Code:
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox, R: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

function MoveHook(Box: Integer): Boolean;
var
Debug: Boolean;
H, V, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
Debug := True;
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
if Debug then
begin
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');
end;

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
MouseBox(700, 325, 720, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
MouseBox(570, 325, 590, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
if Debug then
begin
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');
end;

if not(BoxSpot = HookBoxSpot) then
begin
WriteLn('Difference');
if (BoxSpot > HookBoxSpot) then
begin
WriteLn('BoxSpot > HookBoxSpot');
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 265, 650, 280, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 385, 650, 405, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
end;

procedure GetHookBoxes;
var
RedHook: TPointArray;

begin
// SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
SMART_ClearCanvas;
FindColorsSpiralTolerance(MSCX, MSCY, RedHook, 2373117, MSX1, MSY1, MSX2, MSY2, 5);
SMART_DrawDotsEx(False, RedHook, clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(RedHook).X1, GetTPABounds(RedHook).Y1, GetTPABounds(RedHook).X2, GetTPABounds(RedHook).Y2)], clYellow);
WriteLn(''+IntToStr(GetTPABounds(RedHook).X1)+', '+IntToStr(GetTPABounds(RedHook).Y1)+', '+IntToStr(GetTPABounds(RedHook).X2)+', '+IntToStr(GetTPABounds(RedHook).Y2)+'');
end;

function MollyFinder(Hue, Sat: Extended; Color, Tolerance, X1, Y1, X2, Y2: Integer; Width, Height:Integer; Sort: Boolean): TPoint;
var
Debug: Boolean;
Mods: Array of Integer;
ColorTPA, BootsTPA: TPointArray;
ColorATPA, BootsATPA: T2DPointArray;
P: TPoint;

begin
Mods := [8];
Debug := True;

// Molly TPointArray
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);
if FindColorsTolerance(ColorTPA, Color, X1, Y1, X2, Y2, Tolerance) then
begin
SplitTPAExWrap(ColorTPA, Width, Height, ColorATPA);
SortATPASize(ColorATPA, Sort);
if Debug then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(Color, X1, Y1, X2, Y2, Tolerance))+'');
SMART_DrawDotsEx(False, ColorTPA, clBlue);
SMART_DrawBoxes(False, [GetTPABounds(ColorATPA[0])], clYellow);
end;

// Boots TPointArray
P := MiddleTPA(ColorATPA[0]);
WriteLn('Middle boots: '+IntToStr(P.X)+', '+IntToStr(P.Y)+'');
SetColorSpeed2Modifiers(0.27, 0.83);
if FindColorsTolerance(BootsTPA, 1912122, P.X-10, P.Y-Mods[r], P.X+10, P.Y+Mods[r], 10) then
begin
SplitTPAExWrap(BootsTPA, 8, 3, BootsATPA);
SortATPASize(BootsATPA, True);
if Debug then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(1912122, P.X-10, P.Y-15, P.X+10, P.Y+15, 10))+'');
SMART_DrawBoxes(False, [IntToBox(P.X-15, P.Y-Mods[r], P.X+15, P.Y+Mods[r])], clPurple);
SMART_DrawDotsEx(False, BootsTPA, clGreen);
SMART_DrawBoxes(False, [GetTPABounds(BootsATPA[0])], clAqua);
end;
Result := Point(GetTPABounds(BootsTPA).X1, GetTPABounds(BootsTPA).Y2);
WriteLn('Molly position: '+IntToStr(Result.X)+', '+IntToStr(Result.Y)+'');
end;
end;

end;

function DetectedMolly: String;
begin
Result := 'DarkGreenSkirt';
end;

function MollyDetection: Integer;
var
X, i, k: Integer;
MollyPosition: TPoint;
YI, YII, Col, Tol, XSplit, YSplit, X1, Y1, X2, Y2, Multiplier: Array of Integer;
Hue, Sat: Array of Extended;
Row: Array[0..6] of Array[0..9] of TBox;

begin
YI := [47, 45, 46, 51, 54];
YII := [237, 259, 276, 263, 278];
Hue := [0.12];
Sat := [2.77];
Col := [2240266];
Tol := [5];
XSplit := [8];
YSplit := [8];

case DetectedMolly of
'DarkGreenSkirt': r := 0;
'LightGreenSkirt': r := 1;
end;

case HookPosition of
'Normal': begin
X := 0;
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 6 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (i * Multiplier[k]), Y1[k], X2[k] + (i * Multiplier[k]), Y2[k]);
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := (20 + (10 * i) + k);
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
end;
'OneLeft': begin
X := 1;
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 9 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := (10 + i);
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
'TwoLeft': begin
X := 0;
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 9 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := i;
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
'OneRight': begin
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 7 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := (90 + i);
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
'TwoRight': begin
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 7 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := (100 + i);
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
end;
WriteLn('Failed to find Molly spot, moving to a random generated spot near middle');
case Random(4) of
0: Result := RandomRange(33, 36);
1: Result := RandomRange(43, 46);
2: Result := RandomRange(53, 56);
3: Result := RandomRange(63, 66);
end;
WriteLn('Random spot in middle: '+IntToStr(Result)+'');
end;

begin
SetUpLogin;
SMART_ClearCanvas;
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
MoveHook(MollyDetection);
end.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12/06/2012
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Made some stuff work better in the morning, which includes better detection and extremely fast movement. Also made the debug better if it ever breaks I can use it easily.

SMART Initialized.
Loaded: Server 10, Members: False, Signed: True, Super Detail: False.
Current player:
Hook box position: 96
Counted Colors: 94
Middle point of molly boots: 350, 152
Counted Colors: 11
Molly position: 340, 157
Molly is in box: 82
BoxRow: 8
HookBoxRow: 9
HookBoxRow > BoxRow
Move left 1 times
H: 1
HookBoxspot: 6
Boxspot: 2
HookBoxspot > BoxSpot
Move down 4 times
V: 1
V: 2
V: 3
V: 4
Hook box position: 83
Counted Colors: 43
Middle point of molly boots: 426, 110
Counted Colors: 15
Molly position: 417, 114
Molly is in box: 94
BoxRow: 9
HookBoxRow: 8
BoxRow > HookBoxRow
Move Right 1 times
H: 1
HookBoxspot: 3
Boxspot: 4
Move up 1 times
V: 0
V: 1
Hook box position: 93
Counted Colors: 28
Middle point of molly boots: 343, 80
Counted Colors: 6
Molly position: 339, 83
Molly is in box: 96
BoxRow: 9
HookBoxRow: 9
Correct row
HookBoxspot: 3
Boxspot: 6
Move up 3 times
V: 0
V: 1
V: 1
V: 2
V: 2
V: 3
Hook box position: 95
Counted Colors: 28
Middle point of molly boots: 343, 80
Counted Colors: 6
Molly position: 339, 83
Molly is in box: 96
BoxRow: 9
HookBoxRow: 9
Correct row
HookBoxspot: 5
Boxspot: 6
Move up 1 times
V: 0
V: 1
Hook box position: 96
Counted Colors: 33
Middle point of molly boots: 334, 85
Counted Colors: 6
Molly position: 328, 88
Failed to find Molly spot, moving to a random generated spot near middle
Random spot in middle: 95
BoxRow: 9
HookBoxRow: 9
Correct row
HookBoxspot: 6
Boxspot: 5
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 97
Counted Colors: 26
Middle point of molly boots: 322, 109
Counted Colors: 15
Molly position: 322, 117
Molly is in box: 84
BoxRow: 8
HookBoxRow: 9
HookBoxRow > BoxRow
Move left 1 times
H: 1
HookBoxspot: 7
Boxspot: 4
HookBoxspot > BoxSpot
Move down 3 times
V: 1
V: 2
V: 3
Hook box position: 84
Counted Colors: 83
Middle point of molly boots: 435, 131
Counted Colors: 15
Molly position: 425, 139
Molly is in box: 93
BoxRow: 9
HookBoxRow: 8
BoxRow > HookBoxRow
Move Right 1 times
H: 1
HookBoxspot: 4
Boxspot: 3
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 92
Counted Colors: 58
Middle point of molly boots: 420, 125
Counted Colors: 12
Molly position: 410, 129
Molly is in box: 103
BoxRow: 10
HookBoxRow: 9
BoxRow > HookBoxRow
Move Right 1 times
H: 1
HookBoxspot: 2
Boxspot: 3
Move up 1 times
V: 0
V: 1
Hook box position: 102
Counted Colors: 51
Middle point of molly boots: 361, 124
Counted Colors: 13
Molly position: 351, 127
Molly is in box: 103
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 2
Boxspot: 3
Move up 1 times
V: 0
V: 1
Hook box position: 104
Counted Colors: 51
Middle point of molly boots: 361, 124
Counted Colors: 13
Molly position: 351, 127
Molly is in box: 103
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 4
Boxspot: 3
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 104
Counted Colors: 51
Middle point of molly boots: 361, 124
Counted Colors: 13
Molly position: 351, 127
Molly is in box: 103
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 4
Boxspot: 3
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 103
Counted Colors: 39
Middle point of molly boots: 355, 128
Counted Colors: 15
Molly position: 356, 136
Failed to find Molly spot, moving to a random generated spot near middle
Random spot in middle: 100
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 3
Boxspot: 0
HookBoxspot > BoxSpot
Move down 3 times
V: 1
V: 2
V: 3
Hook box position: 100
Counted Colors: 94
Middle point of molly boots: 296, 153
Counted Colors: 11
Molly position: 286, 158
Molly is in box: 82
BoxRow: 8
HookBoxRow: 10
HookBoxRow > BoxRow
Move left 2 times
H: 1
H: 2
HookBoxspot: 0
Boxspot: 2
Move up 2 times
V: 0
V: 1
V: 1
V: 2
Hook box position: 82
Counted Colors: 41
Middle point of molly boots: 412, 155
Counted Colors: 24
Molly position: 402, 157
Molly is in box: 82
Correct spot and row!
Successfully executed.

Newest code:
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox, R, PreviousBox: Integer;
Debug: Boolean;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;

begin
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

function MoveHook(Box: Integer): Boolean;
var
H, V, X, Y, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(700, 325, 720, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(570, 325, 590, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');

if not(BoxSpot = HookBoxSpot) then
begin
if (BoxSpot > HookBoxSpot) then
begin
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 265, 650, 280, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 385, 650, 405, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
Wait(500 + Random(250));
end;

function MollyFinder(Hue, Sat: Extended; Color, Tolerance, X1, Y1, X2, Y2: Integer; Width, Height:Integer; Sort: Boolean): TPoint;
var
Mods: Array of Integer;
ColorTPA, BootsTPA: TPointArray;
ColorATPA, BootsATPA: T2DPointArray;
P: TPoint;

begin
Mods := [8];

// Molly TPointArray
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);
if FindColorsTolerance(ColorTPA, Color, X1, Y1, X2, Y2, Tolerance) then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(Color, X1, Y1, X2, Y2, Tolerance))+'');
SplitTPAExWrap(ColorTPA, Width, Height, ColorATPA);
SortATPASize(ColorATPA, Sort);
if Debug then
begin
SMART_DrawDotsEx(False, ColorTPA, clBlue);
SMART_DrawBoxes(False, [GetTPABounds(ColorATPA[0])], clYellow);
end;

// Boots TPointArray
P := MiddleTPA(ColorATPA[0]);
WriteLn('Middle point of molly boots: '+IntToStr(P.X)+', '+IntToStr(P.Y)+'');
SetColorSpeed2Modifiers(0.27, 0.83);
if FindColorsTolerance(BootsTPA, 1912122, P.X-10, P.Y-Mods[r], P.X+10, P.Y+Mods[r], 10) then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(1912122, P.X-10, P.Y-15, P.X+10, P.Y+15, 10))+'');
SplitTPAExWrap(BootsTPA, 8, 3, BootsATPA);
SortATPASize(BootsATPA, True);
if Debug then
begin
SMART_DrawBoxes(False, [IntToBox(P.X-15, P.Y-Mods[r], P.X+15, P.Y+Mods[r])], clPurple);
SMART_DrawDotsEx(False, BootsTPA, clGreen);
SMART_DrawBoxes(False, [GetTPABounds(BootsATPA[0])], clAqua);
end;
Result := Point(GetTPABounds(BootsTPA).X1, GetTPABounds(BootsTPA).Y2);
WriteLn('Molly position: '+IntToStr(Result.X)+', '+IntToStr(Result.Y)+'');
end;
end;
end;

function DetectedMolly: String;
begin
Result := 'DarkGreenSkirt';
end;

function MollyDetection: Integer;
var
X, i, k: Integer;
MollyPosition: TPoint;
YI, YII, Col, Tol, XSplit, YSplit, X1, Y1, X2, Y2, Multiplier, Height: Array of Integer;
Hue, Sat: Array of Extended;
Row: Array[0..10] of Array[0..9] of TBox;

begin
YI := [47, 45, 46, 51, 54];
YII := [237, 259, 276, 263, 278];
Hue := [0.12];
Sat := [2.77];
Col := [2240266];
Tol := [5];
XSplit := [8];
YSplit := [8];

case DetectedMolly of
'DarkGreenSkirt': r := 0;
'LightGreenSkirt': r := 1;
end;

case HookPosition of
'Normal': begin
X := 0;
X1 := [61, 78, 92, 104, 114, 124, 132, 139, 146, 151];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [110, 126, 137, 146, 153, 160, 166, 171, 177, 180];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-2 * Multiplier[k]), Y1[k], X2[k] + (-2 * Multiplier[k]), Y2[k]);
1: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k], X2[k] + (-1 * Multiplier[k]), Y2[k]);
2..10: Row[i][k] := IntToBox(X1[k] + ((i-2) * Multiplier[k]), Y1[k], X2[k] + ((i-2) * Multiplier[k]), Y2[k]);
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'OneLeft': begin
X := 1;
X1 := [69, 89, 105, 118, 140, 151, 162, 172, 180, 186];
Y1 := [194, 167, 143, 123, 104, 90, 77, 66, 54, 43];
X2 := [118, 133, 144, 156, 169, 180, 188, 197, 204, 211];
Y2 := [224, 187, 160, 140, 117, 101, 86, 75, 64, 52];
Multiplier := [62, 56, 52, 48, 38, 36, 34, 33, 32, 31];
Height := [4, 3, 3, 3, 2, 2, 2, 1, 1, 1];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((i-1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((i-1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'TwoLeft': begin
X := 2;
X1 := [68, 98, 118, 137, 154, 172, 185, 197, 208, 217];
Y1 := [184, 158, 137, 119, 103, 89, 77, 66, 55, 46];
X2 := [120, 144, 160, 176, 190, 204, 216, 224, 234, 244];
Y2 := [210, 181, 152, 134, 115, 99, 86, 74, 61, 53];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 33, 31];
Height := [8, 7, 7, 6, 5, 4, 4, 3, 3, 2];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'OneRight': begin
X := 3;
X1 := [420, 386, 371, 360, 349, 338, 329, 321, 318, 310];
Y1 := [196, 167, 144, 123, 106, 89, 78, 64, 52, 40];
X2 := [470, 431, 412, 396, 378, 366, 355, 345, 339, 331];
Y2 := [222, 187, 160, 138, 118, 102, 88, 75, 60, 49];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 34, 32];
Height := [4, 4, 3, 3, 3, 3, 2, 2, 2, 2];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((-i+1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((-i+1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'TwoRight': begin
X := 4;
X1 := [396, 374, 355, 338, 324, 312, 300, 291, 285, 278];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66, 52, 41];
X2 := [447, 415, 399, 377, 359, 342, 331, 321, 311, 301];
Y2 := [210, 177, 153, 133, 115, 99, 86, 77, 64, 52];
Multiplier := [62, 56, 52, 48, 46, 43, 40, 38, 36, 34];
Height := [8, 8, 7, 6, 6, 6, 6, 5, 4, 3];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (-i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
end;
WriteLn('Failed to find Molly spot, moving to a random generated spot near middle');
Result := (PreviousBox + RandomRange(-5, 5));
WriteLn('Random spot in middle: '+IntToStr(Result)+'');
end;

procedure GetMollyFeetBoxes;
var
i: Integer;
Boots: TPointArray;
BootsSplit: T2DPointArray;

begin
//SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
//SMART_ClearCanvas;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.27, 0.83);
FindColorsSpiralTolerance(MSCX, MSCY, Boots, 1912122, MSX1, MSY1, MSX2, MSY2, 10);
SplitTPAExWrap(Boots, 8, 8, BootsSplit);
for i:=0 to high(BootsSplit) do
begin
SMART_DrawDotsEx(False, BootsSplit[i], clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(BootsSplit[i]).X1, GetTPABounds(BootsSplit[i]).Y1, GetTPABounds(BootsSplit[i]).X2, GetTPABounds(BootsSplit[i]).Y2)], clYellow);
SMART_DrawBoxes(False, [IntToBox(66-45, 210, 100-45, 234)], ClPurple);
WriteLn(''+IntToStr(GetTPABounds(BootsSplit[i]).X1)+', '+IntToStr(GetTPABounds(BootsSplit[i]).Y1)+', '+IntToStr(GetTPABounds(BootsSplit[i]).X2)+', '+IntToStr(GetTPABounds(BootsSplit[i]).Y2)+'');
end;
end;

begin
SetUpLogin;
Debug := False;
SMART_ClearCanvas;
//MollyDetection;
repeat
SMART_ClearCanvas;
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
//MoveHook(MollyDetection);
until(MoveHook(MollyDetection));
end.

Will be working on making it a bit more accurate then I'll add new Molly's. So far this is just one Molly detection but the full code is basicly done, just need specific characteristics about the different Molly's to define which Molly needs to be catched.

Video of the newest code:
Uploading right now.
http://www.youtube.com/watch?v=LC7frlVsBlI
[youtube]LC7frlVsBlI[/youtube]

I just input new colors in my code and it actually worked straight away to detect molly #2.
Glad it works :D

==========================================================
12/06/2012
The importance of hopping worlds:

I've mainly been working on detecting Molly today. Detecting the green variant isn't that hard, but so far I haven't been able to pick the correct colors for the red variant. The colors are just all matching over the place and sometimes they are even matching more times at wrong spots than the right spot.. So I will be checking out the yellow variant tomorrow (red & yellow Molly on my own two accounts, green @ lended account).

I'm thinking of trying a DDTM to get the Molly hair/clothes and then use that with some maths to get the right molly. Making a DTM myself worked fairly well but I have to use maths at the DDTM because of the perspective.. Jagex definately made it hard.

If a DDTM doesn't work properly I will use the hair colors. This has a 50% success rate at chance #1 and a 100% success rate at chance #2 and overall a 100% success rate of grabbing the evil twin. I would like to see if there is another way to grab the right molly with 100% accuracy straight away, though. If not, I will use hair colors. If you grab the wrong Molly it will disappear which means that the right molly is the only one visible on the grid.

———————————
17/07/2012
I haven't stopped working on making a solver, but unfortunately I'm stuck. After spending atleast 30 hours on trying to make a solver in the past week I have no idea how to continue anymore. Jagex has made it incredibly hard - if not impossible - to make a solver purely based on colors:

== Using hair color: ==

Blond hair: matches with cage, tiles on wall and earrings
Light brown hair: matches with tiles on wall, boots and boxes
Dark brown hair: matches with boots and boxes
Red hair: matches with tiles on wall and red clothes

Searching for skin color near the hair color does not work either.
If molly is next to the boxes at the background it will detect skin color near..
but it doesnt use the hair color but it uses the color of the boxes.

Which means it will return a false result. This basicly means that using the hair color
is not a viable option.

== Making a DDTM: ==
Making a DDTM has some negative side effects aswell.
One of the first things to handle is that Molly slightly changes position every time you log out/in
It isn't that hard to get around that. You can filter points and get a box around Molly,
then you can grab certain points such as the middle point of the box and the top point / bottom point,
or you can just add some other stuff.

Eventually it grabbed the middle point, the hair color, the pants and the arm color perfectly.
The problem is that the perspective of the Molly's is changing at the other room.
But that is not all, once you pass the door the colors won't match anymore. Obviously you
can add tolerance, but the colors simply aren't matching anymore.

About the perspective changing, you can use DTM rotated and some other stuff but it will
still return false results. Some times it will use the red color of the torches instead of the
red color of the clothes of Molly. Sometimes it will use the brown color of the boxes instead of the
brown hair color of Molly. Sometimes it will use the yellow color of the tiles on the wall
instead of the blond hair color of Molly. And the list goes on….

This makes means that a DDTM doesn't work properly.

== Making a bitmap of the hair: ==
I've also tried to make a bitmap of the hair by using the BitmapFromClient() procedure.
I got the coords by using the same method as making a DDTM. As explained before you unfortunately
can't ust static coords to grab the Molly hair color. Anyways, once you make a 3x3 px DTM of the hair
and try to change for it you get the perspective problem again..

I tried FindBitmapToleranceIn and even used RotateBitmap and a combination of those (eg. rotating bitmap
for some degrees, searching again, increasing tolerance 5 times, etc.)

So yeah. Making a bitmap of the hairdoesn't work either.

== Making a bitmap of the clothes: ==
Just doesn't work. Will detect the other molly's aswell.

== Using the colors of the clothes: ==
Just doesn't work. Will detect the other molly's aswell.



Other options?
I have no idea. I have added the script that I have made. It works fairly well, it does return
the right color of Molly's hair but it looks close to impossible to me to actually return
the coords of Molly.

The "only" thing that needs to be done to complete the solver is to return molly's position.
If someone can make a function that returns the position of molly's haircolor it would be
greatly appreciated.

Once the molly's hair coordinate is known you can just go down in height to get near the feet.
Once you know the feet coords of the desired Molly with the desired hair color you can input it
in the function I made which converts the TPoint to a Box Number.

Then you can input the box number in the grabber function and it will move there.

Unfortunately I can't upload a .rar with all info to Villavu as it is too big but here is the link:

Contains images, dtm's, aca, simba scripts and probably more stuff. Basicly everything I've made in the 30 hours or so I've been working on this…

https://rapidshare.com/files/1840437750/MollyDetails.rar

Also added the actual .simba file as an attachment.

—————————————————————-
19/06/2012

I have been working on it again because it would be satisfying if this actually worked. I've managed to make it work now for four out of five hair colors, I just need one Molly account from someone (or if my own accounts got one again) to finish it. I would also appreciate fresh accounts to test it, but obviously that will also happen once this has been implemented.

Code added as attachement, MollyRandom V20

—————————————————————-
20/06/2012
Bolshak25 has lend me another account, great! Unfortunately it was a dark blond Molly and not a light blond molly :( I still need a Light Blond Molly (short blond hair usually = light blond) to complete this. Just need to grab the colors when in chat so yeah..

I used the account to check if the color still worked and it nearly full solved the random event. Unfortunately the door colors aren't the same in room #2 so it didn't click on the door properly.. but I will be fixing that now as I still have one account in the random event.

Currently rendering a video of two full Molly solves, and I will be uploading it soon aswell so yeah. So close to completion.

Video:
www.youtube.com/watch?v=Jl4AHSUD4aM
[youtube]Jl4AHSUD4aM[/youtube]

honeyhoney

2012-05-25 20:32:06

This just grabs the first Molly that walks into the square that is 2 right and 1 up from the centre? Correct?

Is the first Molly always the Evil Twin?

bg5

2012-05-25 20:41:01

I think for molly random we generally need two components:
- perspective grid
- color grabber at beginning
I will look on Molly if I (ever) end Leo ,also I can help if anyone work on it.

J J

2012-05-26 05:13:15

From: honeyhoney
This just grabs the first Molly that walks into the square that is 2 right and 1 up from the centre? Correct?

Is the first Molly always the Evil Twin?

Well you can't grab the Molly that walks there first because you can't grab while walking. I tried it multiple times even with a 1 ms accuracy of the molly stepping on the tile but it still didn't grab it. So once the molly passes that tile it will go a couple tiles to the right and grab it anyways. I'm not sure if it works, it's all based on [J]ustin's suggestion.

From: beginner5
I think for molly random we generally need two components:
- perspective grid
- color grabber at beginning
I will look on Molly if I (ever) end Leo ,also I can help if anyone work on it.

Yeah I don't think this will work at all times. Need to make a grid of the grabber to know where the grabber is. Then make some sort of formula to calculate how many tiles to the north/east/right/south it should go.

But before you can do that you need to know what molly to grab and also divide the mainscreen in tiles where it can find the molly's. Probably counting the colors or something to know where molly is, then use the other function to control the grabber there.

In the meantime molly has probably moved but after a while the tiles should match and then then you can simply press the grab button and it's done.

Will take quite a lot time to develop though. I've made some videos of the molly movements and I will do some research today about the patterns etc.

bg5

2012-05-28 20:11:28

Molly is in static position at beginning ,so grabbing colors ,shouldn't be problem.
So we need only to grab like 3 colors (hair ,body ,legs) ,then find these colors in catcher screen ,filter one Molly ,which contains all 3 color ( can be failsafe here : if not FindAnyMoly then Inc(tolerance) ) and assign Molly to one tile.
Additionally you can reverse background's colors to get outline of Molly ,so you will know point of interface Molly with ground ,to get over screen depth.

Basically grid is the clue ,but I see some talented people here familiar with 3d projection :P

shstiger2009

2012-05-28 23:11:21

Someone posted a function that identifies one object from 2 TPA's. Different colors. The function then identified the object if those 2 colors were a certain area away from one another. This seems like it would do the job perfectly. I just don't know who posted it…ahhh.

Kyle Undefined

2012-05-28 23:24:18

Runaway did a TPACluster recently, and iirc, it was beginner5 who did the 2 TPA to 1.

J J

2012-05-29 13:25:13

From: beginner5
Molly is in static position at beginning ,so grabbing colors ,shouldn't be problem.
So we need only to grab like 3 colors (hair ,body ,legs) ,then find these colors in catcher screen ,filter one Molly ,which contains all 3 color ( can be failsafe here : if not FindAnyMoly then Inc(tolerance) ) and assign Molly to one tile.
Additionally you can reverse background's colors to get outline of Molly ,so you will know point of interface Molly with ground ,to get over screen depth.

Basically grid is the clue ,but I see some talented people here familiar with 3d projection :P

Yeah I've actually been working on making a grid.. well just the idea of where to place it and how to identify it. It's in the video at the end of this post.
I would really like to work on this, will work on it every time I get a molly random haha.. Unfortunately not that often!

From: shstiger2009
Someone posted a function that identifies one object from 2 TPA's. Different colors. The function then identified the object if those 2 colors were a certain area away from one another. This seems like it would do the job perfectly. I just don't know who posted it…ahhh.

Yeah a couple have been made, I've also made my own :P

From: Kyle Undefined
Runaway did a TPACluster recently, and iirc, it was beginner5 who did the 2 TPA to 1.

I made a custom function to combine 2 TPA's with CTS 2 aswell, used in this script here, http://villavu.com/forum/showthread.php?t=82872
Not sure about the others, I do know about RunAway's CTS 1 TPACluster though but it wasn't accurate enough for me :P

I think I never posted this video. Shows some of the molly locations where they will always pass. Has just been tested on one account though but I'm pretty sure it is static.

http://www.youtube.com/watch?v=ulQDOSYUAJ0
[youtube]ulQDOSYUAJ0[/youtube]

KillaKev

2012-06-07 19:15:46

Just gave it a go with the script provided in the rar. The script runs, it operates the machine, however…it caught an innocent civilian. I recorded the script running incase you may wish to look at it later.

Edit: I ran the script twice, since you are given two tries for the random. Unfortunately both times failed.

J J

2012-06-08 04:28:58

From: KillaKev
Just gave it a go with the script provided in the rar. The script runs, it operates the machine, however…it caught an innocent civilian. I recorded the script running incase you may wish to look at it later.

Edit: I ran the script twice, since you are given two tries for the random. Unfortunately both times failed.

Ah, looks like we are going to need to make an actual detection system because apparantly the molly's aren't going to the same spot every time. Thanks for letting me know :p

John

2012-06-08 08:41:14

From: J J
Ah, looks like we are going to need to make an actual detection system because apparantly the molly's aren't going to the same spot every time. Thanks for letting me know :p

Have you ever used MMToMSEx?
Could you just identify which "Molly" you need to find then MMToMSEx Backwards to find her current position and some how mark her Npc dot and track the dot, while trying to move the Hook To Her.
I'm quite sure MMToMSEx has some significant Features that could help us make this random solvable. Plus you would need to track where the claw is actually at or just track your movements from the start(Since it always starts in the same square)

But those are just my thoughts.
Gl, ~John

J J

2012-06-08 09:06:19

From: John
Have you ever used MMToMSEx?
Could you just identify which "Molly" you need to find then MMToMSEx Backwards to find her current position and some how mark her Npc dot and track the dot, while trying to move the Hook To Her.
I'm quite sure MMToMSEx has some significant Features that could help us make this random solvable. Plus you would need to track where the claw is actually at or just track your movements from the start(Since it always starts in the same square)

But those are just my thoughts.
Gl, ~John

Interesting thoughts yeah. The first thing I would work on is making the Hook work correctly. Basicly being able to detect where it is and move it to any position. Once that works I would probably work on detecting the hairstyle of Molly, outside of the Grabbing/Hook thing. Just when you are talking to her at the beginning. And then the last thing to do is to detect the hairstyle while using the grabber and convert it to a tile. Then input that tile in the Hook mover function which would move to that tile. In the meantime Molly would probably move, but after a while (1-3 times of moving the Hook/Grabber) Molly will stand still and the hook will be close, so you can actually grab her.

Currently trying to get my noob accounts in the Molly random, basicly botting RuneSpan as the random event rate is pretty high. So far (60 runecrafting on all three) I have pretty much got every random except Molly.. I will be off to a friends for the next two days, but after that I will be running RuneSpan again to get the random :P

Just since I've made this thread I haven't been into a Molly Random on any of my accounts.

bolshak25

2012-06-08 10:32:05

ill pm you the account i got into molly. i was planning on working with it, but i got sidetrackked. you can keep it for as long as you need because its one of my random getting accounts for purposes like these

Sin

2012-06-08 10:42:01


function M_MoveJoystick(Direction:String):Boolean;
var
curPos:TPoint;
endPos:TPoint;
begin
if not LoggedIn then
exit;
GetMousePos(curPos.x,curPos.y);
case lowercase(Direction) of
'right': Mousebox(706, 317, 726, 345, 1);
'up': Mousebox(628, 259, 657, 279, 1);
end;
GetMousePos(endPos.x,endPos.y);
if not ((curPos.x = endPos.x) and (curPos.y = endPos.y)) then
Result := True;
end;

Jakkle

2012-06-08 12:56:24

You could use MS co-ords to locate where the evil twin and the claw both are then using where molly is compared to the claw, click the arrows accordingly.

mollyPos := Finding her colour and returning the pos of her on the MS;
clawPos := Finding the claws marker on the floor and returning the MS pos
while (clawPos(x,y) <> mollyPos(x,y)) do
begin
if (clawPos.x < mollyPos.x) then
clickLeft;
if (clawPos.x > mollyPos.x) then
clickRight;
if (clawPos.y < mollyPos.y) then
clickUp;
if (clawPos.y > mollyPos.y) then
clickDown;
end;
if (clawPos(x,y) = mollyPos(x,y)) then
begin
clickButton;
if WeHaveMolly then
begin
Result := True;
Exit;
end else
Retry;
end else
Retry;

You would have to put offset's, finding where molly stands compaired to the marker on the floor.

Obviously you would have to create all the functions and everything else.
I posted this because it's just what came into mind and thought I would see what you think. I'm sure there are many ways of figuring it out. Good luck with sorting it out. :)

Ashaman88

2012-06-08 13:47:31

This may have already been said, but we don't need to chase the twin down, if you can identify just 1 spot where she walks, then move the target there and wait for her to come to that spot again (she does the same loop, just a different loop every time you get the random)

John

2012-06-09 08:02:11

From: ashaman88
This may have already been said, but we don't need to chase the twin down, if you can identify just 1 spot where she walks, then move the target there and wait for her to come to that spot again (she does the same loop, just a different loop every time you get the random)

IMO I'd prefer it to actually go after it, Jagex could easily pick up on a bot if we all stopped at a certain place.

J J

2012-06-09 11:38:16

procedure Test;
var
RedHook: TPointArray;

begin
// SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
FindColorsSpiralTolerance(MSCX, MSCY, RedHook, 2373117, MSX1, MSY1, MSX2, MSY2, 5);
SMART_DrawDotsEx(False, RedHook, clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(RedHook).X1, GetTPABounds(RedHook).Y1, GetTPABounds(RedHook).X2, GetTPABounds(RedHook).Y2)], clYellow);
SMART_DrawLine(False, Point(0, 0), Point(0, 10), clRed);
end;

procedure GridSystem;
var
i: Integer;
Row: Array[0..8] of Array[0..6] of TBox;

begin
SMART_ClearCanvas;

for i:=0 to 6 do
begin
Row[0][i] := IntToBox(83 + (i * 52), 178, 121 + (i * 52), 199);
SMART_DrawBoxes(False, [Row[0][i]], clRed);

Row[1][i] := IntToBox(97 + (i * 48), 152, 132 + (i * 48), 171);
SMART_DrawBoxes(False, [Row[1][i]], clRed);

Row[2][i] := IntToBox(109 + (i * 45), 130, 141 + (i * 45), 145);
SMART_DrawBoxes(False, [Row[2][i]], clRed);

Row[3][i] := IntToBox(120 + (i * 41), 112, 148 + (i * 41), 124);
SMART_DrawBoxes(False, [Row[3][i]], clRed);

Row[4][i] := IntToBox(129 + (i * 39), 95, 156 + (i * 39), 106);
SMART_DrawBoxes(False, [Row[4][i]], clRed);

Row[5][i] := IntToBox(137 + (i * 36), 81, 162 + (i * 36), 90);
SMART_DrawBoxes(False, [Row[5][i]], clRed);

Row[6][i] := IntToBox(144 + (i * 34), 68, 167 + (i * 34), 77);
SMART_DrawBoxes(False, [Row[6][i]], clRed);

Row[7][i] := IntToBox(150 + (i * 32), 57, 173 + (i * 32), 64);
SMART_DrawBoxes(False, [Row[7][i]], clRed);

Row[8][i] := IntToBox(156 + (i * 31), 47, 177 + (i * 31), 53);
SMART_DrawBoxes(False, [Row[8][i]], clRed);
end;
end;

procedure GridSystem2;
var
i, j: Integer;
Multipliers, X1, Y1, X2, Y2: Array[0..8] of Integer;
Row: Array[0..8] of Array[0..6] of TBox;

begin
Multipliers := [52, 48, 45, 41, 39, 36, 34, 32, 31];
X1 := [83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [199, 171, 145, 124, 106, 90, 77, 64, 53];

SMART_ClearCanvas;

for j:=0 to 8 do
begin
for i:=0 to 6 do
begin
Row[j][i] := IntToBox(X1[j] + (j * Multipliers[j]), Y1[j], X2[j] + (j * Multipliers[j]), Y2[j]);
SMART_DrawBoxes(False, [Row[j][i]], clRed);
end;
end;
end;
GridSystem2 does not work yet but I'm off to friends to watch The Netherlands play football at the EK or however you translate it.

This is a picture of all the possible hook spots with a normal angle (1 spot to west/east or more rotates the angle)

GridSystem procedure = red
Hook spots = yellow

Only the gridsystem

Thanks bolshak25 for lending me an account, will be working on it tomorrow!

EDIT: Actually worked on it for another 2 hours today.


I've now finished the code to define what grid to make. There are a couple spots where the hook can be where the angle is normal. My grid for that is already done as seen above. Now I will need to make grids for when the angles change. Once those grids are done I can get the exact hook position. Once that is done I think the biggest part is done already, just need to know what molly to grab and with some maths I can calculate the things to do with the joystick to grab molly.

program Test;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

procedure NormalGridSystem;
var
i: Integer;
Row: Array[0..8] of Array[0..6] of TBox;
Debug: Boolean;

begin
Debug := True;
for i:=0 to 6 do
begin
Row[0][i] := IntToBox(83 + (i * 52), 178, 121 + (i * 52), 199);
Row[1][i] := IntToBox(97 + (i * 48), 152, 132 + (i * 48), 171);
Row[2][i] := IntToBox(109 + (i * 45), 130, 141 + (i * 45), 145);
Row[3][i] := IntToBox(120 + (i * 41), 112, 148 + (i * 41), 124);
Row[4][i] := IntToBox(129 + (i * 39), 95, 156 + (i * 39), 106);
Row[5][i] := IntToBox(137 + (i * 36), 81, 162 + (i * 36), 90);
Row[6][i] := IntToBox(144 + (i * 34), 68, 167 + (i * 34), 77);
Row[7][i] := IntToBox(150 + (i * 32), 57, 173 + (i * 32), 64);
Row[8][i] := IntToBox(156 + (i * 31), 47, 177 + (i * 31), 53);

if Debug then
begin
SMART_DrawBoxes(False, [Row[0][i]], clRed);
SMART_DrawBoxes(False, [Row[1][i]], clRed);
SMART_DrawBoxes(False, [Row[2][i]], clRed);
SMART_DrawBoxes(False, [Row[3][i]], clRed);
SMART_DrawBoxes(False, [Row[4][i]], clRed);
SMART_DrawBoxes(False, [Row[5][i]], clRed);
SMART_DrawBoxes(False, [Row[6][i]], clRed);
SMART_DrawBoxes(False, [Row[7][i]], clRed);
SMART_DrawBoxes(False, [Row[8][i]], clRed);
end;
end;
end;

function FenceAngle: Boolean;
var
Debug: Boolean;
FenceColors: TPointArray;
FenceSplit: T2DPointArray;
Opposite, Adjacent, Angle: Extended;

begin
Debug := True;
SMART_ClearCanvas;

if FindColorsSpiralTolerance(MSCX, MSCY, FenceColors, 2574713, MSX1, MSY1, MSX2, MSY2, 15) then
begin
SplitTPAExWrap(FenceColors, 15, 15, FenceSplit);
SortATPASize(FenceSplit, True);
Opposite := (GetTPABounds(FenceSplit[0]).Y2 - GetTPABounds(FenceSplit[0]).X1);
Adjacent := (GetTPABounds(FenceSplit[0]).X2 - GetTPABounds(FenceSplit[0]).X1);
Angle := ArcTan((Opposite/Adjacent));

if Debug then
begin
SMART_DrawDotsEx(False, FenceSplit[0], clPurple);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1, GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2)], ClRed);
SMART_DrawLine(False, Point(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1), Point(GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2), clYellow);
WriteLn('Opposite: '+ToStr(Opposite)+'');
WriteLn('Adjacent: '+ToStr(Adjacent)+'');
WriteLn('Angle: '+ToStr(Angle)+'');
end;

if (Angle > 0.412) and (Angle < 0.418) then
Result := True;
end;
end;

function HookPosition: String;
var
Debug: Boolean;
X1, Y1, X2, Y2: Array of Integer;
i, CountedColors, Highest: Integer;

begin
Debug := True;
X1 := [85, 74, 417, 429];
Y1 := [26, 30, 25, 28];
X2 := [99, 89, 430, 443];
Y2 := [36, 40, 36, 40];

if not(FenceAngle) then
begin
if Debug then
begin
SMART_DrawBoxes(False, [IntToBox(85, 26, 99, 36)], clRed); // Left 2 steps
SMART_DrawBoxes(False, [IntToBox(74, 30, 89, 40)], clYellow); // Left 1 step
SMART_DrawBoxes(False, [IntToBox(417, 25, 430, 36)], clPurple); // Right 2 steps
SMART_DrawBoxes(False, [IntToBox(429, 28, 443, 40)], clAqua); // Right 1 step
end;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.13);
for i:=0 to 3 do
begin
CountedColors := CountColorTolerance(3437619, X1[i], Y1[i], X2[i], Y2[i], 10);
if CountedColors > Highest then
begin
Highest := CountedColors;
case i of
0: Result := 'TwoLeft';
1: Result := 'OneLeft';
2: Result := 'TwoRight';
3: Result := 'OneRight';
end;
end;
if Debug then
WriteLn('Counted colors in Box '+IntToStr(i)+': '+IntToStr(CountColorTolerance(3437619, X1[i], Y1[i], X2[i], Y2[i], 10))+'');
end;
end else
begin
Result := 'Normal';
end;
end;


begin
SetUpLogin;
case HookPosition of
'Normal': NormalGridSystem;
'TwoLeft': WriteLn('TwoLeft');
'OneLeft': WriteLn('OneLeft');
'TwoRight': WriteLn('TwoRight');
'OneRight': WriteLn('OneRight');
end;
end.

Been working on it for around 3-4 hours so far I think so there is some nice progress. Finishing the other grids tomorrow which will take like 30 mins per grid = 2 hours. Then I'll work on checking in what box the hook is etc. so I will have the hook location done tomorrow definately. Excited to finish this, and I enjoy the maths :)

momotron

2012-06-10 18:04:46

This is very impressive! Well done and keep up the good work, if you need any help, just skype me.

Bob The Cat

2012-06-10 18:09:36

Off Topic: Triest hoe Nederland speelde tegen de Denen had echt nooit mogen gebeuren.


On Topic: Good to see that your making progess! i really think we need more people like you working on randoms. I be glad to start helping after i learned more.

John

2012-06-10 18:59:38

From: J J
procedure Test;
var
RedHook: TPointArray;

begin
// SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
FindColorsSpiralTolerance(MSCX, MSCY, RedHook, 2373117, MSX1, MSY1, MSX2, MSY2, 5);
SMART_DrawDotsEx(False, RedHook, clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(RedHook).X1, GetTPABounds(RedHook).Y1, GetTPABounds(RedHook).X2, GetTPABounds(RedHook).Y2)], clYellow);
SMART_DrawLine(False, Point(0, 0), Point(0, 10), clRed);
end;

procedure GridSystem;
var
i: Integer;
Row: Array[0..8] of Array[0..6] of TBox;

begin
SMART_ClearCanvas;

for i:=0 to 6 do
begin
Row[0][i] := IntToBox(83 + (i * 52), 178, 121 + (i * 52), 199);
SMART_DrawBoxes(False, [Row[0][i]], clRed);

Row[1][i] := IntToBox(97 + (i * 48), 152, 132 + (i * 48), 171);
SMART_DrawBoxes(False, [Row[1][i]], clRed);

Row[2][i] := IntToBox(109 + (i * 45), 130, 141 + (i * 45), 145);
SMART_DrawBoxes(False, [Row[2][i]], clRed);

Row[3][i] := IntToBox(120 + (i * 41), 112, 148 + (i * 41), 124);
SMART_DrawBoxes(False, [Row[3][i]], clRed);

Row[4][i] := IntToBox(129 + (i * 39), 95, 156 + (i * 39), 106);
SMART_DrawBoxes(False, [Row[4][i]], clRed);

Row[5][i] := IntToBox(137 + (i * 36), 81, 162 + (i * 36), 90);
SMART_DrawBoxes(False, [Row[5][i]], clRed);

Row[6][i] := IntToBox(144 + (i * 34), 68, 167 + (i * 34), 77);
SMART_DrawBoxes(False, [Row[6][i]], clRed);

Row[7][i] := IntToBox(150 + (i * 32), 57, 173 + (i * 32), 64);
SMART_DrawBoxes(False, [Row[7][i]], clRed);

Row[8][i] := IntToBox(156 + (i * 31), 47, 177 + (i * 31), 53);
SMART_DrawBoxes(False, [Row[8][i]], clRed);
end;
end;

procedure GridSystem2;
var
i, j: Integer;
Multipliers, X1, Y1, X2, Y2: Array[0..8] of Integer;
Row: Array[0..8] of Array[0..6] of TBox;

begin
Multipliers := [52, 48, 45, 41, 39, 36, 34, 32, 31];
X1 := [83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [199, 171, 145, 124, 106, 90, 77, 64, 53];

SMART_ClearCanvas;

for j:=0 to 8 do
begin
for i:=0 to 6 do
begin
Row[j][i] := IntToBox(X1[j] + (j * Multipliers[j]), Y1[j], X2[j] + (j * Multipliers[j]), Y2[j]);
SMART_DrawBoxes(False, [Row[j][i]], clRed);
end;
end;
end;
GridSystem2 does not work yet but I'm off to friends to watch The Netherlands play football at the EK or however you translate it.

This is a picture of all the possible hook spots with a normal angle (1 spot to west/east or more rotates the angle)

GridSystem procedure = red
Hook spots = yellow

Only the gridsystem

Thanks bolshak25 for lending me an account, will be working on it tomorrow!

EDIT: Actually worked on it for another 2 hours today.


I've now finished the code to define what grid to make. There are a couple spots where the hook can be where the angle is normal. My grid for that is already done as seen above. Now I will need to make grids for when the angles change. Once those grids are done I can get the exact hook position. Once that is done I think the biggest part is done already, just need to know what molly to grab and with some maths I can calculate the things to do with the joystick to grab molly.

program Test;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

procedure NormalGridSystem;
var
i: Integer;
Row: Array[0..8] of Array[0..6] of TBox;
Debug: Boolean;

begin
Debug := True;
for i:=0 to 6 do
begin
Row[0][i] := IntToBox(83 + (i * 52), 178, 121 + (i * 52), 199);
Row[1][i] := IntToBox(97 + (i * 48), 152, 132 + (i * 48), 171);
Row[2][i] := IntToBox(109 + (i * 45), 130, 141 + (i * 45), 145);
Row[3][i] := IntToBox(120 + (i * 41), 112, 148 + (i * 41), 124);
Row[4][i] := IntToBox(129 + (i * 39), 95, 156 + (i * 39), 106);
Row[5][i] := IntToBox(137 + (i * 36), 81, 162 + (i * 36), 90);
Row[6][i] := IntToBox(144 + (i * 34), 68, 167 + (i * 34), 77);
Row[7][i] := IntToBox(150 + (i * 32), 57, 173 + (i * 32), 64);
Row[8][i] := IntToBox(156 + (i * 31), 47, 177 + (i * 31), 53);

if Debug then
begin
SMART_DrawBoxes(False, [Row[0][i]], clRed);
SMART_DrawBoxes(False, [Row[1][i]], clRed);
SMART_DrawBoxes(False, [Row[2][i]], clRed);
SMART_DrawBoxes(False, [Row[3][i]], clRed);
SMART_DrawBoxes(False, [Row[4][i]], clRed);
SMART_DrawBoxes(False, [Row[5][i]], clRed);
SMART_DrawBoxes(False, [Row[6][i]], clRed);
SMART_DrawBoxes(False, [Row[7][i]], clRed);
SMART_DrawBoxes(False, [Row[8][i]], clRed);
end;
end;
end;

function FenceAngle: Boolean;
var
Debug: Boolean;
FenceColors: TPointArray;
FenceSplit: T2DPointArray;
Opposite, Adjacent, Angle: Extended;

begin
Debug := True;
SMART_ClearCanvas;

if FindColorsSpiralTolerance(MSCX, MSCY, FenceColors, 2574713, MSX1, MSY1, MSX2, MSY2, 15) then
begin
SplitTPAExWrap(FenceColors, 15, 15, FenceSplit);
SortATPASize(FenceSplit, True);
Opposite := (GetTPABounds(FenceSplit[0]).Y2 - GetTPABounds(FenceSplit[0]).X1);
Adjacent := (GetTPABounds(FenceSplit[0]).X2 - GetTPABounds(FenceSplit[0]).X1);
Angle := ArcTan((Opposite/Adjacent));

if Debug then
begin
SMART_DrawDotsEx(False, FenceSplit[0], clPurple);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1, GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2)], ClRed);
SMART_DrawLine(False, Point(GetTPABounds(FenceSplit[0]).X1, GetTPABounds(FenceSplit[0]).Y1), Point(GetTPABounds(FenceSplit[0]).X2, GetTPABounds(FenceSplit[0]).Y2), clYellow);
WriteLn('Opposite: '+ToStr(Opposite)+'');
WriteLn('Adjacent: '+ToStr(Adjacent)+'');
WriteLn('Angle: '+ToStr(Angle)+'');
end;

if (Angle > 0.412) and (Angle < 0.418) then
Result := True;
end;
end;

function HookPosition: String;
var
Debug: Boolean;
X1, Y1, X2, Y2: Array of Integer;
i, CountedColors, Highest: Integer;

begin
Debug := True;
X1 := [85, 74, 417, 429];
Y1 := [26, 30, 25, 28];
X2 := [99, 89, 430, 443];
Y2 := [36, 40, 36, 40];

if not(FenceAngle) then
begin
if Debug then
begin
SMART_DrawBoxes(False, [IntToBox(85, 26, 99, 36)], clRed); // Left 2 steps
SMART_DrawBoxes(False, [IntToBox(74, 30, 89, 40)], clYellow); // Left 1 step
SMART_DrawBoxes(False, [IntToBox(417, 25, 430, 36)], clPurple); // Right 2 steps
SMART_DrawBoxes(False, [IntToBox(429, 28, 443, 40)], clAqua); // Right 1 step
end;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.03, 0.13);
for i:=0 to 3 do
begin
CountedColors := CountColorTolerance(3437619, X1[i], Y1[i], X2[i], Y2[i], 10);
if CountedColors > Highest then
begin
Highest := CountedColors;
case i of
0: Result := 'TwoLeft';
1: Result := 'OneLeft';
2: Result := 'TwoRight';
3: Result := 'OneRight';
end;
end;
if Debug then
WriteLn('Counted colors in Box '+IntToStr(i)+': '+IntToStr(CountColorTolerance(3437619, X1[i], Y1[i], X2[i], Y2[i], 10))+'');
end;
end else
begin
Result := 'Normal';
end;
end;


begin
SetUpLogin;
case HookPosition of
'Normal': NormalGridSystem;
'TwoLeft': WriteLn('TwoLeft');
'OneLeft': WriteLn('OneLeft');
'TwoRight': WriteLn('TwoRight');
'OneRight': WriteLn('OneRight');
end;
end.

Been working on it for around 3-4 hours so far I think so there is some nice progress. Finishing the other grids tomorrow which will take like 30 mins per grid = 2 hours. Then I'll work on checking in what box the hook is etc. so I will have the hook location done tomorrow definately. Excited to finish this, and I enjoy the maths :)


Wow Mate excellent! How are you planning on differentiating the Molly's?

CephaXz

2012-06-10 19:02:17

Wow, I'm impressed with your work there.

Maybe differentiate with the hair color? Probably only have 2 woman with the same hair color, so if the first one is incorrect, you go for the second one? :p

Olly

2012-06-10 19:41:25

From: CephaXz
Wow, I'm impressed with your work there.

Maybe differentiate with the hair color? Probably only have 2 woman with the same hair color, so if the first one is incorrect, you go for the second one? :p


That's actually exactly what I do legit, I just get the hair colour, if I pick the wrong one no worries il go for the other :P

Justin

2012-06-11 00:48:17

Fantastic to see some development on this random event!

J J

2012-06-11 02:00:26

Hm I've nearly really responded to some comments.

From: bolshak25
ill pm you the account i got into molly. i was planning on working with it, but i got sidetrackked. you can keep it for as long as you need because its one of my random getting accounts for purposes like these

Thanks, that is the one I've been using :)

From: Shay

function M_MoveJoystick(Direction:String):Boolean;
var
curPos:TPoint;
endPos:TPoint;
begin
if not LoggedIn then
exit;
GetMousePos(curPos.x,curPos.y);
case lowercase(Direction) of
'right': Mousebox(706, 317, 726, 345, 1);
'up': Mousebox(628, 259, 657, 279, 1);
end;
GetMousePos(endPos.x,endPos.y);
if not ((curPos.x = endPos.x) and (curPos.y = endPos.y)) then
Result := True;
end;

I ended up making something similiar.
function MoveHook(Box: Integer): Boolean;
var
Debug: Boolean;
H, V, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
Debug := True;
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
if Debug then
begin
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');
end;

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
MouseBox(700, 325, 720, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
MouseBox(570, 325, 590, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
if Debug then
begin
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');
end;

if not(BoxSpot = HookBoxSpot) then
begin
WriteLn('Difference');
if (BoxSpot > HookBoxSpot) then
begin
WriteLn('BoxSpot > HookBoxSpot');
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 265, 650, 280, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 385, 650, 405, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
end;
Thanks Sin :P

From: Jakkle
You could use MS co-ords to locate where the evil twin and the claw both are then using where molly is compared to the claw, click the arrows accordingly.

mollyPos := Finding her colour and returning the pos of her on the MS;
clawPos := Finding the claws marker on the floor and returning the MS pos
while (clawPos(x,y) <> mollyPos(x,y)) do
begin
if (clawPos.x < mollyPos.x) then
clickLeft;
if (clawPos.x > mollyPos.x) then
clickRight;
if (clawPos.y < mollyPos.y) then
clickUp;
if (clawPos.y > mollyPos.y) then
clickDown;
end;
if (clawPos(x,y) = mollyPos(x,y)) then
begin
clickButton;
if WeHaveMolly then
begin
Result := True;
Exit;
end else
Retry;
end else
Retry;

You would have to put offset's, finding where molly stands compaired to the marker on the floor.

Obviously you would have to create all the functions and everything else.
I posted this because it's just what came into mind and thought I would see what you think. I'm sure there are many ways of figuring it out. Good luck with sorting it out. :)

Yeah that is what the old solver did. According to the coords it got from the middle of the hook I believe, it calculated the offset/perspective on that point and calculated the movement. However, I've decided to basicly make a grid for all the possible positions. I can get the position of the hook now eg. Box #64 and according to that I made a movement system :P Thanks for the idea's :)

From: ashaman88
This may have already been said, but we don't need to chase the twin down, if you can identify just 1 spot where she walks, then move the target there and wait for her to come to that spot again (she does the same loop, just a different loop every time you get the random)

That is what the added attachment does :P It turns out it doesn't work properly and I'm now working on actually moving the hook near Molly until she stands on it.

From: John
IMO I'd prefer it to actually go after it, Jagex could easily pick up on a bot if we all stopped at a certain place.

Yeah, even though I don't think Jagex really cares anymore it is the best to avoid obvious botlike behaviour :P

From: momotron
This is very impressive! Well done and keep up the good work, if you need any help, just skype me.

Thanks, will do.

From: Bob The Cat
Off Topic: Triest hoe Nederland speelde tegen de Denen had echt nooit mogen gebeuren.


On Topic: Good to see that your making progess! i really think we need more people like you working on randoms. I be glad to start helping after i learned more.

Ja, echt balen.. zoveel kansen en dan nog scoren ze er nul EN laten ze Denemarken er wel één scoren. Maarja..

Thanks, good luck learning!

From: John
Wow Mate excellent! How are you planning on differentiating the Molly's?

I'm not sure yet but I'm thinking of "simply" counting the colors to define the clothes/hair of the right Molly. If that works I'll do the same when grabbing the evil twin. I might make a new function to combine multiple color searches into one or something, I've made one of these earlier with two colors but I might make one for more colors. It will just be experimentating :P

From: CephaXz
Wow, I'm impressed with your work there.

Maybe differentiate with the hair color? Probably only have 2 woman with the same hair color, so if the first one is incorrect, you go for the second one? :p

Thanks, I will try to make it find the Evil Twin straight away. If it is too hard to make it I can do something like that. I would still need to sort two evil twins from eachother that way though :P

From: Ollybest
That's actually exactly what I do legit, I just get the hair colour, if I pick the wrong one no worries il go for the other :P

Hm I always check the hair styles only, before starting on this project I didn't even know that you can also use the hair color and clothes to find the right one :P

From: [J]ustin
Fantastic to see some development on this random event!

Thanks for lending me an account to support the development aswell :P My RuneSpan accounts better get a Molly random soon.. xD

Justin

2012-06-11 02:35:43

No worries, hope it helps!

J J

2012-06-11 04:35:52

From: [J]ustin
No worries, hope it helps!

Definately, just got some more details. Colors are from 6 different worlds.

I started by using the account that [J]ustin has lended me:
Light green skirt:
SetColorSpeed2Modifiers(0.61, 1.00)
3043661, 14

Short blond hair in chat:
SetColorSpeed2Modifiers(0.01, 1.62)
2605537, 14

Short blond hair mainscreen:
SetColorSpeed2Modifiers(0.07, 0.86)
2009270, 22

ShortBlondHair / LongGreenSkirt ;; skin:
SetColorSpeed2Modifiers(0.10, 0.82);
4818102, 18

Found some interesting things, long skirt with a light green part is unique. If Molly has this long skirt w/ light green I can find the right molly by only using that detail. Also, the blond hair is unique and it barely matches the other blond hair from long hair. I'm not sure about the other hair styles with blond hair, I will check that out soon on the other Molly account I have.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
New details from another account I lend, thanks bolshak25.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Molly with a brown knot and long skirt w/ dark green parts
———————————————–
———————————————–
Dark green skirt part:
SetColorSpeed2Modifiers(0.12, 2.77);
2240266, 5

Brown Knot mainscreen:
SetColorSpeed2Modifiers(0.24, 0.75);
1451564, 10

Brown Knot InChat:
SetColorSpeed2Modifiers(0.08, 0.22);
1650234, 7
———————————————–
———————————————–
Using these details @ start:

Using the dark green skirt part and molly hair part

Hopped around 8 times to get these colors so they should work well. The dark green skirt part is definately interesting, it is unique so I can easily use that to detect the Mollys. Another good thing to know is that the colors are the same, outside the grabber and inside the grabber. This means that I have to spend less time grabbing the colors.

I'm also surprised that the hair colors work so well. It won't be that hard to find the right hair colors inside because they aren't matching other hair colors. I expected that they matched so this makes it easier :)

If I can get the hair color and a special thing about the clothes of each Molly this will be easier to make than expected. It will still be hard though, but I expected the colors to mix up with eachother. Yet again, if anyone has an account that is in the Molly random event it would really help me about because I'm stuck with picking the colors right now as I have used my two accounts.

I will be going to the gym now and once I come back I'll work on the actual detecting using the details I have now!

Justin

2012-06-11 05:31:51

Very nice work J J!

John

2012-06-11 06:11:23

Man you continue to amaze me! Your working Quite hard at this and making some great Progress!
New solvable random - Molly :D

J J

2012-06-11 15:05:05

From: [J]ustin
Very nice work J J!

Thanks again Justin ;D
Two of my noob accounts got a molly random, FINALLY!
The other one got another unsolvable random; Leo the gravedigger so I kept it there. Might work on that random in the future.

From: John
Man you continue to amaze me! Your working Quite hard at this and making some great Progress!
New solvable random - Molly :D

Thanks :)

I've made a new breakthrough, it actually detects Molly now and gives it a tile and moves the hook there. It doesn't work 100% yet because I need to expand my tile system but it works when Molly is on the right grid. Now I have to combine the grids which will take some hours because of the different angles.. but I'll get that done today. Once that is done I will make a video of it navigating to my desired Molly.

I still need more accounts, I got 2 lended accounts & 2 of my own accounts right now.

Code:
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox, R: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;
Debug: Boolean;

begin
Debug := True;
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
begin
SMART_DrawBoxes(False, [Box[i]], clRed);
end;
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

function MoveHook(Box: Integer): Boolean;
var
Debug: Boolean;
H, V, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
Debug := True;
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
if Debug then
begin
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');
end;

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
MouseBox(700, 325, 720, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
MouseBox(570, 325, 590, 340, 1);
Wait(500 + Random(500));
Inc(H);
until(Horizontal = H);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
if Debug then
begin
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');
end;

if not(BoxSpot = HookBoxSpot) then
begin
WriteLn('Difference');
if (BoxSpot > HookBoxSpot) then
begin
WriteLn('BoxSpot > HookBoxSpot');
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 265, 650, 280, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
MouseBox(635, 385, 650, 405, 1);
Wait(500 + Random(500));
Inc(V);
until(Vertical = V);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
end;

procedure GetHookBoxes;
var
RedHook: TPointArray;

begin
// SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
SMART_ClearCanvas;
FindColorsSpiralTolerance(MSCX, MSCY, RedHook, 2373117, MSX1, MSY1, MSX2, MSY2, 5);
SMART_DrawDotsEx(False, RedHook, clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(RedHook).X1, GetTPABounds(RedHook).Y1, GetTPABounds(RedHook).X2, GetTPABounds(RedHook).Y2)], clYellow);
WriteLn(''+IntToStr(GetTPABounds(RedHook).X1)+', '+IntToStr(GetTPABounds(RedHook).Y1)+', '+IntToStr(GetTPABounds(RedHook).X2)+', '+IntToStr(GetTPABounds(RedHook).Y2)+'');
end;

function MollyFinder(Hue, Sat: Extended; Color, Tolerance, X1, Y1, X2, Y2: Integer; Width, Height:Integer; Sort: Boolean): TPoint;
var
Debug: Boolean;
Mods: Array of Integer;
ColorTPA, BootsTPA: TPointArray;
ColorATPA, BootsATPA: T2DPointArray;
P: TPoint;

begin
Mods := [8];
Debug := True;

// Molly TPointArray
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);
if FindColorsTolerance(ColorTPA, Color, X1, Y1, X2, Y2, Tolerance) then
begin
SplitTPAExWrap(ColorTPA, Width, Height, ColorATPA);
SortATPASize(ColorATPA, Sort);
if Debug then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(Color, X1, Y1, X2, Y2, Tolerance))+'');
SMART_DrawDotsEx(False, ColorTPA, clBlue);
SMART_DrawBoxes(False, [GetTPABounds(ColorATPA[0])], clYellow);
end;

// Boots TPointArray
P := MiddleTPA(ColorATPA[0]);
WriteLn('Middle boots: '+IntToStr(P.X)+', '+IntToStr(P.Y)+'');
SetColorSpeed2Modifiers(0.27, 0.83);
if FindColorsTolerance(BootsTPA, 1912122, P.X-10, P.Y-Mods[r], P.X+10, P.Y+Mods[r], 10) then
begin
SplitTPAExWrap(BootsTPA, 8, 3, BootsATPA);
SortATPASize(BootsATPA, True);
if Debug then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(1912122, P.X-10, P.Y-15, P.X+10, P.Y+15, 10))+'');
SMART_DrawBoxes(False, [IntToBox(P.X-15, P.Y-Mods[r], P.X+15, P.Y+Mods[r])], clPurple);
SMART_DrawDotsEx(False, BootsTPA, clGreen);
SMART_DrawBoxes(False, [GetTPABounds(BootsATPA[0])], clAqua);
end;
Result := Point(GetTPABounds(BootsTPA).X1, GetTPABounds(BootsTPA).Y2);
WriteLn('Molly position: '+IntToStr(Result.X)+', '+IntToStr(Result.Y)+'');
end;
end;

end;

function DetectedMolly: String;
begin
Result := 'DarkGreenSkirt';
end;

function MollyDetection: Integer;
var
X, i, k: Integer;
MollyPosition: TPoint;
YI, YII, Col, Tol, XSplit, YSplit, X1, Y1, X2, Y2, Multiplier: Array of Integer;
Hue, Sat: Array of Extended;
Row: Array[0..6] of Array[0..9] of TBox;

begin
YI := [47, 45, 46, 51, 54];
YII := [237, 259, 276, 263, 278];
Hue := [0.12];
Sat := [2.77];
Col := [2240266];
Tol := [5];
XSplit := [8];
YSplit := [8];

case DetectedMolly of
'DarkGreenSkirt': r := 0;
'LightGreenSkirt': r := 1;
end;

case HookPosition of
'Normal': begin
X := 0;
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 6 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (i * Multiplier[k]), Y1[k], X2[k] + (i * Multiplier[k]), Y2[k]);
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := (20 + (10 * i) + k);
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
end;
'OneLeft': begin
X := 1;
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 9 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := (10 + i);
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
'TwoLeft': begin
X := 0;
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 9 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := i;
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
'OneRight': begin
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 7 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := (90 + i);
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
'TwoRight': begin
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 7 do
begin
if PointInBox(MollyPosition, IntToBox(X1[i], Y1[i], X2[i], Y2[i])) then
begin
Result := (100 + i);
WriteLn('Result: '+IntToStr(Result)+'');
Exit;
end;
end;
end;
end;
WriteLn('Failed to find Molly spot, moving to a random generated spot near middle');
case Random(4) of
0: Result := RandomRange(33, 36);
1: Result := RandomRange(43, 46);
2: Result := RandomRange(53, 56);
3: Result := RandomRange(63, 66);
end;
WriteLn('Random spot in middle: '+IntToStr(Result)+'');
end;

begin
SetUpLogin;
SMART_ClearCanvas;
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
MoveHook(MollyDetection);
end.

J J

2012-06-12 05:00:28

Made some stuff work better today, which includes better detection and extremely fast movement. Also made the debug better if it ever breaks I can use it easily.

SMART Initialized.
Loaded: Server 10, Members: False, Signed: True, Super Detail: False.
Current player:
Hook box position: 96
Counted Colors: 94
Middle point of molly boots: 350, 152
Counted Colors: 11
Molly position: 340, 157
Molly is in box: 82
BoxRow: 8
HookBoxRow: 9
HookBoxRow > BoxRow
Move left 1 times
H: 1
HookBoxspot: 6
Boxspot: 2
HookBoxspot > BoxSpot
Move down 4 times
V: 1
V: 2
V: 3
V: 4
Hook box position: 83
Counted Colors: 43
Middle point of molly boots: 426, 110
Counted Colors: 15
Molly position: 417, 114
Molly is in box: 94
BoxRow: 9
HookBoxRow: 8
BoxRow > HookBoxRow
Move Right 1 times
H: 1
HookBoxspot: 3
Boxspot: 4
Move up 1 times
V: 0
V: 1
Hook box position: 93
Counted Colors: 28
Middle point of molly boots: 343, 80
Counted Colors: 6
Molly position: 339, 83
Molly is in box: 96
BoxRow: 9
HookBoxRow: 9
Correct row
HookBoxspot: 3
Boxspot: 6
Move up 3 times
V: 0
V: 1
V: 1
V: 2
V: 2
V: 3
Hook box position: 95
Counted Colors: 28
Middle point of molly boots: 343, 80
Counted Colors: 6
Molly position: 339, 83
Molly is in box: 96
BoxRow: 9
HookBoxRow: 9
Correct row
HookBoxspot: 5
Boxspot: 6
Move up 1 times
V: 0
V: 1
Hook box position: 96
Counted Colors: 33
Middle point of molly boots: 334, 85
Counted Colors: 6
Molly position: 328, 88
Failed to find Molly spot, moving to a random generated spot near middle
Random spot in middle: 95
BoxRow: 9
HookBoxRow: 9
Correct row
HookBoxspot: 6
Boxspot: 5
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 97
Counted Colors: 26
Middle point of molly boots: 322, 109
Counted Colors: 15
Molly position: 322, 117
Molly is in box: 84
BoxRow: 8
HookBoxRow: 9
HookBoxRow > BoxRow
Move left 1 times
H: 1
HookBoxspot: 7
Boxspot: 4
HookBoxspot > BoxSpot
Move down 3 times
V: 1
V: 2
V: 3
Hook box position: 84
Counted Colors: 83
Middle point of molly boots: 435, 131
Counted Colors: 15
Molly position: 425, 139
Molly is in box: 93
BoxRow: 9
HookBoxRow: 8
BoxRow > HookBoxRow
Move Right 1 times
H: 1
HookBoxspot: 4
Boxspot: 3
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 92
Counted Colors: 58
Middle point of molly boots: 420, 125
Counted Colors: 12
Molly position: 410, 129
Molly is in box: 103
BoxRow: 10
HookBoxRow: 9
BoxRow > HookBoxRow
Move Right 1 times
H: 1
HookBoxspot: 2
Boxspot: 3
Move up 1 times
V: 0
V: 1
Hook box position: 102
Counted Colors: 51
Middle point of molly boots: 361, 124
Counted Colors: 13
Molly position: 351, 127
Molly is in box: 103
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 2
Boxspot: 3
Move up 1 times
V: 0
V: 1
Hook box position: 104
Counted Colors: 51
Middle point of molly boots: 361, 124
Counted Colors: 13
Molly position: 351, 127
Molly is in box: 103
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 4
Boxspot: 3
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 104
Counted Colors: 51
Middle point of molly boots: 361, 124
Counted Colors: 13
Molly position: 351, 127
Molly is in box: 103
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 4
Boxspot: 3
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 103
Counted Colors: 39
Middle point of molly boots: 355, 128
Counted Colors: 15
Molly position: 356, 136
Failed to find Molly spot, moving to a random generated spot near middle
Random spot in middle: 100
BoxRow: 10
HookBoxRow: 10
Correct row
HookBoxspot: 3
Boxspot: 0
HookBoxspot > BoxSpot
Move down 3 times
V: 1
V: 2
V: 3
Hook box position: 100
Counted Colors: 94
Middle point of molly boots: 296, 153
Counted Colors: 11
Molly position: 286, 158
Molly is in box: 82
BoxRow: 8
HookBoxRow: 10
HookBoxRow > BoxRow
Move left 2 times
H: 1
H: 2
HookBoxspot: 0
Boxspot: 2
Move up 2 times
V: 0
V: 1
V: 1
V: 2
Hook box position: 82
Counted Colors: 41
Middle point of molly boots: 412, 155
Counted Colors: 24
Molly position: 402, 157
Molly is in box: 82
Correct spot and row!
Successfully executed.

Newest code:
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox, R, PreviousBox: Integer;
Debug: Boolean;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
//Wait(1000 + Random(3000));
//ClickNorth(0);
end;

function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;

begin
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

function MoveHook(Box: Integer): Boolean;
var
H, V, X, Y, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(700, 325, 720, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(570, 325, 590, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');

if not(BoxSpot = HookBoxSpot) then
begin
if (BoxSpot > HookBoxSpot) then
begin
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 265, 650, 280, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 385, 650, 405, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
Wait(500 + Random(250));
end;

function MollyFinder(Hue, Sat: Extended; Color, Tolerance, X1, Y1, X2, Y2: Integer; Width, Height:Integer; Sort: Boolean): TPoint;
var
Mods: Array of Integer;
ColorTPA, BootsTPA: TPointArray;
ColorATPA, BootsATPA: T2DPointArray;
P: TPoint;

begin
Mods := [8];

// Molly TPointArray
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue, Sat);
if FindColorsTolerance(ColorTPA, Color, X1, Y1, X2, Y2, Tolerance) then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(Color, X1, Y1, X2, Y2, Tolerance))+'');
SplitTPAExWrap(ColorTPA, Width, Height, ColorATPA);
SortATPASize(ColorATPA, Sort);
if Debug then
begin
SMART_DrawDotsEx(False, ColorTPA, clBlue);
SMART_DrawBoxes(False, [GetTPABounds(ColorATPA[0])], clYellow);
end;

// Boots TPointArray
P := MiddleTPA(ColorATPA[0]);
WriteLn('Middle point of molly boots: '+IntToStr(P.X)+', '+IntToStr(P.Y)+'');
SetColorSpeed2Modifiers(0.27, 0.83);
if FindColorsTolerance(BootsTPA, 1912122, P.X-10, P.Y-Mods[r], P.X+10, P.Y+Mods[r], 10) then
begin
WriteLn('Counted Colors: '+IntToStr(CountColorTolerance(1912122, P.X-10, P.Y-15, P.X+10, P.Y+15, 10))+'');
SplitTPAExWrap(BootsTPA, 8, 3, BootsATPA);
SortATPASize(BootsATPA, True);
if Debug then
begin
SMART_DrawBoxes(False, [IntToBox(P.X-15, P.Y-Mods[r], P.X+15, P.Y+Mods[r])], clPurple);
SMART_DrawDotsEx(False, BootsTPA, clGreen);
SMART_DrawBoxes(False, [GetTPABounds(BootsATPA[0])], clAqua);
end;
Result := Point(GetTPABounds(BootsTPA).X1, GetTPABounds(BootsTPA).Y2);
WriteLn('Molly position: '+IntToStr(Result.X)+', '+IntToStr(Result.Y)+'');
end;
end;
end;

function DetectedMolly: String;
begin
Result := 'DarkGreenSkirt';
end;

function MollyDetection: Integer;
var
X, i, k: Integer;
MollyPosition: TPoint;
YI, YII, Col, Tol, XSplit, YSplit, X1, Y1, X2, Y2, Multiplier, Height: Array of Integer;
Hue, Sat: Array of Extended;
Row: Array[0..10] of Array[0..9] of TBox;

begin
YI := [47, 45, 46, 51, 54];
YII := [237, 259, 276, 263, 278];
Hue := [0.12];
Sat := [2.77];
Col := [2240266];
Tol := [5];
XSplit := [8];
YSplit := [8];

case DetectedMolly of
'DarkGreenSkirt': r := 0;
'LightGreenSkirt': r := 1;
end;

case HookPosition of
'Normal': begin
X := 0;
X1 := [61, 78, 92, 104, 114, 124, 132, 139, 146, 151];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [110, 126, 137, 146, 153, 160, 166, 171, 177, 180];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-2 * Multiplier[k]), Y1[k], X2[k] + (-2 * Multiplier[k]), Y2[k]);
1: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k], X2[k] + (-1 * Multiplier[k]), Y2[k]);
2..10: Row[i][k] := IntToBox(X1[k] + ((i-2) * Multiplier[k]), Y1[k], X2[k] + ((i-2) * Multiplier[k]), Y2[k]);
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'OneLeft': begin
X := 1;
X1 := [69, 89, 105, 118, 140, 151, 162, 172, 180, 186];
Y1 := [194, 167, 143, 123, 104, 90, 77, 66, 54, 43];
X2 := [118, 133, 144, 156, 169, 180, 188, 197, 204, 211];
Y2 := [224, 187, 160, 140, 117, 101, 86, 75, 64, 52];
Multiplier := [62, 56, 52, 48, 38, 36, 34, 33, 32, 31];
Height := [4, 3, 3, 3, 2, 2, 2, 1, 1, 1];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((i-1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((i-1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'TwoLeft': begin
X := 2;
X1 := [68, 98, 118, 137, 154, 172, 185, 197, 208, 217];
Y1 := [184, 158, 137, 119, 103, 89, 77, 66, 55, 46];
X2 := [120, 144, 160, 176, 190, 204, 216, 224, 234, 244];
Y2 := [210, 181, 152, 134, 115, 99, 86, 74, 61, 53];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 33, 31];
Height := [8, 7, 7, 6, 5, 4, 4, 3, 3, 2];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'OneRight': begin
X := 3;
X1 := [420, 386, 371, 360, 349, 338, 329, 321, 318, 310];
Y1 := [196, 167, 144, 123, 106, 89, 78, 64, 52, 40];
X2 := [470, 431, 412, 396, 378, 366, 355, 345, 339, 331];
Y2 := [222, 187, 160, 138, 118, 102, 88, 75, 60, 49];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 34, 32];
Height := [4, 4, 3, 3, 3, 3, 2, 2, 2, 2];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((-i+1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((-i+1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'TwoRight': begin
X := 4;
X1 := [396, 374, 355, 338, 324, 312, 300, 291, 285, 278];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66, 52, 41];
X2 := [447, 415, 399, 377, 359, 342, 331, 321, 311, 301];
Y2 := [210, 177, 153, 133, 115, 99, 86, 77, 64, 52];
Multiplier := [62, 56, 52, 48, 46, 43, 40, 38, 36, 34];
Height := [8, 8, 7, 6, 6, 6, 6, 5, 4, 3];
MollyPosition := MollyFinder(Hue[r], Sat[r], Col[r], Tol[r], MSX1, YI[x], MSX2, YII[x], YSplit[r], YSplit[r], True);
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (-i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
end;
WriteLn('Failed to find Molly spot, moving to a random generated spot near middle');
Result := (PreviousBox + RandomRange(-5, 5));
WriteLn('Random spot in middle: '+IntToStr(Result)+'');
end;

procedure GetMollyFeetBoxes;
var
i: Integer;
Boots: TPointArray;
BootsSplit: T2DPointArray;

begin
//SMART_ClearCanvasArea(IntToBox(199, 109, 234, 119));
//SMART_ClearCanvas;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.27, 0.83);
FindColorsSpiralTolerance(MSCX, MSCY, Boots, 1912122, MSX1, MSY1, MSX2, MSY2, 10);
SplitTPAExWrap(Boots, 8, 8, BootsSplit);
for i:=0 to high(BootsSplit) do
begin
SMART_DrawDotsEx(False, BootsSplit[i], clYellow);
SMART_DrawBoxes(False, [IntToBox(GetTPABounds(BootsSplit[i]).X1, GetTPABounds(BootsSplit[i]).Y1, GetTPABounds(BootsSplit[i]).X2, GetTPABounds(BootsSplit[i]).Y2)], clYellow);
SMART_DrawBoxes(False, [IntToBox(66-45, 210, 100-45, 234)], ClPurple);
WriteLn(''+IntToStr(GetTPABounds(BootsSplit[i]).X1)+', '+IntToStr(GetTPABounds(BootsSplit[i]).Y1)+', '+IntToStr(GetTPABounds(BootsSplit[i]).X2)+', '+IntToStr(GetTPABounds(BootsSplit[i]).Y2)+'');
end;
end;

begin
SetUpLogin;
Debug := False;
SMART_ClearCanvas;
//MollyDetection;
repeat
SMART_ClearCanvas;
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
//MoveHook(MollyDetection);
until(MoveHook(MollyDetection));
end.

Will be working on making it a bit more accurate then I'll add new Molly's. So far this is just one Molly detection but the full code is basicly done, just need specific characteristics about the different Molly's to define which Molly needs to be catched.

Video of the newest code:
Uploading right now.
http://www.youtube.com/watch?v=LC7frlVsBlI
[youtube]LC7frlVsBlI[/youtube]

I just input new colors in my code and it actually worked straight away to detect molly #2.
Glad it works :D

putonajonny

2012-06-12 05:34:21

Are you moving one position at a time then detecting location? Or moving all the way then re checking?

J J

2012-06-12 05:38:53

From: putonajonny
Are you moving one position at a time then detecting location? Or moving all the way then re checking?

The video of the newest code has now been uploaded so you can watch that. Currently it detects Molly's position, moves there and checks the position again. If the grabber/hook box position is the same as Molly's position the function returns True. I will use that result to press the grab button.

I might make it recalculate Molly's position once in a while, while moving the hook but it might get inaccurate because the angles are changing a lot. Just watch the vid to show the changing angle I'm talking about (at the far west and far east)

J J

2012-06-16 18:17:09

I'm still working on this but I'm pretty much making extremely slow progress / close to stuck at detecting Molly.

I've made this function now which works extremely well for the red haired molly. I still have to find a way to make it work nicely for dark brown/light brown/blond hair.

{*******************************************************************************
function FindHair(HairColor: String): TPoint;
by: J J
Description: Finds the desired hair color, returns a coord
*******************************************************************************}
function FindHair(HairColor: String): TPoint;
var
X, Y, Q, W, i: Integer;
YI, YII, PossibleColors, Tol: Array of Integer;
Hue, Sat: Array of Extended;
HairColors, Skin: TPointArray;
HairPoints, SkinPoints: Array[0..99] of TPoint;
HairSplit, SkinSplit: T2dPointArray;

begin
case HookPosition of
'Normal': Q := 0;
'OneLeft': Q := 1;
'TwoLeft': Q := 2;
'OneRight': Q := 3;
'TwoRight': Q := 4;
end;
WriteLn(HookPosition);
case HairColor of
'DarkBrown': W := 0;
'Red': W := 1;
'Blond': W := 2;
'LightBrown': W := 3;
end;
WriteLn(HairColor);

YI := [5, 5, 5, 5, 5];
YII := [200, 185, 180, 185, 180];
Hue := [0.27, 0.13, 0.22];
Sat := [0.14, 0.61, 2.59];
PossibleColors := [1780529, 2776496, 4047318];
Tol := [8, 14, 10];

// Hair colors
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(Hue[W], Sat[W]);
if FindColorsSpiralTolerance(X, Y, HairColors, PossibleColors[W], MSX1, YI[Q], MSX2, YII[Q], Tol[W]) then
begin
if Debug then
SMART_DrawDotsEx(False, HairColors, clPurple);
SplitTPAExWrap(HairColors, 2, 2, HairSplit);
SortATPASize(HairSplit, True);
for i:=0 to high(HairSplit) do
begin
MiddleTPAEx(HairSplit[i], X, Y);
HairPoints[i] := Point(X, Y);
if Debug then
SMART_DrawBoxes(False, [IntToBox(X-2, Y-2, X+2, Y+2)], clGreen);
end;
end;

// Skin colors
SetColorspeed2Modifiers(0.10, 0.86);
if FindColorsSpiralTolerance(X, Y, Skin, 4884152, MSX1, YI[Q], MSX2, YII[Q], 18) then
begin
SplitTPAExWrap(Skin, 2, 2, SkinSplit);
SortATPASize(SkinSplit, True);
for i:=0 to high(SkinSplit) do
begin
SkinPoints[i] := MiddleTPA(SkinSplit[i]);
end;

WriteLn('HairPoints: '+ToStr(HairPoints)+'');
WriteLn('SkinPoints: '+ToStr(SkinPoints)+'');
for i:=0 to high(HairPoints) do
begin
if NearbyPointInArrayEx(HairPoints[i], 10, 10, SkinPoints) then
begin
SMART_DrawBoxes(False, [IntToBox(HairPoints[i].x-2, HairPoints[i].y-2, HairPoints[i].x+2, HairPoints[i].y+2)], clYellow);
Result := HairPoints[i];
Break;
end;
end;
end;
end;

I've also been experimentating loads with DDTM's, personally made DTM's, Dynamic Bitmaps, personally made bitmaps and loads of other stuff but Jagex has made it extremely hard.

Hair color seems to be the most accurate way or actually the only way to go. 50% chance of succeeding on first try then a 100% chance of grabbing at second try. 100% success rate anyways but 50% chance of using 2 attempts.

J J

2012-06-17 12:15:04

== Using hair color: ==

Blond hair: matches with cage, tiles on wall and earrings
Light brown hair: matches with tiles on wall, boots and boxes
Dark brown hair: matches with boots and boxes
Red hair: matches with tiles on wall and red clothes

Searching for skin color near the hair color does not work either.
If molly is next to the boxes at the background it will detect skin color near..
but it doesnt use the hair color but it uses the color of the boxes.

Which means it will return a false result. This basicly means that using the hair color
is not a viable option.

== Making a DDTM: ==
Making a DDTM has some negative side effects aswell.
One of the first things to handle is that Molly slightly changes position every time you log out/in
It isn't that hard to get around that. You can filter points and get a box around Molly,
then you can grab certain points such as the middle point of the box and the top point / bottom point,
or you can just add some other stuff.

Eventually it grabbed the middle point, the hair color, the pants and the arm color perfectly.
The problem is that the perspective of the Molly's is changing at the other room.
But that is not all, once you pass the door the colors won't match anymore. Obviously you
can add tolerance, but the colors simply aren't matching anymore.

About the perspective changing, you can use DTM rotated and some other stuff but it will
still return false results. Some times it will use the red color of the torches instead of the
red color of the clothes of Molly. Sometimes it will use the brown color of the boxes instead of the
brown hair color of Molly. Sometimes it will use the yellow color of the tiles on the wall
instead of the blond hair color of Molly. And the list goes on….

This makes means that a DDTM doesn't work properly.

== Making a bitmap of the hair: ==
I've also tried to make a bitmap of the hair by using the BitmapFromClient() procedure.
I got the coords by using the same method as making a DDTM. As explained before you unfortunately
can't ust static coords to grab the Molly hair color. Anyways, once you make a 3x3 px DTM of the hair
and try to change for it you get the perspective problem again..

I tried FindBitmapToleranceIn and even used RotateBitmap and a combination of those (eg. rotating bitmap
for some degrees, searching again, increasing tolerance 5 times, etc.)

So yeah. Making a bitmap of the hairdoesn't work either.

== Making a bitmap of the clothes: ==
Just doesn't work. Will detect the other molly's aswell.

== Using the colors of the clothes: ==
Just doesn't work. Will detect the other molly's aswell.



Other options?
I have no idea. I have added the script that I have made. It works fairly well, it does return
the right color of Molly's hair but it looks close to impossible to me to actually return
the coords of Molly.

The "only" thing that needs to be done to complete the solver is to return molly's position.
If someone can make a function that returns the position of molly's haircolor it would be
greatly appreciated.

Once the molly's hair coordinate is known you can just go down in height to get near the feet.
Once you know the feet coords of the desired Molly with the desired hair color you can input it
in the function I made which converts the TPoint to a Box Number.

Then you can input the box number in the grabber function and it will move there.

So yeah, I've added a .rar with all the information and the script, hope someone can help me
with this.

(added to first post)

putonajonny

2012-06-17 14:33:28

Done some detection, I have already filled JJ in on what it does, blonde and red detection working well… (Only blonde in pic)
program new;

{.include SRL/SRL/Misc/Smart.simba}
{.include SRL/SRL.simba}
{.include SPS/SPS.simba}
{.include SRL/SRL/Misc/PaintSmart.simba}

procedure DeclarePlayers;
begin

HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

With Players[0] do
begin
Name := ''; //use " if you are getting ~
Pass := '';
Active := True;
end;

end;

Const
Blonde = 0;
Brown = 1;
Red = 2;

type
TColour = record
Colour, Tolerance : integer;
Hue, Sat : extended;
end;

Function Colour(Col, Tol : integer; Hue, Sat : extended) : TColour;
begin

Result.Colour := Col;
Result.Hue := Hue;
Result.Tolerance := Tol;
Result.Sat := Sat;

end;

Function Colours(Molly : integer) : TColour;
begin

Case Molly of
Blonde : Result := Colour(3447742, 8, 0.02, 0.66);
Brown : Result := Colour(1976370, 1, 0.84, 0.65);
Red : Result := Colour(4880841, 27, 0.19, 1.57);
end;
end;

Function MaxA2(A : array of integer) : integer;//Returns the position, not the value
Var
i : integer;
begin

for i := 0 to high(A) do
if(A[i] > A[Result])then
Result := i;

end;

Function DetermineMolly : integer; //For determining the hair colour of the molly during the conversation, but I guess you already have that
Var
B : TBox;
Counts : array of integer;
Col : TColour;
CTS, i : integer;
begin

CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
B := IntToBox(42, 376, 105, 403);
SetArrayLength(Counts, 3);
for i := 0 to high(Counts) do
begin
Col := Colours(i);
end;

SetColorToleranceSpeed(CTS);

Result := MaxA2(Counts);

end;

Function RetrunMollyPositions : array of TPoint;
Var
Col : TColour;
CTS, i, H : integer;
P : TPoint;
Points : TPointArray;
ATPA : T2DPointArray;
begin

CTS := GetColorToleranceSpeed;
SetColorToleranceSpeed(2);

Col := Colour(2396064, 20, 0.05, 0.53); //Blonde

SetColorspeed2Modifiers(Col.Hue, Col.Sat);
FindColorsTolerance(Points, Col.Colour, MSX1, MSY1, MSX2, MSY2, Col.Tolerance);

TPAtoATPAWrap(Points, 30, ATPA);
SetArrayLength(Points, 0);
SortATPASize(ATPA, True);

H := high(ATPA);
for i := 0 to H do
begin
P := MiddleTPA(ATPA[i]);
SetColorToleranceSpeed(1);
if((GetArrayLength(ATPA[i]) > 20) and (CountColorTolerance(2644263, P.x - 10, P.y - 10, P.x + 10, P.y + 10, 10) < 3))then
begin
SetArrayLength(Points, GetArrayLength(Points) + 1);
Points[high(Points)] := P;
SMART_DrawCircle(False, Points[high(Points)], 5, True, clYellow + clYellow * Byte(i = 0));
end;
end;

SetColorToleranceSpeed(2);

Col := Colour(1914435, 7, 0.17, 0.27); //Brown (doesn't work very well)

SetColorspeed2Modifiers(Col.Hue, Col.Sat);
FindColorsTolerance(Points, Col.Colour, MSX1, MSY1, MSX2, MSY2, Col.Tolerance);

TPAtoATPAWrap(Points, 8, ATPA);
SetArrayLength(Points, 0);
SortATPASize(ATPA, True);

H := high(ATPA);
for i := 0 to H do
begin
P := MiddleTPA(ATPA[i]);
SetColorToleranceSpeed(1);
if((GetArrayLength(ATPA[i]) > 25) and (CountColorTolerance(2644263, P.x - 10, P.y - 10, P.x + 10, P.y + 10, 10) < 3))then
begin
SetArrayLength(Points, GetArrayLength(Points) + 1);
Points[high(Points)] := P;
SMART_DrawCircle(False, Points[high(Points)], 5, True, clBlue);
end;
end;

Col := Colour(1259915, 16, 0.01, 0.05); //Red
SetColorToleranceSpeed(2);

SetColorspeed2Modifiers(Col.Hue, Col.Sat);
FindColorsTolerance(Points, Col.Colour, MSX1, MSY1, MSX2, MSY2, Col.Tolerance);

TPAtoATPAWrap(Points, 8, ATPA);
SetArrayLength(Points, 0);
SortATPASize(ATPA, True);

H := high(ATPA);
for i := 0 to H do
begin
P := MiddleTPA(ATPA[i]);
SetColorToleranceSpeed(1);
if((GetArrayLength(ATPA[i]) > 10) and (CountColorTolerance(2644263, P.x - 10, P.y - 10, P.x + 10, P.y + 10, 10) < 3))then
begin
SetArrayLength(Points, GetArrayLength(Points) + 1);
Points[high(Points)] := P;
SMART_DrawCircle(False, Points[high(Points)], 5, True, clRed);
end;
end;

SetColorToleranceSpeed(CTS);


Result := Points;

end;
Var
P : array of TPoint;
i : integer;

begin

Smart_Server := 11;
Smart_Members := True;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;

DeclarePlayers;
LoginPlayer;

RetrunMollyPositions;

end.

J J

2012-06-17 18:48:15

Thanks for your effort so far Jonny :)
I really want to finish it but I'm pretty much stuck xD There might be some useful functions I could use or possibly make myself though..

Yago

2012-06-17 19:31:59

You can try searching for hair color by the following steps:

  1. Getting their clothes
  2. Getting the TPABounds of their clothes
  3. Then extending the upper-most point of the TPA bounds to include their head.
  4. Then you search for the hair color within the new Bounds that includes their head/hair.

This avoids confusions and matching the hair as other objects. And is kind of how a human would do it. Look at all Molly's and their entire figure and then match the hair.

Credits to MSPaint for the pics

J J

2012-06-18 17:55:27

From: Yago
You can try searching for hair color by the following steps:

  1. Getting their clothes
  2. Getting the TPABounds of their clothes
  3. Then extending the upper-most point of the TPA bounds to include their head.
  4. Then you search for the hair color within the new Bounds that includes their head/hair.

This avoids confusions and matching the hair as other objects. And is kind of how a human would do it. Look at all Molly's and their entire figure and then match the hair.

Credits to MSPaint for the pics

Hm thanks for the idea's aswell.
I've combined Jonny's + Yours + Mine idea's and this actually works well:
Different hair colored mollys ^
function MollyLocation: TPoint;
var
HairColor: String;
X, Y, Q, i: Integer;
P: TPoint;
Hair: TPointArray;
HairSplit: T2DPointArray;
SearchBox: TBox;
Col, Tol: Array of Integer;
Hue, Sat: Array of Extended;

begin
HairColor := 'DarkBlond';
case HairColor of
'LightBrown': Q := 0;
'DarkBrown': Q := 1;
'LightBlond': Q := 2;
'DarkBlond': Q := 3;
'Red': Q := 4;
end;

Col := [3161416, 1517614, 3658722, 3573399, 2710186];
Tol := [14, 10, 10, 20, 17];
Hue := [0.13, 0.21, 0.15, 0.08, 0.11];
Sat := [0.08, 0.64, 2.31, 0.49, 0.59];

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue[Q], Sat[Q]);
if FindColorsSpiralTolerance(X, Y, Hair, Col[Q], MSX1, MSY1, MSX2, MSY2, Tol[Q]) then
begin
if (Length(Hair) > 25)then
begin
if Debug then
SMART_DrawDotsEx(False, Hair, clPurple);
SplitTPAExWrap(Hair, 3, 3, HairSplit);
SortATPASize(HairSplit, True);
for i:=0 to high(HairSplit) do
begin
if (Length(HairSplit[i]) > 20) and (Length(HairSplit[i]) < 100) then
begin
P := MiddleTPA(HairSplit[i]);
SearchBox := IntToBox(P.X-6, P.Y+2, P.X+6, P.Y+8);
if Debug then
SMART_DrawBoxes(False, [SearchBox], clRed);
SetColorSpeed2Modifiers(0.09, 0.85);
if FindColorSpiralTolerance(X, Y, 4555446, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 21) then
begin
WriteLn('Potential Molly found');
if Debug then
begin
SMART_DrawCircle(False, P, 5, True, clGreen);
SMART_DrawBoxes(False, [IntToBox(SearchBox.X1-5, SearchBox.Y1+40, SearchBox.X2+5, SearchBox.Y2+50)], clYellow);
end;
SetColorSpeed2Modifiers(0.27, 0.83);
if FindColorSpiralTolerance(X, Y, 1912122, SearchBox.X1-5, SearchBox.Y1+40, SearchBox.X2+5, SearchBox.Y2+55, 9) then
begin
WriteLn('Detected boots, correct Molly has been found');
Break;
end;
end;
end;
end;
end;
end;
end;
Detecting the shoes is still being worked on because I need to make a formula to calculate where to search for the shoes because of the changing perspective.

Yago

2012-06-18 18:00:03

From: J J
Hm thanks for the idea's aswell.
I've combined Jonny's + Yours + Mine idea's and this actually works well:
Different hair colored mollys ^
function MollyLocation: TPoint;
var
HairColor: String;
X, Y, Q, i: Integer;
P: TPoint;
Hair: TPointArray;
HairSplit: T2DPointArray;
SearchBox: TBox;
Col, Tol: Array of Integer;
Hue, Sat: Array of Extended;

begin
HairColor := 'DarkBlond';
case HairColor of
'LightBrown': Q := 0;
'DarkBrown': Q := 1;
'LightBlond': Q := 2;
'DarkBlond': Q := 3;
'Red': Q := 4;
end;

Col := [3161416, 1517614, 3658722, 3573399, 2710186];
Tol := [14, 10, 10, 20, 17];
Hue := [0.13, 0.21, 0.15, 0.08, 0.11];
Sat := [0.08, 0.64, 2.31, 0.49, 0.59];

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue[Q], Sat[Q]);
if FindColorsSpiralTolerance(X, Y, Hair, Col[Q], MSX1, MSY1, MSX2, MSY2, Tol[Q]) then
begin
if (Length(Hair) > 25)then
begin
if Debug then
SMART_DrawDotsEx(False, Hair, clPurple);
SplitTPAExWrap(Hair, 3, 3, HairSplit);
SortATPASize(HairSplit, True);
for i:=0 to high(HairSplit) do
begin
if (Length(HairSplit[i]) > 20) and (Length(HairSplit[i]) < 100) then
begin
P := MiddleTPA(HairSplit[i]);
SearchBox := IntToBox(P.X-6, P.Y+2, P.X+6, P.Y+8);
if Debug then
SMART_DrawBoxes(False, [SearchBox], clRed);
SetColorSpeed2Modifiers(0.09, 0.85);
if FindColorSpiralTolerance(X, Y, 4555446, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 21) then
begin
WriteLn('Potential Molly found');
if Debug then
begin
SMART_DrawCircle(False, P, 5, True, clGreen);
SMART_DrawBoxes(False, [IntToBox(SearchBox.X1-5, SearchBox.Y1+40, SearchBox.X2+5, SearchBox.Y2+50)], clYellow);
end;
SetColorSpeed2Modifiers(0.27, 0.83);
if FindColorSpiralTolerance(X, Y, 1912122, SearchBox.X1-5, SearchBox.Y1+40, SearchBox.X2+5, SearchBox.Y2+55, 9) then
begin
WriteLn('Detected boots, correct Molly has been found');
Break;
end;
end;
end;
end;
end;
end;
end;
Detecting the shoes is still being worked on because I need to make a formula to calculate where to search for the shoes because of the changing perspective.


Your welcome. You can search for the shoes in the boxes you created based on the crane thing.

J J

2012-06-19 04:23:51

From: Yago
Your welcome. You can search for the shoes in the boxes you created based on the crane thing.

Yeah I'm just making a box now based on the coords of the shoes and it actually works well now.

Current player: 
Hook box position: 28
Potential Molly has been found at: 333, 21
Detected boots, correct Molly has been found at 328, 68
Molly is in box: 77
BoxRow: 7
HookBoxRow: 2
BoxRow > HookBoxRow
Move Right 5 times
H: 1
H: 2
H: 3
H: 4
H: 5
HookBoxspot: 8
Boxspot: 7
HookBoxspot > BoxSpot
Move down 1 times
V: 1
Hook box position: 77
Potential Molly has been found at: 333, 22
Detected boots, correct Molly has been found at 328, 68
Molly is in box: 77
Correct spot and row!
Successfully executed.

This is amazing, it just nearly completed full random within 15 secs
Current player: 
Hair colors: [3888233, 3822439, 3756389, 3690339, 3559009, 3954283, 4086127, 4020333, 4217713, 4283507, 4349557, 4415351, 3492959, 4481401, 3426909, 3360859, 3163478, 3888233, 3888233, 3822439, 3822439, 3756389, 3954283, 3822439, 3756389, 3690339, 3690339, 3690339, 3756389, 3822439, 3822439, 3888233, 4086127, 4086127, 4086127, 4086127, 4020333, 4020333, 3954283, 3954283, 3888233, 3888233, 3822439, 3822439, 4086127, 3954283, 3822439, 3690339, 3756389, 3822439, 3822439, 3888233, 3888233, 4086127, 4086127, 4086127, 4086127, 4086127, 4020333, 4020333, 3954283, 3954283, 3888233, 3888233, 3822439, 3822439, 4217713, 4020333, 3690339, 3756389, 3822439, 3888233, 3954283, 3954283, 4086127, 4217713, 4217713, 4086127, 4086127, 4086127, 4086127, 4020333, 4020333, 3954283, 3888233, 3888233, 3822439, 3822439, 4217713, 4086127, 3756389, 3822439, 3888233, 3954283, 4020333, 4020333, 4217713, 4217713, 4217713, 4217713, 4217713, 4086127, 4086127, 4020333, 4020333, 3954283, 3954283, 3888233, 3888233, 3822439, 4217713, 3756389, 3822439, 3888233, 3954283, 4020333, 4086127, 4217713, 4217713, 4217713, 4217713, 4217713, 4217713, 4217713, 4086127, 4086127, 4020333, 3954283, 3954283, 3888233, 3888233, 3822439, 3756389, 3822439, 3888233, 3954283, 4020333, 4086127, 4283507, 4217713, 4217713, 4217713, 4217713, 4217713, 4217713, 4217713, 4086127, 4086127, 4020333, 4020333, 3954283, 3954283, 3888233, 3822439, 3888233, 3954283, 4020333, 4086127, 4217713, 4217713, 4283507, 4283507, 4217713, 4217713, 4217713, 4217713, 4217713, 4217713, 4217713, 4086127, 4020333, 4020333, 3954283, 3954283, 3888233, 3888233, 3954283, 4020333, 4086127, 4217713, 4217713, 4283507, 4283507, 4283507, 4283507, 4283507, 4217713, 4217713, 4217713, 4217713, 4217713, 4086127, 4086127, 4020333, 4020333, 3954283, 3888233, 3888233, 4020333, 4086127, 4217713, 4217713, 4283507, 4283507, 4283507, 4283507, 4283507, 4283507, 4283507, 4217713, 4217713, 4217713, 4217713, 4086127, 4086127, 4020333, 4020333, 3954283, 3888233, 3888233, 4086127, 4217713, 4217713, 4217713, 4283507, 4283507, 4349557, 4349557, 4283507, 4283507, 4283507, 4283507, 4283507, 4217713, 4217713, 4217713, 4086127, 4020333, 4020333, 3954283, 3888233, 3888233, 4086127, 4217713, 4217713, 4283507, 4283507, 4283507, 4349557, 4349557, 4349557, 4349557, 4283507, 4283507, 4283507, 4283507, 4283507, 4217713, 4086127, 4020333, 4020333, 3954283, 3888233, 3888233, 4217713, 4217713, 4283507, 4283507, 4283507, 4349557, 4349557, 4349557, 4349557, 4349557, 4349557, 4283507, 4283507, 4283507, 4217713, 4086127, 4020333, 3954283, 3954283, 3888233, 3822439, 3822439, 4217713, 4217713, 4283507, 4283507, 4349557, 4349557, 4349557, 4415351, 4349557, 4349557, 4349557, 4349557, 4349557, 4283507, 4217713, 4086127, 3954283, 3888233, 3888233, 3822439, 3756389, 3756389, 4217713, 4283507, 4283507, 4349557, 4349557, 4349557, 4415351, 4415351, 4415351, 4415351, 4349557, 4349557, 4349557, 4283507, 4217713, 4020333, 3954283, 3822439, 3822439, 3756389, 3690339, 3690339, 4283507, 4283507, 4283507, 4349557, 4349557, 4415351, 4415351, 4415351, 4415351, 4415351, 4415351, 4349557, 4349557, 4283507, 4217713, 4020333, 3954283, 3822439, 3756389, 3690339, 3559009, 3559009, 4283507, 4283507, 4349557, 4349557, 4349557, 4415351, 4415351, 4415351, 4415351, 4415351, 4415351, 4349557, 4349557, 4283507, 4217713, 4020333, 3954283, 3822439, 3690339, 3559009, 3492959, 3492959, 4283507, 4349557, 4349557, 4349557, 4415351, 4415351, 4415351, 4481401, 4481401, 4481401, 4415351, 4349557, 4283507, 4283507, 4217713, 4020333, 3888233, 3822439, 3690339, 3492959, 3426909, 3426909, 4283507, 4349557, 4349557, 4415351, 4415351, 4415351, 4481401, 4481401, 4481401, 4481401, 4415351, 4349557, 4283507, 4217713, 4217713, 4020333, 3888233, 3822439, 3690339, 3492959, 3360859, 3360859, 4283507, 4349557, 4415351, 4415351, 4415351, 4481401, 4481401, 4481401, 4481401, 4481401, 4415351, 4349557, 4283507, 4217713, 4086127, 4020333, 3888233, 3822439, 3690339, 3492959, 3360859, 3163478]
Best molly hair color: 3954026
Best tolerance: 10
Modifiers: [ 1.1225000000000000E+0001, 6.9316384180790961E+0000]
Molly's hair color: DarkBrown
Molly's hair color: Blond
Molly's hair color: LightBrown
Hook box position: 51
Potential Molly has been found at: 112, 73
Detected boots, correct Molly has been found at 119, 135
Molly is in box: 23
BoxRow: 2
HookBoxRow: 5
HookBoxRow > BoxRow
Move left 3 times
H: 1
H: 2
H: 3
HookBoxspot: 1
Boxspot: 3
Move up 2 times
V: 1
V: 2
Hook box position: 23
Potential Molly has been found at: 113, 72
Detected boots, correct Molly has been found at 119, 135
Molly is in box: 23
Correct spot and row!
Successfully executed.

With timing:
Potential Molly has been found at: 113, 72
Detected boots, correct Molly has been found at 119, 135
Molly is in box: 23
Correct spot and row!
Molly completed in: 16396 milliseconds

Mat

2012-06-19 05:07:51

:) <3 this should be good, just need molly now :(

J J

2012-06-19 05:19:53

From: Mat
:) <3 this should be good, just need molly now :(

Yeah I need two more Molly accounts or possibly more to make this work for everyone. Currently have three Molly accounts. Fortunately they have different hair colors but I'm still missing two hair colors (red and light blond I believe).

Total hair colors are
  case MollyHair of
'LightBrown': Q := 0;
'DarkBrown': Q := 1;
'LightBlond': Q := 2;
'DarkBlond': Q := 3;
'Red': Q := 4;
end;

I'll check it out soon but yeah. The molly grabbing works for any hair color. I also still need to finish the mainloop but here is what it can do so far:

Keep in mind there is a conversation at start normally but I've already skipped that because of the hundreds of times I've logged out/in there :P

http://www.youtube.com/watch?v=Stx8vXEDxk8
[youtube]Stx8vXEDxk8[/youtube]

code used:
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox, PreviousBox, C: Integer;
MollyHair: String;
Debug: Boolean;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
end;



////////////////////////////////////////////////////////////////////////////////
// Stable procedures & functions: //////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

{*******************************************************************************
procedure MollyTalk;
by: J J
Description: Handles the conversations with Molly
*******************************************************************************}
procedure MollyTalk;
begin
if AreTalking then
begin
repeat
ClickContinue(True, True);
Wait(500 + Random(500));
until not(AreTalking);
end;
end;

{*******************************************************************************
procedure GrabMollyHairColor;
by: J J
Description: Returns molly's hair color by using the hair color while in chat
*******************************************************************************}
procedure GrabMollyHairColor;
var
HairColor, Tol, i: Integer;
HairColorExtended, Lowest: Extended;
HairColors: TIntegerArray;
Speed2Modifiers, HairDefinedColors: TExtendedArray;

begin
TPAFromCircle(59, 389, 5);
HairColors := GetColors(TPAFromBox(IntToBox(48, 375, 67, 396)));
HairColor := GetBestColor(HairColors, 2, Tol, Speed2Modifiers);
WriteLn('Hair colors: '+ToStr(HairColors)+'');
WriteLn('Best molly hair color: '+ToStr(HairColor)+'');
WriteLn('Best tolerance: '+ToStr(Tol)+'');
WriteLn('Modifiers: '+ToStr(Speed2Modifiers)+'');
if Debug then
SMART_DrawCircle(False, Point(59, 389), 5, False, clRed);

// Dark brown, blond, light brown \\
HairDefinedColors := [2178123, 3103606, 3954284];
HairColorExtended := HairColor;
Lowest := HairDefinedColors[0]+1;
for i:=0 to 2 do
begin
if Abs(HairColor-HairDefinedColors[i]) < Lowest then
begin
Lowest := Abs(HairColor-HairDefinedColors[i]);
case i of
0: MollyHair := 'DarkBrown';
1: MollyHair := 'Blond';
2: MollyHair := 'LightBrown';
end;
WriteLn('Molly''s hair color: '+MollyHair+'');
end;
end;
end;

{*******************************************************************************
procedure OpenMollyDoor;
by: J J
Description: Opens the door in the Molly random event
Uses the brown colors of the door
*******************************************************************************}
procedure OpenMollyDoor;
var
P: TPoint;
Door: TPointArray;
DoorSplit: T2DPointArray;

begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.35, 0.77);
if FindColorsSpiralTolerance(MSCX, MSCY, Door, 7115939, MSX1, MSCY-150, MSX2, MSCY+150, 5) then
begin
SplitTPAExWrap(Door, 2, 2, DoorSplit);
SortATPASize(DoorSplit, True);
if Length(DoorSplit[0]) > 0 then
begin
P := MiddleTPA(DoorSplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [GetTPABounds(DoorSplit[0])], clRed);
SMART_DrawDotsEx(False, Door, clGreen);
SMART_DrawDotsEx(False, DoorSplit[0], clYellow);
SMART_DrawCircle(False, P, 2, True, clPurple);
end;
MMouse(P.x, P.y, RandomRange(-5, 5), RandomRange(-5, 5));
Wait(RandomRange(50, 150));
case Random(7) of
0..4: ClickMouse2(1);
5..6: begin
ClickMouse2(0);
WaitOptionMulti(['pen', 'Open'], 1000);
end;
end;
end;
end;
end;

{*******************************************************************************
procedure UseControls;
by: J J
Description: Opens the control panel in the Molly random event
Uses the wooden parts of the control panel
*******************************************************************************}
procedure UseControls;
var
P: TPoint;
Controls: TPointArray;
ControlsSplit: T2DPointArray;

begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.31, 1.45);
if FindColorsSpiralTolerance(MSCX, MSCY, Controls, 3366704, MSX1, 80, MSX2, 280, 4) then
begin
SplitTPAExWrap(Controls, 2, 2, ControlsSplit);
SortATPASize(ControlsSplit, True);
if Length(ControlsSplit[0]) > 0 then
begin
P := MiddleTPA(ControlsSplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [GetTPABounds(ControlsSplit[0])], clRed);
SMART_DrawDotsEx(False, Controls, clGreen);
SMART_DrawDotsEx(False, ControlsSplit[0], clYellow);
SMART_DrawCircle(False, P, 2, True, clPurple);
end;
MMouse(P.x, P.y, RandomRange(-5, 5), RandomRange(-5, 5));
Wait(RandomRange(50, 150));
case Random(7) of
0..4: ClickMouse2(1);
5..6: begin
ClickMouse2(0);
WaitOptionMulti(['ontrol', 'Use', 'panel'], 1000);
end;
end;
end;
end;
end;

{*******************************************************************************
function HookPosition: String;
by: J J
Description: Returns the angle of the hook by using the fence to calculate
the perspective.
*******************************************************************************}
function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

{*******************************************************************************
function NormalHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in a normal
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;

begin
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

{*******************************************************************************
function TwoLeftHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the two left
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

{*******************************************************************************
function OneLeftHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the one left
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

{*******************************************************************************
function TwoRightHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the two right
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

{*******************************************************************************
function OneRightHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the one right
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

{*******************************************************************************
function MoveHook(Box: Integer): Boolean;
by: J J
Description: Moves the hook to a box number you input. The box number resembles
a position this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function MoveHook(Box: Integer): Boolean;
var
H, V, X, Y, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(700, 325, 720, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(570, 325, 590, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');

if not(BoxSpot = HookBoxSpot) then
begin
if (BoxSpot > HookBoxSpot) then
begin
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 265, 650, 280, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 385, 650, 405, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
Wait(500 + Random(250));
end;

{*******************************************************************************
function MollyLocation: TPoint;
by: J J
Description: Returns a TPoint of the location of the correct Molly's boots
This TPoint can be used in the Mollybox function to convert it
to a box number
*******************************************************************************}
function MollyLocation: TPoint;
var
X, Y, Q, i: Integer;
P, T: TPoint;
Hair, Boots: TPointArray;
HairSplit, BootsSplit: T2DPointArray;
SearchBox: TBox;
Col, Tol: Array of Integer;
Hue, Sat: Array of Extended;

begin
case MollyHair of
'LightBrown': Q := 0;
'DarkBrown': Q := 1;
'LightBlond': Q := 2;
'DarkBlond': Q := 3;
'Red': Q := 4;
end;

Col := [3161416, 1517614, 3658722, 3573399, 2710186];
Tol := [14, 10, 10, 20, 17];
Hue := [0.13, 0.21, 0.15, 0.08, 0.11];
Sat := [0.08, 0.64, 2.31, 0.49, 0.59];

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue[Q], Sat[Q]);
if FindColorsSpiralTolerance(X, Y, Hair, Col[Q], MSX1, MSY1, MSX2, 200, Tol[Q]) then
begin
if (Length(Hair) > 10)then
begin
if Debug then
SMART_DrawDotsEx(False, Hair, clPurple);
SplitTPAExWrap(Hair, 1, 1, HairSplit);
SortATPASize(HairSplit, True);
for i:=0 to high(HairSplit) do
begin
if (Length(HairSplit[i]) > 10) and (Length(HairSplit[i]) < 75) then
begin
P := MiddleTPA(HairSplit[i]);
SearchBox := IntToBox(P.X-6, P.Y+2, P.X+6, P.Y+8);
if Debug then
SMART_DrawBoxes(False, [SearchBox], clRed);
SetColorSpeed2Modifiers(0.09, 0.85);
if FindColorSpiralTolerance(X, Y, 4555446, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 21) then
begin
WriteLn('Potential Molly has been found at: '+IntToStr(P.X)+', '+IntToStr(P.Y)+'');
if Debug then
begin
SMART_DrawCircle(False, P, 5, True, clGreen);
SMART_DrawBoxes(False, [IntToBox(SearchBox.X1-10, SearchBox.Y1+40, SearchBox.X2+10, SearchBox.Y2+70)], clYellow);
end;
SetColorSpeed2Modifiers(0.40, 0.68);
if FindColorsSpiralTolerance(X, Y, Boots, 2176834, SearchBox.X1-5, SearchBox.Y1+40, SearchBox.X2+5, SearchBox.Y2+70, 11) then
begin
SplitTPAExWrap(Boots, 2, 2, BootsSplit);
SortATPASize(BootsSplit, True);
T := Point(MiddleTPA(Boots).X, GetTPABounds(BootsSplit[0]).Y2);
if Debug then
begin
SMART_DrawDotsEx(False, Boots, clAqua);
SMART_DrawCircle(False, T, 2, True, clWhite);
end;
WriteLn('Detected boots, correct Molly has been found at '+IntToStr(T.X)+', '+IntToStr(T.Y)+'');
Result := T;
Break;
end;
end;
end;
end;
end;
end;
end;

{*******************************************************************************
function MollyBox(MollyTPoint: TPoint): Integer;
by: J J
Description: Returns an integer which resembles the position of Molly on this
grid: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
It uses the FindHair function to get the position of Molly.
*******************************************************************************}
function MollyBox(MollyPosition: TPoint): Integer;
var
X, i, k: Integer;
YI, YII, Col, Tol, XSplit, YSplit, X1, Y1, X2, Y2, Multiplier, Height: Array of Integer;
Hue, Sat: Array of Extended;
Row: Array[0..10] of Array[0..9] of TBox;

begin
YI := [47, 45, 46, 51, 54];
YII := [237, 241, 250, 241, 250];
Hue := [0.12, 0.58];
Sat := [2.77, 0.99];
Col := [2240266, 3702093];
Tol := [5, 10];
XSplit := [6, 8];
YSplit := [6, 8];

case HookPosition of
'Normal': begin
X := 0;
X1 := [61, 78, 92, 104, 114, 124, 132, 139, 146, 151];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [110, 126, 137, 146, 153, 160, 166, 171, 177, 180];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-2 * Multiplier[k]), Y1[k], X2[k] + (-2 * Multiplier[k]), Y2[k]);
1: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k], X2[k] + (-1 * Multiplier[k]), Y2[k]);
2..10: Row[i][k] := IntToBox(X1[k] + ((i-2) * Multiplier[k]), Y1[k], X2[k] + ((i-2) * Multiplier[k]), Y2[k]);
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(54, 56);
1: Result := RandomRange(64, 66);
2: Result := RandomRange(74, 76);
end;
end;
'OneLeft': begin
X := 1;
X1 := [69, 89, 105, 118, 140, 151, 162, 172, 180, 186];
Y1 := [194, 167, 143, 123, 104, 90, 77, 66, 54, 43];
X2 := [118, 133, 144, 156, 169, 180, 188, 197, 204, 211];
Y2 := [224, 187, 160, 140, 117, 101, 86, 75, 64, 52];
Multiplier := [62, 56, 52, 48, 38, 36, 34, 33, 32, 31];
Height := [4, 3, 3, 3, 2, 2, 2, 1, 1, 1];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((i-1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((i-1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(4, 6);
1: Result := RandomRange(14, 16);
2: Result := RandomRange(24, 26);
end;
end;
'TwoLeft': begin
X := 2;
X1 := [66, 96, 116, 135, 152, 170, 183, 195, 206, 215];
Y1 := [184, 158, 135, 118, 101, 90, 77, 66, 55, 46];
X2 := [122, 146, 162, 178, 192, 205, 217, 225, 235, 245];
Y2 := [210, 181, 153, 135, 116, 102, 87, 75, 63, 53];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 33, 31];
Height := [8, 7, 7, 6, 6, 5, 5, 5, 4, 3];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(4, 6);
1: Result := RandomRange(14, 16);
2: Result := RandomRange(24, 26);
end;
end;
'OneRight': begin
X := 3;
X1 := [420, 386, 371, 360, 349, 338, 329, 321, 318, 310];
Y1 := [196, 167, 144, 123, 106, 89, 78, 64, 52, 40];
X2 := [470, 431, 412, 396, 378, 366, 355, 345, 339, 331];
Y2 := [222, 187, 160, 138, 118, 102, 88, 75, 60, 49];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 34, 32];
Height := [4, 4, 3, 3, 3, 3, 2, 2, 2, 2];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((-i+1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((-i+1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(103, 105);
1: Result := RandomRange(103, 105);
2: Result := RandomRange(103, 105);
end;
end;
'TwoRight': begin
X := 4;
X1 := [395, 373, 358, 341, 323, 311, 299, 290, 284, 277];
Y1 := [182, 158, 137, 119, 103, 89, 79, 66, 52, 41];
X2 := [447, 415, 394, 373, 359, 342, 331, 321, 311, 301];
Y2 := [210, 177, 153, 132, 115, 99, 86, 74, 63, 54];
Multiplier := [54, 45, 36, 34, 40, 38, 36, 33, 33, 33];
Height := [8, 6, 4, 4, 4, 4, 4, 4, 4, 3];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (-i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(103, 105);
1: Result := RandomRange(103, 105);
2: Result := RandomRange(103, 105);
end;
end;
end;
WriteLn('Failed to find Molly spot, moving to a random generated spot near middle');
WriteLn('Random spot: '+IntToStr(Result)+'');
end;

{*******************************************************************************
procedure MollyMainloop;
by: J J
Description: Handles the Molly random event
*******************************************************************************}
begin
// Sets up some SRL related things
SetupLogin;
Debug := True;
SMART_ClearCanvas;
MarkTime(C);

// Makes the compass north and angle high and grabs hair color / opens door
ClickNorth(SRL_Angle_High);
GrabMollyHairColor;
OpenMollyDoor;
Wait(5000);

// Handles the talking at the door and opens the control panel
MollyTalk;
UseControls;
Wait(4000);

// Handles the grabbing of Molly
repeat
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
until(MoveHook(MollyBox(MollyLocation)));

WriteLn('Molly completed in: '+IntToStr(TimeFromMark(C))+' milliseconds');
end.

EDIT: I got these detected
// Dark brown, blond, light brown \\
But I've seperated blond to light blond and dark blond so I will have to check which color my Molly had.
I still need Red hair and light or dark blond hair I'll check that out now.

Edit 2:
I have a dark blond hair Molly so I still need:

- Red haired Molly
- Light blond Molly
- Fresh Molly accounts for the mainloop

bolshak25

2012-06-19 05:32:34

i got your back! ill pm you my other 2 molly accounts fresh in there

J J

2012-06-19 06:11:13

From: bolshak25
i got your back! ill pm you my other 2 molly accounts fresh in there

Great :D
This code actually managed to solve nearly the whole molly random. The only problem is that this procedure wasn't correct:

*******************************************************************************
function CatchedMolly: Boolean;
by: J J
Description: Checks if the correct Molly has been catched
*******************************************************************************}
function CatchedMolly: Boolean;
var
PossibleTexts: Array of String;
i, j: Integer;

begin
PossibleTexts := ['ongratulations', 'ongrat', 'tions', 'evil', 'twin'];
for i:=0 to high(PossibleTexts) do
begin
for j:=1 to 8 do
begin
if FindChatBoxText(PossibleTexts[i], j, clBlack) then
Result := True;
end;
end;
ClickContinue(True, True);
end;
I had for j:=0 to 7 do
But the correct text was on line 8 and not on line 7 so it never stopped. But as you can see I've fixed that now. I'm pretty sure that will solve the whole event!

I just have to test it.

{*******************************************************************************
procedure MollyTalk;
by: J J
Description: Handles the conversations with Molly
*******************************************************************************}
procedure MollyTalk;
begin
if AreTalking then
begin
repeat
if not(ClickContinue(True, True)) then
TypeSendEx('2', False);
Wait(750 + Random(750));
until not(AreTalking);
end;
end;
This works really well to handle the conversations, simple but it gets the job done correctly.

New code:
program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox, PreviousBox, C: Integer;
MollyHair: String;
Debug: Boolean;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
end;

{*******************************************************************************
procedure TalkToMolly(Where: String);
by: J J
Description: Talks to Molly at start
*******************************************************************************}
procedure TalkToMolly(Where: String);
var
FloorColors, MollyColors: TPointArray;
SearchBox: TBox;
MollySplit: T2DPointArray;
P: TPoint;

begin
case Where of
'begin': SearchBox := IntToBox(235, 185, 285, 230);
'end': SearchBox := IntToBox(60, 215, 125, 265);
end;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.17, 0.54);
if FindColorsSpiralTolerance(260, 200, FloorColors, 4215386, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 8) then
begin
MollyColors := TPAFromBox(SearchBox);
MollyColors := ClearTPAFromTPA(MollyColors, FloorColors);
SplitTPAExWrap(MollyColors, 1, 1, MollySplit);
SortATPASize(MollySplit, True);
if Length(MollySplit[0]) > 20 then
begin
P := MiddleTPA(MollySplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [Searchbox], clYellow);
SMART_DrawBoxes(False, [GetTPABounds(MollySplit[0])], clRed);
SMART_DrawCircle(False, P, 5, False, clAqua);
end;
MMouse(P.X, P.Y, RandomRange(-2, 2), RandomRange(-2, 2));
Wait(50 + Random(100));
ClickMouse2(1);
end;
end;
end;

{*******************************************************************************
procedure MollyTalk;
by: J J
Description: Handles the conversations with Molly
*******************************************************************************}
procedure MollyTalk;
begin
if AreTalking then
begin
repeat
if not(ClickContinue(True, True)) then
TypeSendEx('2', False);
Wait(750 + Random(750));
until not(AreTalking);
end;
end;

{*******************************************************************************
procedure GrabMollyHairColor;
by: J J
Description: Returns molly's hair color by using the hair color while in chat
*******************************************************************************}
procedure GrabMollyHairColor;
var
HairColor, Tol, i: Integer;
HairColorExtended, Lowest: Extended;
HairColors: TIntegerArray;
Speed2Modifiers, HairDefinedColors: TExtendedArray;

begin
TPAFromCircle(59, 389, 5);
HairColors := GetColors(TPAFromBox(IntToBox(48, 375, 67, 396)));
HairColor := GetBestColor(HairColors, 2, Tol, Speed2Modifiers);
WriteLn('Hair colors: '+ToStr(HairColors)+'');
WriteLn('Best molly hair color: '+ToStr(HairColor)+'');
WriteLn('Best tolerance: '+ToStr(Tol)+'');
WriteLn('Modifiers: '+ToStr(Speed2Modifiers)+'');
if Debug then
SMART_DrawCircle(False, Point(59, 389), 5, False, clRed);

// Dark brown, dark blond, light brown \\
HairDefinedColors := [2178123, 3103606, 3954284];
HairColorExtended := HairColor;
Lowest := HairDefinedColors[0]+1;
for i:=0 to 2 do
begin
if Abs(HairColor-HairDefinedColors[i]) < Lowest then
begin
Lowest := Abs(HairColor-HairDefinedColors[i]);
case i of
0: MollyHair := 'DarkBrown';
1: MollyHair := 'DarkBlond';
2: MollyHair := 'LightBrown';
end;
WriteLn('Molly''s hair color: '+MollyHair+'');
end;
end;
end;

{*******************************************************************************
procedure OpenMollyDoor(Where: String);
by: J J
Description: Opens the door in the Molly random event
Uses the brown colors of the door
*******************************************************************************}
procedure OpenMollyDoor(Where: String);
var
P: TPoint;
Door: TPointArray;
DoorSplit: T2DPointArray;
Searchbox: TBox;

begin
case Where of
'begin': SearchBox := IntToBox(380, 80, 480, 180);
'end': SearchBox := IntToBox(10, 60, 100, 180);
end;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.35, 0.77);
if FindColorsSpiralTolerance(MSCX, MSCY, Door, 7115939, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 5) then
begin
SplitTPAExWrap(Door, 2, 2, DoorSplit);
SortATPASize(DoorSplit, True);
if Length(DoorSplit[0]) > 0 then
begin
P := MiddleTPA(DoorSplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [GetTPABounds(DoorSplit[0])], clRed);
SMART_DrawDotsEx(False, Door, clGreen);
SMART_DrawDotsEx(False, DoorSplit[0], clYellow);
SMART_DrawCircle(False, P, 2, True, clPurple);
end;
MMouse(P.x, P.y, RandomRange(-5, 5), RandomRange(-5, 5));
Wait(RandomRange(50, 150));
case Random(7) of
0..4: ClickMouse2(1);
5..6: begin
ClickMouse2(0);
WaitOptionMulti(['pen', 'Open'], 1000);
end;
end;
end;
end;
end;

{*******************************************************************************
procedure UseControls;
by: J J
Description: Opens the control panel in the Molly random event
Uses the wooden parts of the control panel
*******************************************************************************}
procedure UseControls;
var
P: TPoint;
Controls: TPointArray;
ControlsSplit: T2DPointArray;

begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.31, 1.45);
if FindColorsSpiralTolerance(MSCX, MSCY, Controls, 3366704, MSX1, 80, MSX2, 280, 4) then
begin
SplitTPAExWrap(Controls, 2, 2, ControlsSplit);
SortATPASize(ControlsSplit, True);
if Length(ControlsSplit[0]) > 0 then
begin
P := MiddleTPA(ControlsSplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [GetTPABounds(ControlsSplit[0])], clRed);
SMART_DrawDotsEx(False, Controls, clGreen);
SMART_DrawDotsEx(False, ControlsSplit[0], clYellow);
SMART_DrawCircle(False, P, 2, True, clPurple);
end;
MMouse(P.x, P.y, RandomRange(-5, 5), RandomRange(-5, 5));
Wait(RandomRange(50, 150));
case Random(7) of
0..4: ClickMouse2(1);
5..6: begin
ClickMouse2(0);
WaitOptionMulti(['ontrol', 'Use', 'panel'], 1000);
end;
end;
end;
end;
end;

{*******************************************************************************
function HookPosition: String;
by: J J
Description: Returns the angle of the hook by using the fence to calculate
the perspective.
*******************************************************************************}
function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

{*******************************************************************************
function NormalHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in a normal
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;

begin
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

{*******************************************************************************
function TwoLeftHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the two left
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

{*******************************************************************************
function OneLeftHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the one left
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

{*******************************************************************************
function TwoRightHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the two right
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

{*******************************************************************************
function OneRightHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the one right
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

{*******************************************************************************
function MoveHook(Box: Integer): Boolean;
by: J J
Description: Moves the hook to a box number you input. The box number resembles
a position this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function MoveHook(Box: Integer): Boolean;
var
H, V, X, Y, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(700, 325, 720, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(570, 325, 590, 340, 1);
end;
Wait(100 + Random(50));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');

if not(BoxSpot = HookBoxSpot) then
begin
if (BoxSpot > HookBoxSpot) then
begin
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 265, 650, 280, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 385, 650, 405, 1);
end;
Wait(100 + Random(50));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
Wait(500 + Random(250));
end;

{*******************************************************************************
function MollyLocation: TPoint;
by: J J
Description: Returns a TPoint of the location of the correct Molly's boots
This TPoint can be used in the Mollybox function to convert it
to a box number
*******************************************************************************}
function MollyLocation: TPoint;
var
X, Y, Q, i: Integer;
P, T: TPoint;
Hair, Boots: TPointArray;
HairSplit, BootsSplit: T2DPointArray;
SearchBox: TBox;
Col, Tol: Array of Integer;
Hue, Sat: Array of Extended;

begin
case MollyHair of
'LightBrown': Q := 0;
'DarkBrown': Q := 1;
'LightBlond': Q := 2;
'DarkBlond': Q := 3;
'Red': Q := 4;
end;

Col := [3161416, 1517614, 3658722, 3573399, 2710186];
Tol := [14, 10, 10, 20, 17];
Hue := [0.13, 0.21, 0.15, 0.08, 0.11];
Sat := [0.08, 0.64, 2.31, 0.49, 0.59];

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue[Q], Sat[Q]);
if FindColorsSpiralTolerance(X, Y, Hair, Col[Q], MSX1, MSY1, MSX2, 200, Tol[Q]) then
begin
if (Length(Hair) > 10)then
begin
if Debug then
SMART_DrawDotsEx(False, Hair, clPurple);
SplitTPAExWrap(Hair, 1, 1, HairSplit);
SortATPASize(HairSplit, True);
for i:=0 to high(HairSplit) do
begin
if (Length(HairSplit[i]) > 10) and (Length(HairSplit[i]) < 75) then
begin
P := MiddleTPA(HairSplit[i]);
SearchBox := IntToBox(P.X-6, P.Y+2, P.X+6, P.Y+8);
if Debug then
SMART_DrawBoxes(False, [SearchBox], clRed);
SetColorSpeed2Modifiers(0.09, 0.85);
if FindColorSpiralTolerance(X, Y, 4555446, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 21) then
begin
WriteLn('Potential Molly has been found at: '+IntToStr(P.X)+', '+IntToStr(P.Y)+'');
if Debug then
begin
SMART_DrawCircle(False, P, 5, True, clGreen);
SMART_DrawBoxes(False, [IntToBox(SearchBox.X1-10, SearchBox.Y1+40, SearchBox.X2+10, SearchBox.Y2+70)], clYellow);
end;
SetColorSpeed2Modifiers(0.40, 0.68);
if FindColorsSpiralTolerance(X, Y, Boots, 2176834, SearchBox.X1-5, SearchBox.Y1+40, SearchBox.X2+5, SearchBox.Y2+70, 11) then
begin
SplitTPAExWrap(Boots, 2, 2, BootsSplit);
SortATPASize(BootsSplit, True);
T := Point(MiddleTPA(Boots).X, GetTPABounds(BootsSplit[0]).Y2);
if Debug then
begin
SMART_DrawDotsEx(False, Boots, clAqua);
SMART_DrawCircle(False, T, 2, True, clWhite);
end;
WriteLn('Detected boots, correct Molly has been found at '+IntToStr(T.X)+', '+IntToStr(T.Y)+'');
Result := T;
Break;
end;
end;
end;
end;
end;
end;
end;

{*******************************************************************************
function MollyBox(MollyTPoint: TPoint): Integer;
by: J J
Description: Returns an integer which resembles the position of Molly on this
grid: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
It uses the FindHair function to get the position of Molly.
*******************************************************************************}
function MollyBox(MollyPosition: TPoint): Integer;
var
X, i, k: Integer;
YI, YII, Col, Tol, XSplit, YSplit, X1, Y1, X2, Y2, Multiplier, Height: Array of Integer;
Hue, Sat: Array of Extended;
Row: Array[0..10] of Array[0..9] of TBox;

begin
YI := [47, 45, 46, 51, 54];
YII := [237, 241, 250, 241, 250];
Hue := [0.12, 0.58];
Sat := [2.77, 0.99];
Col := [2240266, 3702093];
Tol := [5, 10];
XSplit := [6, 8];
YSplit := [6, 8];

case HookPosition of
'Normal': begin
X := 0;
X1 := [61, 78, 92, 104, 114, 124, 132, 139, 146, 151];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [110, 126, 137, 146, 153, 160, 166, 171, 177, 180];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-2 * Multiplier[k]), Y1[k], X2[k] + (-2 * Multiplier[k]), Y2[k]);
1: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k], X2[k] + (-1 * Multiplier[k]), Y2[k]);
2..10: Row[i][k] := IntToBox(X1[k] + ((i-2) * Multiplier[k]), Y1[k], X2[k] + ((i-2) * Multiplier[k]), Y2[k]);
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(54, 56);
1: Result := RandomRange(64, 66);
2: Result := RandomRange(74, 76);
end;
end;
'OneLeft': begin
X := 1;
X1 := [69, 89, 105, 118, 140, 151, 162, 172, 180, 186];
Y1 := [194, 167, 143, 123, 104, 90, 77, 66, 54, 43];
X2 := [118, 133, 144, 156, 169, 180, 188, 197, 204, 211];
Y2 := [224, 187, 160, 140, 117, 101, 86, 75, 64, 52];
Multiplier := [62, 56, 52, 48, 38, 36, 34, 33, 32, 31];
Height := [4, 3, 3, 3, 2, 2, 2, 1, 1, 1];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((i-1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((i-1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(4, 6);
1: Result := RandomRange(14, 16);
2: Result := RandomRange(24, 26);
end;
end;
'TwoLeft': begin
X := 2;
X1 := [66, 96, 116, 135, 152, 170, 183, 195, 206, 215];
Y1 := [184, 158, 135, 118, 101, 90, 77, 66, 55, 46];
X2 := [122, 146, 162, 178, 192, 205, 217, 225, 235, 245];
Y2 := [210, 181, 153, 135, 116, 102, 87, 75, 63, 53];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 33, 31];
Height := [8, 7, 7, 6, 6, 5, 5, 5, 4, 3];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(4, 6);
1: Result := RandomRange(14, 16);
2: Result := RandomRange(24, 26);
end;
end;
'OneRight': begin
X := 3;
X1 := [420, 386, 371, 360, 349, 338, 329, 321, 318, 310];
Y1 := [196, 167, 144, 123, 106, 89, 78, 64, 52, 40];
X2 := [470, 431, 412, 396, 378, 366, 355, 345, 339, 331];
Y2 := [222, 187, 160, 138, 118, 102, 88, 75, 60, 49];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 34, 32];
Height := [4, 4, 3, 3, 3, 3, 2, 2, 2, 2];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((-i+1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((-i+1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(103, 105);
1: Result := RandomRange(103, 105);
2: Result := RandomRange(103, 105);
end;
end;
'TwoRight': begin
X := 4;
X1 := [395, 373, 358, 341, 323, 311, 299, 290, 284, 277];
Y1 := [182, 158, 137, 119, 103, 89, 79, 66, 52, 41];
X2 := [447, 415, 394, 373, 359, 342, 331, 321, 311, 301];
Y2 := [210, 177, 153, 132, 115, 99, 86, 74, 63, 54];
Multiplier := [54, 45, 36, 34, 40, 38, 36, 33, 33, 33];
Height := [8, 6, 4, 4, 4, 4, 4, 4, 4, 3];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (-i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
case Random(3) of
0: Result := RandomRange(103, 105);
1: Result := RandomRange(103, 105);
2: Result := RandomRange(103, 105);
end;
end;
end;
WriteLn('Failed to find Molly spot, moving to a random generated spot near middle');
WriteLn('Random spot: '+IntToStr(Result)+'');
end;

{*******************************************************************************
function CatchedMolly: Boolean;
by: J J
Description: Checks if the correct Molly has been catched
*******************************************************************************}
function CatchedMolly: Boolean;
var
PossibleTexts: Array of String;
i, j: Integer;

begin
PossibleTexts := ['ongratulations', 'ongrat', 'tions', 'evil', 'twin'];
for i:=0 to high(PossibleTexts) do
begin
for j:=1 to 8 do
begin
if FindChatBoxText(PossibleTexts[i], j, clBlack) then
Result := True;
end;
end;
ClickContinue(True, True);
end;

{*******************************************************************************
procedure MollyMainloop;
by: J J
Description: Handles the Molly random event
*******************************************************************************}
begin
// Sets up some SRL related things
SetupLogin;
Debug := True;
SMART_ClearCanvas;
MarkTime(C);

// Makes the compass north and angle high and grabs hair color / opens door
ClickNorth(SRL_Angle_High);
TalkToMolly('begin');
Wait(2000);
ClickContinue(True, True);
GrabMollyHairColor;
MollyTalk;

// Opens the door and opens control panel
OpenMollyDoor('begin');
Wait(5000);
UseControls;
Wait(4000);

// Handles the grabbing of Molly
repeat
repeat
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
until(MoveHook(MollyBox(MollyLocation)));
Mousebox(694, 420, 707, 434, 1);
Wait(3000);
until(CatchedMolly);
Wait(10000);

// Handles the talking to Molly to finish
OpenMollyDoor('end');
Wait(5000);
TalkToMolly('end');
Wait(3000);
MollyTalk;

WriteLn('Molly completed in: '+IntToStr(TimeFromMark(C))+' milliseconds');
end.

Oh yeah I sacrificed two of my own Molly accounts to test this and both times it grabbed Molly so that is great. Also got some video material to finish the scripting at the end. Actually used it already so it should work, if not I can use the video material to see what is wrong.

EDIT: I got a "Second Chance Final Exam" in about 1,5 hours of now so I'm off for a while. I've already passed all my exams and graduated but you get a second chance in one exam to get a higher note. So I had a 6.45 which was rounded down to a 6, so I hope I get 0.1 higher this time so I have a 7 for that.

EDIT 2: All waits are still static to make sure they are working. I will add randomness later if the static ones work.

EDIT 3: Back from school, added randomness and longer waits for certain things to make sure even laggy accounts can solve it. Doubled the movement speed of the grabber.

program JJsMollySolver;
{$DEFINE SMART}
{$i srl/srl.simba}
{$i srl/srl/misc/paintsmart.simba}

var
HookBox, PreviousBox, C: Integer;
MollyHair: String;
Debug: Boolean;

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

with Players[0] do
begin
Name := '';
Pass := '';
Pin := '';
Active := True;
end;
end;

procedure SetupLogin;
begin
//ClearDebug;
Smart_Server := 10;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
LoginPlayer;
end;

{*******************************************************************************
procedure TalkToMolly;
by: J J
Description: Talks to Molly at start
*******************************************************************************}
procedure TalkToMolly;
var
FloorColors, MollyColors: TPointArray;
SearchBox: TBox;
MollySplit: T2DPointArray;
P: TPoint;

begin
SearchBox := IntToBox(60, 215, 125, 265);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.17, 0.54);
if FindColorsSpiralTolerance(260, 200, FloorColors, 4215386, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 8) then
begin
MollyColors := TPAFromBox(SearchBox);
MollyColors := ClearTPAFromTPA(MollyColors, FloorColors);
SplitTPAExWrap(MollyColors, 1, 1, MollySplit);
SortATPASize(MollySplit, True);
if Length(MollySplit[0]) > 20 then
begin
P := MiddleTPA(MollySplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [Searchbox], clYellow);
SMART_DrawBoxes(False, [GetTPABounds(MollySplit[0])], clRed);
SMART_DrawCircle(False, P, 5, False, clAqua);
end;
MMouse(P.X, P.Y, RandomRange(-2, 2), RandomRange(-2, 2));
Wait(50 + Random(100));
ClickMouse2(1);
end;
end;
end;

{*******************************************************************************
procedure MollyTalk;
by: J J
Description: Handles the conversations with Molly
*******************************************************************************}
procedure MollyTalk;
begin
if AreTalking then
begin
repeat
if not(ClickContinue(True, True)) then
TypeSendEx('1', False);
Wait(750 + Random(750));
until not(AreTalking);
end;
end;

{*******************************************************************************
procedure GrabMollyHairColor;
by: J J
Description: Returns molly's hair color by using the hair color while in chat
*******************************************************************************}
procedure GrabMollyHairColor;
var
HairColor, Tol, i: Integer;
HairColorExtended, Lowest: Extended;
HairColors: TIntegerArray;
Speed2Modifiers, HairDefinedColors: TExtendedArray;

begin
HairColors := GetColors(TPAFromBox(IntToBox(48, 375, 67, 396)));
HairColor := GetBestColor(HairColors, 2, Tol, Speed2Modifiers);

if Debug then
begin
SMART_DrawCircle(False, Point(59, 389), 5, False, clGreen);
WriteLn('Hair colors: '+ToStr(HairColors)+'');
WriteLn('Best molly hair color: '+ToStr(HairColor)+'');
WriteLn('Best tolerance: '+ToStr(Tol)+'');
WriteLn('Modifiers: '+ToStr(Speed2Modifiers)+'');
end;

// Dark brown, dark blond, light brown, red \\
HairDefinedColors := [2178123, 3103606, 3954284, 2441835];
HairColorExtended := HairColor;
Lowest := HairDefinedColors[0]+1;
for i:=0 to 3 do
begin
if Abs(HairColor-HairDefinedColors[i]) < Lowest then
begin
Lowest := Abs(HairColor-HairDefinedColors[i]);
case i of
0: MollyHair := 'DarkBrown';
1: MollyHair := 'DarkBlond';
2: MollyHair := 'LightBrown';
3: MollyHair := 'Red';
end;
end;
end;
WriteLn('Molly''s hair color: '+MollyHair+'');
end;

{*******************************************************************************
procedure OpenMollyDoor(Where: String);
by: J J
Description: Opens the door in the Molly random event
Uses the brown colors of the door
*******************************************************************************}
procedure OpenMollyDoor(Where: String);
var
P: TPoint;
Door: TPointArray;
DoorSplit: T2DPointArray;
Searchbox: TBox;

begin
case Where of
'begin': SearchBox := IntToBox(380, 80, 480, 180);
'end': SearchBox := IntToBox(10, 60, 100, 180);
end;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.35, 0.77);
if FindColorsSpiralTolerance(MSCX, MSCY, Door, 7115939, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 5) then
begin
WriteLn('Found the door, opening it!');
SplitTPAExWrap(Door, 2, 2, DoorSplit);
SortATPASize(DoorSplit, True);
if Length(DoorSplit[0]) > 10 then
begin
P := MiddleTPA(DoorSplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [GetTPABounds(DoorSplit[0])], clRed);
SMART_DrawDotsEx(False, Door, clGreen);
SMART_DrawDotsEx(False, DoorSplit[0], clYellow);
SMART_DrawCircle(False, P, 2, True, clPurple);
end;
MMouse(P.x, P.y, RandomRange(-5, 5), RandomRange(-5, 5));
Wait(RandomRange(50, 150));
case Random(7) of
0..4: ClickMouse2(1);
5..6: begin
ClickMouse2(0);
WaitOptionMulti(['pen', 'Open'], 1000);
end;
end;
end;
end;
end;

{*******************************************************************************
procedure UseControls;
by: J J
Description: Opens the control panel in the Molly random event
Uses the wooden parts of the control panel
*******************************************************************************}
procedure UseControls;
var
P: TPoint;
Controls: TPointArray;
ControlsSplit: T2DPointArray;

begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.32, 1.67);
if FindColorsSpiralTolerance(MSCX, MSCY, Controls, 3366960, MSX1, 80, MSX2, 280, 4) then
begin
WriteLn('Detected the machine, clicking on it!');
SplitTPAExWrap(Controls, 2, 2, ControlsSplit);
SortATPASize(ControlsSplit, True);
if Length(ControlsSplit[0]) > 2 then
begin
P := MiddleTPA(ControlsSplit[0]);
if Debug then
begin
SMART_DrawBoxes(False, [GetTPABounds(ControlsSplit[0])], clRed);
SMART_DrawDotsEx(False, Controls, clGreen);
SMART_DrawDotsEx(False, ControlsSplit[0], clYellow);
SMART_DrawCircle(False, P, 2, True, clPurple);
end;
MMouse(P.x, P.y, RandomRange(-5, 5), RandomRange(-5, 5));
Wait(RandomRange(50, 150));
case Random(7) of
0..4: ClickMouse2(1);
5..6: begin
ClickMouse2(0);
WaitOptionMulti(['ontrol', 'Use', 'panel'], 1000);
end;
end;
end;
end;
end;

{*******************************************************************************
function HookPosition: String;
by: J J
Description: Returns the angle of the hook by using the fence to calculate
the perspective.
*******************************************************************************}
function HookPosition: String;
var
X, Y, i, NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM: Integer;
DTMArray: Array of Integer;

begin
NormalDTM := DTMFromString('mlwAAAHicY2dgYGBiZGBQBtKaQHwXyH4IxCuA7AQgfQFInwfiR1B8EYld4qzC0OytyZBoIQfGWbaKDHn2SmA2P1AeF2bCg6EAAOTUDx0=');
TwoLeftDTM := DTMFromString('mlwAAAHicY2dgYMhlZWA4zMLAcBSIfwKxCRsDgz4QvwGK/wbK3wTiV1DMz8jAIA/EPECcaiXPkGWryJBoIceQbCnPkG6jAGaDxPlBanFgJjwYCgC16Q3z');
OneLeftDTM := DTMFromString('mlwAAAHicY2dgYKhkZWA4xMLAcASI/wGxPRsDgzUQ/wSK/wHKPwfib0D8EYgZGBkYhIGYFYiTLeUZ0m0UGBIt5FDYqVbyDPxApbgwEx4MBQDPBg4e');
OneRightDTM := DTMFromString('mlwAAAHicY2dgYOhnZWBwZmNgsAXibhYGhglAzA8UYwXyfwDl7wHxJyBmZmRgEAdiJiB+B+QnWsgxtPtpMcSbyzKkWsmDaZBYsqU8Az9QHhdmwoOhAACpYAwC');
TwoRightDTM := DTMFromString('mlwAAAHicY2dgYIhhZWBgZ2NgYAHi80D2NBYGhplAfA+IfwPlbwHxSyB+AcS8jAwMCkDMA8SpVvIM6TYKDIkWcmB2lq0inM0PVIsLM+HBUAAAI+IM+Q==');

DTMArray := [NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM];

for i:=0 to 4 do
begin
if FindDTM(DTMArray[i], X, Y, MSX1, MSY1, MSX2, MSY2) then
begin
case i of
0: Result := 'Normal';
1: Result := 'TwoLeft';
2: Result := 'OneLeft';
3: Result := 'OneRight';
4: Result := 'TwoRight';
end;
Break;
end;
end;

FreeDTMs([NormalDTM, TwoLeftDTM, OneLeftDTM, OneRightDTM, TwoRightDTM]);
end;

{*******************************************************************************
function NormalHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in a normal
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function NormalHook: Integer;
var
i, x, CountedColors, Highest: Integer;
Row: Array[0..6] of Array[0..9] of TBox;
X1, Y1, X2, Y2, Multiplier: Array of Integer;

begin
X1 := [66, 83, 97, 109, 120, 129, 137, 144, 150, 156];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [100, 121, 132, 141, 148, 156, 162, 167, 173, 177];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];

for i:=0 to 6 do
begin
for x:=0 to 9 do
begin
Row[i][x] := IntToBox(X1[x] + (i * Multiplier[x]), Y1[x], X2[x] + (i * Multiplier[x]), Y2[x]);
if Debug then
SMART_DrawBoxes(False, [Row[i][x]], clRed);
CountedColors := CountColorTolerance(2373117, Row[i][x].X1, Row[i][x].Y1, Row[i][x].X2, Row[i][x].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (20 + (10 * i) + x);
WriteLn('Hook box position: '+IntToStr(((10 * i) + x + 20))+'');
end;
end;
end;
end;

{*******************************************************************************
function TwoLeftHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the two left
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function TwoLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [76, 105, 128, 147, 164, 178, 191, 203, 213, 222];
Y1 := [184, 158, 137, 119, 103, 89, 77, 65, 55, 46];
X2 := [112, 138, 157, 174, 189, 202, 214, 224, 233, 242];
Y2 := [208, 177, 153, 133, 115, 99, 86, 74, 63, 53];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := i;
WriteLn('Hook box position: '+IntToStr(i)+'');
end;
end;
end;

{*******************************************************************************
function OneLeftHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the one left
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function OneLeftHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..9] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [71, 94, 112, 128, 142, 154, 164, 174, 182, 190];
Y1 := [196, 167, 143, 123, 106, 90, 77, 65, 54, 45];
X2 := [108, 128, 144, 157, 168, 180, 188, 197, 203, 210];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73, 62, 51];

for i:=0 to 9 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (10 + i)
WriteLn('Hook box position: '+IntToStr((10 + i))+'');
end;
end;
end;

{*******************************************************************************
function TwoRightHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the two right
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function TwoRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [420, 380, 360, 343, 328, 316, 304, 294];
Y1 := [182, 158, 137, 119, 103, 89, 77, 66];
X2 := [445, 413, 390, 371, 354, 339, 327, 315];
Y2 := [210, 177, 153, 133, 115, 99, 86, 74];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (100 + i);
WriteLn('Hook box position: '+IntToStr((100 + i))+'');
end;
end;
end;

{*******************************************************************************
function OneRightHook: Integer;
by: J J
Description: Finds the position of the hook if it is positioned in the one right
perspective. It returns an integer which resembles a position
on this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function OneRightHook: Integer;
var
i, CountedColors, Highest: Integer;
Box: Array[0..7] of TBox;
X1, Y1, X2, Y2: Array of Integer;

begin
X1 := [422, 389, 373, 360, 349, 338, 329, 321];
Y1 := [196, 167, 144, 123, 106, 91, 77, 65];
X2 := [448, 424, 405, 390, 376, 364, 353, 344];
Y2 := [222, 187, 160, 138, 118, 101, 86, 73];

for i:=0 to 7 do
begin
Box[i] := IntToBox(X1[i], Y1[i], X2[i], Y2[i]);
if Debug then
SMART_DrawBoxes(False, [Box[i]], clRed);
CountedColors := CountColorTolerance(2373117, Box[i].X1, Box[i].Y1, Box[i].X2, Box[i].Y2, 5);
if CountedColors > Highest then
begin
Highest := CountedColors;
Result := (90 + i);
WriteLn('Hook box position: '+IntToStr((90 + i))+'');
end;
end;
end;

{*******************************************************************************
function MoveHook(Box: Integer): Boolean;
by: J J
Description: Moves the hook to a box number you input. The box number resembles
a position this map: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
*******************************************************************************}
function MoveHook(Box: Integer): Boolean;
var
H, V, X, Y, BoxRow, HookBoxRow, Horizontal, Vertical, BoxSpot, HookBoxSpot: Integer;

begin
if Box = -1 then
begin
Wait(2000 + Random(2000));
WriteLn('Not moving the hook because the box is false!');
Exit;
end;

if not(Box = HookBox) then
begin
// Horizontal movement
BoxRow := (Box / 10);
HookBoxRow := (HookBox / 10);
WriteLn('BoxRow: '+IntToStr(BoxRow)+'');
WriteLn('HookBoxRow: '+IntToStr(HookBoxRow)+'');

if not(BoxRow = HookBoxRow) then
begin
if (BoxRow > HookBoxRow) then
begin
WriteLn('BoxRow > HookBoxRow');
Horizontal := (BoxRow - HookBoxRow);
WriteLn('Move Right '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(700, 325, 720, 340, 1);
end;
Wait(50 + Random(25));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end else
begin
WriteLn('HookBoxRow > BoxRow');
Horizontal := (HookBoxRow - BoxRow);
WriteLn('Move left '+IntToStr(Horizontal)+' times');
repeat
Inc(H);
if (H > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(570, 325, 590, 340, 1);
end;
Wait(50 + Random(25));
WriteLn('H: '+IntToStr(H)+'');
until(H >= Horizontal);
end;
end else
begin
WriteLn('Correct row');
end;

// Vertical movement
HookBoxSpot := (HookBox - (HookBoxRow * 10));
BoxSpot := (Box - (BoxRow * 10));
WriteLn('HookBoxspot: '+IntToStr(HookBoxSpot)+'');
WriteLn('Boxspot: '+IntToStr(BoxSpot)+'');

if not(BoxSpot = HookBoxSpot) then
begin
if (BoxSpot > HookBoxSpot) then
begin
Vertical := (BoxSpot - HookBoxSpot);
WriteLn('Move up '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 265, 650, 280, 1);
end;
Wait(50 + Random(25));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end else
begin
WriteLn('HookBoxspot > BoxSpot');
Vertical := (HookBoxSpot - BoxSpot);
WriteLn('Move down '+IntToStr(Vertical)+' times');
repeat
Inc(V);
if (V > 1) then
begin
GetMousePos(X, Y);
MMouse(X, Y, RandomRange(-2, 2), RandomRange(-2, 2));
ClickMouse2(1);
end else
begin
MouseBox(635, 385, 650, 405, 1);
end;
Wait(50 + Random(25));
WriteLn('V: '+IntToStr(V)+'');
until(V >= Vertical);
end;
end else
begin
WriteLn('Correct spot');
end;
end else
begin
WriteLn('Correct spot and row!');
Result := True;
end;
Wait(500 + Random(250));
end;

{*******************************************************************************
function MollyLocation: TPoint;
by: J J
Description: Returns a TPoint of the location of the correct Molly's boots
This TPoint can be used in the Mollybox function to convert it
to a box number
*******************************************************************************}
function MollyLocation: TPoint;
var
X, Y, Q, i: Integer;
P, T: TPoint;
Hair, Boots: TPointArray;
HairSplit, BootsSplit: T2DPointArray;
SearchBox: TBox;
Col, Tol: Array of Integer;
Hue, Sat: Array of Extended;

begin
case MollyHair of
'LightBrown': Q := 0;
'DarkBrown': Q := 1;
'LightBlond': Q := 2;
'DarkBlond': Q := 3;
'Red': Q := 4;
end;

Col := [3161416, 1517614, 3658722, 3573399, 2710186];
Tol := [14, 10, 10, 20, 17];
Hue := [0.13, 0.21, 0.15, 0.08, 0.11];
Sat := [0.08, 0.64, 2.31, 0.49, 0.59];

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Hue[Q], Sat[Q]);
if FindColorsSpiralTolerance(X, Y, Hair, Col[Q], MSX1, MSY1, MSX2, 200, Tol[Q]) then
begin
if (Length(Hair) > 10)then
begin
if Debug then
SMART_DrawDotsEx(False, Hair, clPurple);
SplitTPAExWrap(Hair, 1, 1, HairSplit);
SortATPASize(HairSplit, True);
for i:=0 to high(HairSplit) do
begin
if (Length(HairSplit[i]) > 10) and (Length(HairSplit[i]) < 100) then
begin
P := MiddleTPA(HairSplit[i]);
SearchBox := IntToBox(P.X-6, P.Y+2, P.X+6, P.Y+8);
if Debug then
SMART_DrawBoxes(False, [SearchBox], clRed);
SetColorSpeed2Modifiers(0.09, 0.85);
if FindColorSpiralTolerance(X, Y, 4555446, SearchBox.X1, SearchBox.Y1, SearchBox.X2, SearchBox.Y2, 21) then
begin
WriteLn('Potential Molly has been found at: '+IntToStr(P.X)+', '+IntToStr(P.Y)+'');
if Debug then
begin
SMART_DrawCircle(False, P, 5, True, clGreen);
SMART_DrawBoxes(False, [IntToBox(SearchBox.X1-10, SearchBox.Y1+40, SearchBox.X2+10, SearchBox.Y2+70)], clYellow);
end;
SetColorSpeed2Modifiers(0.40, 0.68);
if FindColorsSpiralTolerance(X, Y, Boots, 2176834, SearchBox.X1-5, SearchBox.Y1+40, SearchBox.X2+5, SearchBox.Y2+70, 11) then
begin
SplitTPAExWrap(Boots, 2, 2, BootsSplit);
SortATPASize(BootsSplit, True);
T := Point(MiddleTPA(Boots).X, GetTPABounds(BootsSplit[0]).Y2);
if Debug then
begin
SMART_DrawDotsEx(False, Boots, clAqua);
SMART_DrawCircle(False, T, 3, True, clRed);
end;
WriteLn('Detected boots, correct Molly has been found at '+IntToStr(T.X)+', '+IntToStr(T.Y)+'');
Result := T;
Break;
end;
end;
end;
end;
end;
end;
end;

{*******************************************************************************
function MollyBox(MollyTPoint: TPoint): Integer;
by: J J
Description: Returns an integer which resembles the position of Molly on this
grid: [url]http://img841.imageshack.us/img841/4879/tilesystem.png[/url]
It uses the FindHair function to get the position of Molly.
*******************************************************************************}
function MollyBox(MollyPosition: TPoint): Integer;
var
X, i, k: Integer;
YI, YII, Col, Tol, XSplit, YSplit, X1, Y1, X2, Y2, Multiplier, Height: Array of Integer;
Hue, Sat: Array of Extended;
Row: Array[0..10] of Array[0..9] of TBox;

begin
YI := [47, 45, 46, 51, 54];
YII := [237, 241, 250, 241, 250];
Hue := [0.12, 0.58];
Sat := [2.77, 0.99];
Col := [2240266, 3702093];
Tol := [5, 10];
XSplit := [6, 8];
YSplit := [6, 8];

case HookPosition of
'Normal': begin
X := 0;
X1 := [61, 78, 92, 104, 114, 124, 132, 139, 146, 151];
Y1 := [210, 178, 152, 130, 112, 95, 81, 68, 57, 47];
X2 := [110, 126, 137, 146, 153, 160, 166, 171, 177, 180];
Y2 := [234, 199, 171, 145, 124, 106, 90, 77, 64, 53];
Multiplier := [58, 52, 48, 45, 41, 39, 36, 34, 32, 31];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-2 * Multiplier[k]), Y1[k], X2[k] + (-2 * Multiplier[k]), Y2[k]);
1: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k], X2[k] + (-1 * Multiplier[k]), Y2[k]);
2..10: Row[i][k] := IntToBox(X1[k] + ((i-2) * Multiplier[k]), Y1[k], X2[k] + ((i-2) * Multiplier[k]), Y2[k]);
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'OneLeft': begin
X := 1;
X1 := [69, 89, 105, 118, 140, 151, 162, 172, 180, 186];
Y1 := [194, 167, 143, 123, 104, 90, 77, 66, 54, 43];
X2 := [118, 133, 144, 156, 169, 180, 188, 197, 204, 211];
Y2 := [224, 187, 160, 140, 117, 101, 86, 75, 64, 52];
Multiplier := [62, 56, 52, 48, 38, 36, 34, 33, 32, 31];
Height := [4, 3, 3, 3, 2, 2, 2, 1, 1, 1];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (-1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((i-1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((i-1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'TwoLeft': begin
X := 2;
X1 := [66, 96, 116, 135, 152, 170, 183, 195, 206, 215];
Y1 := [184, 158, 135, 118, 101, 90, 77, 66, 55, 46];
X2 := [122, 146, 162, 178, 192, 205, 217, 225, 235, 245];
Y2 := [210, 181, 153, 135, 116, 102, 87, 75, 63, 53];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 33, 31];
Height := [8, 7, 7, 6, 6, 5, 5, 5, 4, 3];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := ((10 * i) + k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'OneRight': begin
X := 3;
X1 := [420, 386, 371, 360, 349, 338, 329, 321, 318, 310];
Y1 := [196, 167, 144, 123, 106, 89, 78, 64, 52, 40];
X2 := [470, 431, 412, 396, 378, 366, 355, 345, 339, 331];
Y2 := [222, 187, 160, 138, 118, 102, 88, 75, 60, 49];
Multiplier := [62, 56, 52, 48, 44, 41, 38, 35, 34, 32];
Height := [4, 4, 3, 3, 3, 3, 2, 2, 2, 2];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
case i of
0: Row[i][k] := IntToBox(X1[k] + (1 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (1 * Multiplier[k]), Y2[k] + (Height[k]*i));
1: Row[i][k] := IntToBox(X1[k] + (0 * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (0 * Multiplier[k]), Y2[k] + (Height[k]*i));
2..10: Row[i][k] := IntToBox(X1[k] + ((-i+1) * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + ((-i+1) * Multiplier[k]), Y2[k] + (Height[k]*i));
end;
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
'TwoRight': begin
X := 4;
X1 := [395, 373, 358, 341, 323, 311, 299, 290, 284, 277];
Y1 := [182, 158, 137, 119, 103, 89, 79, 66, 52, 41];
X2 := [447, 415, 394, 373, 359, 342, 331, 321, 311, 301];
Y2 := [210, 177, 153, 132, 115, 99, 86, 74, 63, 54];
Multiplier := [54, 45, 36, 34, 40, 38, 36, 33, 33, 33];
Height := [8, 6, 4, 4, 4, 4, 4, 4, 4, 3];
for i:=0 to 10 do
begin
for k:=0 to 9 do
begin
Row[i][k] := IntToBox(X1[k] + (-i * Multiplier[k]), Y1[k] + (Height[k]*i), X2[k] + (-i * Multiplier[k]), Y2[k] + (Height[k]*i));
if PointInBox(MollyPosition, IntToBox(Row[i][k].X1, Row[i][k].Y1, Row[i][k].X2, Row[i][k].Y2)) then
begin
Result := 100 - ((10 * i) - k);
PreviousBox := Result;
WriteLn('Molly is in box: '+IntToStr(Result)+'');
Exit;
end;
if Debug then
SMART_DrawBoxes(False, [Row[i][k]], clGreen);
end;
end;
end;
end;
// It only reaches this far if Molly isn't in a box.. If the box is 0 then it won't move
Result := -1;
end;

{*******************************************************************************
function CatchedMolly: Boolean;
by: J J
Description: Checks if the correct Molly has been catched
*******************************************************************************}
function CatchedMolly: Boolean;
var
PossibleTexts: Array of String;
i, j: Integer;

begin
if FindChatBoxText('innoc', 8, clBlack) then
begin
Wait(15000);
Result := False;
end;

PossibleTexts := ['ongratulations', 'ongrat', 'tions', 'evil', 'twin'];
for i:=0 to high(PossibleTexts) do
begin
for j:=1 to 8 do
begin
if FindChatBoxText(PossibleTexts[i], j, clBlack) then
Result := True;
end;
end;

ClickContinue(True, True);
end;

{*******************************************************************************
procedure MollyMainloop;
by: J J
Description: Handles the Molly random event
*******************************************************************************}
begin
// Sets up some SRL related things
SetupLogin;
Debug := False;
SMART_ClearCanvas;
MarkTime(C);

// Gets from the starting room to the control panel
ClickNorth(SRL_Angle_High);
OpenMollyDoor('begin');
Wait(4000 + Random(1500));
GrabMollyHairColor;
MollyHair := 'Red'; // Temporarily
MollyTalk;
Wait(3000 + Random(1000));
UseControls;
Wait(5000 + Random(2000));

// Handles the grabbing of Molly
repeat
repeat
SMART_ClearCanvas;
MouseSpeed := 15;
case HookPosition of
'Normal': Hookbox := NormalHook;
'TwoLeft': Hookbox := TwoLeftHook;
'OneLeft': Hookbox := OneLeftHook;
'TwoRight': Hookbox := TwoRightHook;
'OneRight': Hookbox := OneRightHook;
end;
until(MoveHook(MollyBox(MollyLocation)));
MouseSpeed := 100;
Mousebox(694, 420, 707, 434, 1);
Wait(3000 + Random(1000));
until(CatchedMolly);
Wait(18000 + Random(6000));

// Handles the talking to Molly to finish
MollyTalk;
OpenMollyDoor('end');
Wait(6000 + Random(2000));
TalkToMolly;
Wait(3000 + Random(1000));
MollyTalk;

WriteLn('Molly completed in: '+MsToTime(TimeFromMark(C), Time_Formal)+'');
end.

J J

2012-06-20 05:43:45

Bolshak25 has lend me another account, great! Unfortunately it was a dark blond Molly and not a light blond molly :( I still need a Light Blond Molly (short blond hair usually = light blond) to complete this. Just need to grab the colors when in chat so yeah..

I used the account to check if the color still worked and it nearly full solved the random event. Unfortunately the door colors aren't the same in room #2 so it didn't click on the door properly.. but I will be fixing that now as I still have one account in the random event.

Currently rendering a video of two full Molly solves, and I will be uploading it soon aswell so yeah. So close to completion.

Video:
www.youtube.com/watch?v=Jl4AHSUD4aM
[youtube]Jl4AHSUD4aM[/youtube]

putonajonny

2012-06-20 07:10:32

Nice one, you should make the final video (when you make it) listed though and watch the legits go mental in the comments :P

litoris

2012-06-20 07:19:56

Nice work, seems like you are almost done with it. +rep
From: putonajonny
Nice one, you should make the final video (when you make it) listed though and watch the legits go mental in the comments :P


He should upload it as a reply to one of Jagex's runecast videos :P

J J

2012-06-20 07:29:29

From: putonajonny
Nice one, you should make the final video (when you make it) listed though and watch the legits go mental in the comments :P

Haha yeah so far they have all been private but I might make the final public just for some laughs :P

From: litoris
Nice work, seems like you are almost done with it. +rep

He should upload it as a reply to one of Jagex's runecast videos :P

Reply it right after the "new botnuke" haha.

XFX

2012-06-20 15:15:47

Wow nice work on the Molly Random. Any idea when this will be finished? Curious how I got a Molly random like 5 min ago and Simba failed it

J J

2012-06-20 15:27:04

From: XFX
Wow nice work on the Molly Random. Any idea when this will be finished? Curious how I got a Molly random like 5 min ago and Simba failed it


Simba does log out once it detects the Molly Random. Not sure if your account is still in the event but if molly has light blond hair (short blond hair = light blond usually) you could possibly lend it to me? I just need one with light blond hair to finish the hair detection at start then it's done. Might need a little bit of tweaking but it works pretty well :)

EDIT: Bolshak25 has lend me another account.. with short blond hair :D
Finishing it now then I will use it to solve the random on the two accounts that are still in there.

EDIT 2: I've now finished the whole solver it works really well :)
Video will be uploaded soon that did the whole random event from start to end.

http://www.youtube.com/watch?v=VG-59gsKQi0
[youtube]VG-59gsKQi0[/youtube]

The log by this video:
Compiled successfully in 468 ms.
SRL Compiled in 0 msec
SMART Initialized.
Loaded: Server 10, Members: False, Signed: True, Super Detail: False.
Current player:
Found the door, opening it!
Hair colors: [856341, 1185564, 1251615, 1317409, 1448995, 1580837, 4704998, 4705769, 4771819, 4838126, 4904433, 4970227, 4970484, 4970742, 4903920, 4771562, 4705511, 922134, 1251616, 1317665, 1383459, 4837869, 5036791, 1119770, 1185822, 1580581, 5037048, 1119771, 1251358, 1515045, 5102842, 1515044, 5103099, 1383202, 5169149, 1119772, 5036791, 4970742, 4970484, 4970484, 4904433, 4903920, 4837869, 4771819, 1119770, 1185822, 1251616, 1580581, 4705769, 4771819, 4838126, 4904433, 4970227, 4970484, 4970742, 5036791, 5036791, 5036791, 5037048, 5036791, 4970742, 4970742, 4970484, 4970227, 4970227, 4904433, 1119771, 1251358, 1251616, 1515045, 4771819, 4838126, 4904433, 4970484, 4970742, 5036791, 5036791, 5037048, 5037048, 5037048, 5102842, 5037048, 5036791, 5036791, 4970742, 4970484, 4970484, 4970227, 1119771, 1185822, 1515044, 4837869, 4903920, 4970227, 4970742, 5036791, 5037048, 5037048, 5037048, 5102842, 5102842, 5102842, 5103099, 5102842, 5037048, 5037048, 5036791, 4970742, 4970742, 4970484, 1119771, 1383202, 4838126, 4904433, 4970484, 5036791, 5037048, 5102842, 5102842, 5102842, 5102842, 5103099, 5103099, 5103099, 5169149, 5103099, 5102842, 5037048, 5036791, 4970742, 4970484, 4970227, 1119772, 4903920, 4970227, 4970742, 5036791, 5102842, 5102842, 5103099, 5103099, 5103099, 5103099, 5169149, 5169149, 5169149, 5103099, 5037048, 4970742, 4970484, 4970227, 4904433, 4903920, 4838126, 4904433, 4970484, 4970742, 5037048, 5103099, 5103099, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5103099, 5037048, 4970742, 4970227, 4903920, 4837869, 4771819, 4771562, 4970484, 5036791, 5102842, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5102842, 5036791, 4970484, 4970227, 4903920, 4837869, 4771562, 4705511, 5036791, 5102842, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5102842, 5036791, 4970484, 4904433, 4903920, 4837869, 4771819, 4705769, 5037048, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5102842, 5036791, 4970484, 4970227, 4904433, 4838126, 4837869, 4771562, 5102842, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5102842, 5037048, 5036791, 4970742, 4970227, 4904433, 4838126, 4771562, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5103099, 5037048, 5036791, 4970742, 4970227, 4838126, 4771562, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5103099, 5102842, 5036791, 4970227, 4838126, 4771562, 5103099, 5103099, 5103099, 5103099, 5103099, 5103099, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5103099, 5036791, 4970227, 4838126, 4771562, 5103099, 5103099, 5102842, 5102842, 5102842, 5102842, 5103099, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5037048, 4970227, 4838126, 5103099, 5103099, 5103099, 5102842, 5102842, 5102842, 5102842, 5103099, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5037048, 4970484, 5103099, 5103099, 5103099, 5103099, 5103099, 5102842, 5102842, 5103099, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5102842, 5103099, 5103099, 5169149, 5103099, 5103099, 5103099, 5103099, 5103099, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5103099, 5103099, 5103099, 5103099, 5169149, 5169149, 5103099, 5103099, 5103099, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149, 5169149]
Best molly hair color: 2713994
Best tolerance: 59
Modifiers: [ 4.1597329224447872E+0000, 3.4249113125739066E+0000]
Molly's hair color: LightBlond
Detected the machine, clicking on it!
Hook box position: 51
Potential Molly has been found at: 377, 30
Detected boots, correct Molly has been found at 376, 86
Molly is in box: 86
BoxRow: 8
HookBoxRow: 5
BoxRow > HookBoxRow
Move Right 3 times
H: 1
H: 2
H: 3
HookBoxspot: 1
Boxspot: 6
Move up 5 times
V: 1
V: 2
V: 3
V: 4
V: 5
Hook box position: 86
Potential Molly has been found at: 376, 30
Detected boots, correct Molly has been found at 374, 86
Molly is in box: 86
Correct spot and row!
Found the door, opening it!
Molly completed in: 1 Minutes and 13 Seconds
Molly had the following hair color: LightBlond
Innocent civilians caught: 0
Successfully executed.

Solver added as an attachment (the Simba file).
Also added all the source for the solver (the .rar file).
Includes DTM's, ACA files, 20 different Molly Solvers from beginning to end and some other calculations etc.

I hope this can get reviewed and added to Simba in the near future :D

Gu3st...

2012-06-20 17:46:40

Very nice job :) Rep+

Mat

2012-06-20 17:48:04

Wow Rep from Axel me Jel bro :P
Good Job aswell :D

shstiger2009

2012-06-20 17:48:31

Damn. That's sick…very nice indeed.

Kyle Undefined

2012-06-20 17:51:17

Very nice work man! :)

NCDS

2012-06-20 18:28:18

Looks excellent. :)

I Am Legend

2012-06-20 23:01:10

nice job congrats on finishing

bolshak25

2012-06-20 23:09:05

nice job!
so do you want to work on leo now? i have a few accounts if you need :)

J J

2012-06-21 01:36:21

From: Zyt3x
Very nice job :) Rep+

Thanks :P

From: Mat
Wow Rep from Axel me Jel bro :P
Good Job aswell :D

Hehe, thanks Mat :)

From: shstiger2009
Damn. That's sick…very nice indeed.

:)

From: Kyle Undefined
Very nice work man! :)

Thanks Kyle.

From: NCDS
Looks excellent. :)

Thanks :P

From: I Am Legend
nice job congrats on finishing

Thanks :)

From: bolshak25
nice job!
so do you want to work on leo now? i have a few accounts if you need :)

Yeah I was actually thinking about working on all the unstable/broken randoms because it is pretty interesting. It took quite a lot time before I finally managed to solve Molly but it was definately worth the effort. It's also nice that every script will benefit from this because it can now solve Molly :P

When I was trying to get molly randoms, one of my account got into the Leo random so I just decided to keep it there. I will be using that one first to figure out some stuff. I kinda want to finish my barbarian outpost agility script before working on a new project xD I just need to make the mainloop and some other minor stuff.

If you have any frog accounts I'd like to make that more stable aswell.

Shatterhand

2012-06-21 03:29:20

Very nice! Wish you were updating ur gop script… :)

putonajonny

2012-06-21 19:25:57

How has this guy only got 2 rep block things :P