J J
2012-05-25 12:18:17
- 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]




