almost
2008-03-24 17:20:45
I can barely auto lately because of these two randoms…
There is a PinBall solver, but it doesn't work.
And Boreas was working on a Mordaut solver, but there isn't one that i know of.
So here's my PinBall solver.
Almost completely flawless, and if it does somehow mess up it still ends up solving the event.
This has been tested for several hours and hasn't failed.
Update:
No longer uses MoveMouse and ClickMouse for the extra speed! thanks to N3ss3s idea.
Also uses SetAngle(True) then SetAngle(False) thanks to Hy71194.
More ideas for it are welcome!
To run this with your scripts, paste this over the procedure SolvePinBall in the AntiRandoms folder.
I have been working on a Mordaut solver for a while now, and it's seeming harder and harder.
But if someone wants to start trying to figure out a solution, here are some procedures i use.
There is a PinBall solver, but it doesn't work.
And Boreas was working on a Mordaut solver, but there isn't one that i know of.
So here's my PinBall solver.
Almost completely flawless, and if it does somehow mess up it still ends up solving the event.
This has been tested for several hours and hasn't failed.
Update:
No longer uses MoveMouse and ClickMouse for the extra speed! thanks to N3ss3s idea.
Also uses SetAngle(True) then SetAngle(False) thanks to Hy71194.
More ideas for it are welcome!
To run this with your scripts, paste this over the procedure SolvePinBall in the AntiRandoms folder.
{.include srl/srl.scar}
function FindExit: Boolean;
var
cx, cy, a, c, i, x1, y1, x2, y2: Integer;
Start: Boolean;
begin
begin
cx:= MMCX;
cy:= MMCY;
if (FindColorSpiralTolerance(cx, cy, 4740409, 4, 4, 515, 337, 5)) then
begin
Start := True;
end;
end;
if(Start)then
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
if not(LoggedIn) then
Break;
a := a + 1;
if (a = 1) then
c := c + 1
else if (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 30;
x2 := x2 + 30;
end else
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end else
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end else
if (a = 4) then
begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
begin
if (FindColorTolerance(cx, cy, 4740409, x1, y1, x2, y2, 5)) then
begin
MMouse(cx, cy, 0, 0);
Wait(50 + Random(50));
if (IsUpTextMultiCustom(['xit'])) then
begin
Result := True;
Exit;
end;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;
end;
function FindWaterPost: Boolean;
var
j, cx, cy, a, c, i, x1, y1, x2, y2, z1, z2: Integer;
Start: Boolean;
begin
begin
cx:= mmcx;
cy:= mmcy;
if (FindColorSpiralTolerance(cx, cy, 6671443, 4, 4, 515, 337, 10)) then
begin
Start := True;
end;
end;
if(Start)then
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
a := a + 1;
if (a = 1) then
c := c + 1
else if (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 30;
x2 := x2 + 30;
end else
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end else
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end else
if (a = 4) then
begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
begin
cx:= mmcx;
cy:= mmcy;
if (FindColorTolerance(cx, cy, 6671443, x1, y1, x2, y2, 10)) then
if FindColorTolerance(z1, z2, 8541266, cx - 40, cy - 80, cx + 40, cy + 40, 20) then
begin
MMouse(cx, cy, 0, 0);
Wait(50);
for j:= 1 to 50 do
begin
if (IsUpTextMultiCustom(['ag'])) then
begin
Result:= true;
Exit;
end;
Wait(5);
end;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;
end;
function FindPost: Boolean;
var
j, cx, cy, a, c, i, x1, y1, x2, y2, z1, z2: Integer;
Start: Boolean;
begin
begin
cx:= mmcx;
cy:= mmcy;
if (FindColorSpiralTolerance(cx, cy, 6671443, 4, 4, 515, 337, 10)) then
begin
Start := True;
end;
end;
if(Start)then
begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
a := a + 1;
if (a = 1) then
c := c + 1
else if (a = 3) then
c := c + 1;
for i := 1 to c do
begin
if (a = 1) then
begin
x1 := x1 + 30;
x2 := x2 + 30;
end else
if (a = 2) then
begin
y1 := y1 - 20;
y2 := y2 - 20;
end else
if (a = 3) then
begin
x1 := x1 - 30;
x2 := x2 - 30;
end else
if (a = 4) then
begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
if (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
if (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
if (x2 > 515) then
Break;
begin
cx:= mmcx;
cy:= mmcy;
if (FindColorTolerance(cx, cy, 6671443, x1, y1, x2, y2, 10)) then
if not FindColorTolerance(z1, z2, 10260627, cx - 20, cy - 20, cx + 20, cy + 20, 25) then
begin
MMouse(cx, cy, 0, 0);
Wait(50);
for j:= 1 to 50 do
begin
if (IsUpTextMultiCustom(['ag'])) then
begin
Result:= true;
Exit;
end;
Wait(5);
end;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;
end;
function LeavePinBall: boolean;
var
x, y, i: integer;
begin
MakeCompass('s');
MakeCompass('s');
MakeCompass('s');
SetAngle(False);
x:= MMCX;
y:= MMCY;
for i:= 1 to 50 do
begin
if FindExit then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(300 + Random(100));
if ChooseOption('xit') then
begin
Result:= true;
WriteLn('Solved PinBall Random');
Wait(10000);
SetAngle(True);
Exit;
end else
Wait(500);
end else
Wait(500);
end;
Result:= false;
end;
function SolvePinBall: boolean;
var
x, y, Tagged, Entered, i, LeftCorner, MS: integer;
begin
MS:= MouseSpeed;
MouseSpeed:= 20;
WriteLn('Found PinBall Random');
Inc(PinBall);
LeftCorner := BitmapFromString(4, 4, 'z78DA33753135313137C5' +
'411A600064715CEA914500CACE13F0');
MarkTime(Tagged);
MarkTime(Entered);
repeat
x:= MMCX;
y:= MMCY;
if TimeFromMark(Tagged) > 35000 then
for i:= 1 to 30 do
begin
if FindWaterPost then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(300 + Random(50));
MarkTime(Tagged);
if ChooseOption('ag') then
begin
Wait(6000);
Break;
end;
end;
Wait(100);
end;
if FindPost then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait(300 + Random(50));
MarkTime(Tagged);
if ChooseOption('ag') then
Wait(6000);
end else
Wait(500);
if (FindBitmap(LeftCorner, x, y)) then
Mouse(46, 453, 15, 15, true);
if TimeFromMark(Entered) > 1800000 then
begin
WriteLn('Could not solve PinBall');
Result:= false;
Exit;
end;
until(FindText(x, y, '10', upchars, 369, 235, 440, 257));
Result:= LeavePinBall;
FreeBitmap(LeftCorner);
MouseSpeed:= MS;
end;
begin
SolvePinBall;
end.I have been working on a Mordaut solver for a while now, and it's seeming harder and harder.
But if someone wants to start trying to figure out a solution, here are some procedures i use.
//Returns the row and column of an item specified by number
//(For use when finding the 3 objects that match the clue)
//Number 1 would be the top left object
procedure GetRC(var Row, Column: integer; Number: integer);
begin
if (Number < 6) then
Row:= 1;
if (Number < 11) then
if (Number > 5) then
Row:= 2;
if (Number > 10) then
Row:= 3;
case Number of
1, 6, 11: Column:= 1;
2, 7, 12: Column:= 2;
3, 8, 13: Column:= 3;
4, 9, 14: Column:= 4;
5, 10, 15: Column:= 5;
end;
end;
//Returns a box around the object specified by Number
function GetPoints(Number: integer): TBox;
var
r, c: integer;
begin
GetRc(r, c, Number);
case c of
1: Result.x1:= 45;
2: Result.x1:= 113;
3: Result.x1:= 180;
4: Result.x1:= 248;
5: Result.x1:= 314;
end;
case r of
1: Result.y1:= 45;
2: Result.y1:= 133;
3: Result.y1:= 224;
end;
Result.x2:= Result.x1 + 55;
Result.y2:= Result.y1 + 70;
end;
//Returns the size of the object specified by Number
//(at the second this procedure is called)
function ObjectSize(Number: integer): Extended;
var
Size, Colors, BGColor1, BGColor2: integer;
Box: TBox;
begin
BGColor1:= GetColor(47, 40);
BGColor2:= GetColor(48, 114);
Box:= GetPoints(Number);
Size:= ((Box.x1 - Box.x2) * (Box.y1 - Box.y2));
Colors:= CountColor(BGColor1, Box.x1, Box.y1, Box.x2, Box.y2) + CountColor(BGColor2, Box.x1, Box.y1, Box.x2, Box.y2);
Result:= ((Colors / Size) * 100);
Result:= 100 - Result;
end;
//Finds the average size of the object
//Accuracy is how long it waits figuring out its size
function AvgObjSize(Number, Accuracy: integer): Extended;
var
i: integer;
n, Total: Extended;
begin
for i:= 1 to Accuracy do
begin
n:= ObjectSize(Number);
Total:= Total + n;
Wait(2);
end;
Result:= (Total / Accuracy);
WriteLn(IntToStr(Number) + ': ' + FloatToStr(Result));
end;