SRL Archive - Reflection Development

R_SolvePinball fixed


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.

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;

Nava2

2009-01-10 01:10:08

I will look into this, I might have the current one altered by yours to use it though. Sorry, but lordsaturns version is better.

I will be adding credit to you, and relative points will be used. :)

P.S. lordsaturn might do this, if not me.

lordsaturn

2009-01-10 01:13:51

Yeah, I'll work on it tomorrow. I'll try and fix mine, and see which one is better. If i'm unsuccessful though, I'll just use yours. Hope you don't mind if I tweak it a bit? :)

Btw, if you had any pinball accounts, that'd be a great help.

almost

2009-01-10 12:14:13

K thanks guys for checking into it :)
If it get pinball again I'll send you an account.
But the two things I changed were finding the coordinates and leaving, both did not work in any aspect, both working now fine.
But if you still need to tweak some stuff that's cool.