almost
2009-01-09 23:33:56
I've been working on making my guild miner use reflection, and it's going great.
But I got a pinball today and it just sat there until I logged.
I checked into it and the tile coordinates for everything change when you get this random, so it couldn't find anything.
I fixed that and it still didn't do a few things right, so I just redid the whole function.
I tested it about 10 times without messing up once. (You can log out and in and it resets your score)
The only thing is I had to use MakeCompass because R_MakeCompass wouldn't even change my compass at all.
But if it does work for you just edit that one part if you want.
But I got a pinball today and it just sat there until I logged.
I checked into it and the tile coordinates for everything change when you get this random, so it couldn't find anything.
I fixed that and it still didn't do a few things right, so I just redid the whole function.
I tested it about 10 times without messing up once. (You can log out and in and it resets your score)
The only thing is I had to use MakeCompass because R_MakeCompass wouldn't even change my compass at all.
But if it does work for you just edit that one part if you want.
function R_SolvePinball2: boolean;
var
i, PinballMark: integer;
Posts: array [0..5] of TPoint;
PostMS: TPoint;
PostObj: UID;
begin
if not (R_InPinBall) then
Exit;
Result:= false;
WriteLn('Found pinball random!');
SetRun(true);
if not FindObject(Posts[2], 15004) then
if not FindObject(Posts[2], 15005) then
begin
WriteLn('The reference post could not be found.');
Exit;
end;
Posts[0]:= Point(Posts[2].x - 5, Posts[2].y - 4);
Posts[1]:= Point(Posts[2].x - 3, Posts[2].y - 1);
Posts[3]:= Point(Posts[2].x + 3, Posts[2].y - 1);
Posts[4]:= Point(Posts[2].x + 5, Posts[2].y - 4);
MarkTime(PinballMark);
while ((GetScore < 10) and (TimeFromMark(PinballMark) < 60000)) do
begin
for i:= 0 to 4 do
begin
PostObj:= GetObjectAt(Posts[i].x, Posts[i].y);
if (PostObj.ObjType mod 2 = 0) then
begin
repeat
Wait(500);
until(TileOnMS(Posts[i], 0) or (TimeFromMark(PinballMark) > 30000));
PostMS:= TileToMS(Posts[i], 0);
Mouse(PostMS.x - 2, PostMS.y - Random(25), 4, 0, false);
Wait(800 + Random(500));
if (ChooseOption('ag')) then
begin
R_Flag;
Wait(5000 + Random(3000));
MarkTime(PinballMark);
Break;
end;
end;
end;
end;
R_Flag;
Wait(5000 + Random(3000));
if (GetScore = 10) then
for i:= 1 to 5 do
begin
Wait(1000 + Random(500));
R_Flag;
KeyDown(Vk_Down);
Wait(2000 + Random(1000));
KeyUp(Vk_Down);
Wait(800 + Random(400));
MakeCompass('s');
MakeCompass('s');
Wait(200 + Random(400));
PostMS:= TileToMS(Point(Posts[2].x, Posts[2].y - 12), 0);
Mouse(PostMS.x - 2, PostMS.y - Random(15), 4, 0, false);
Wait(800 + Random(400));
if (ChooseOption('xit')) then
begin
Result:= True;
R_Flag;
Wait(10000 + Random(5000));
Inc(RSolved[RPinball]);
WriteLn('Solved Pinball random!');
Exit;
end;
end;
Inc(RFailed[RPinball]);
end;