SRL Archive - Reflection Development

Frog solver patch


Cstrike

2010-11-18 16:29:47

{*******************************************************************************
function R_InFrogCave: Boolean;
by: Cstrike
Description: Checks if in Frog Random.
*******************************************************************************}
function R_InFrogCave: Boolean;
begin
Result := ValidNPC('Frog herald');
end;

{*******************************************************************************
function R_FrogChattingInterfaceOpen : Boolean;
by: Cstrike
Description: If there's an interface up, return true, else false.
*******************************************************************************}
function R_FrogChattingInterfaceOpen : Boolean;
var
ValidFrogInterfaces : TIntegerArray;
i : Integer;
begin
ValidFrogInterfaces := [64, 65, 66, 67, 68, 241, 242, 243, 244, 245];
for i:=0 to high (ValidFrogInterfaces) do
begin
if (ValidInterface(ValidFrogInterfaces[i])) then
begin
Result := True;
Exit;
end;
end;
end;

{*******************************************************************************
procedure R_FrogTalkToHerald;
by: Cstrike
Description: Talks to Frog at start
*******************************************************************************}
procedure R_FrogTalkToHerald;
var
NPCs : TNPCArray;
i : Integer;
TP : TPoint;
begin
if R_FrogChattingInterfaceOpen then
begin
Writeln ('[Reflection] Already talking to frog herald.');
end else
begin
NPCs := GetNPCsNull;
if high (NPCs) < 0 then
begin
Writeln ('[Reflection] No frog herald found...')
Exit;
end;
for i:=0 to high (NPCs) do
begin
if NPCs[i].ID = 2472 then
begin
TP := TileToMS(NPCs[i].Tile, 0);
Mouse (TP.X, TP.Y, 0, 0, false);
wait (250+random(250));
if R_ChooseOptionMulti (['eral']) then
Exit;
end;
end;
end;
end;

{*******************************************************************************
function R_FrogFindClickPrincess: Boolean;
by: Cstrike
Description: Finds princess and selects her
*******************************************************************************}
function R_FrogFindClickPrincess : Boolean;
var
NPCs: TNPCArray;
I, iTime, NPCTime : Integer;
TP : TPoint;
begin
Result := False;
MarkTime(iTime);
SetAngle(True);
repeat
NPCs := GetNPCsNull;
for I:=0 to high(NPCs) do
if (NPCs[I].Height = 278) then
begin
Writeln('[Reflection] Found correct frog!');
if TileOnMS(NPCs[I].Tile, 0) then
begin
writeln('[Reflection] Frog tile on mainscreen');
TP := TileToMS (NPCs[I].Tile, 0);
Mouse(TP.x, TP.y, 0, 0, false);
if WaitOption('alk-', 250+Random(100)) then
begin
Wait(400+Random(200));
Flag;
repeat
wait (100+random(100));
if (GetInterfaceText (243,3) = 'Frog Princess')or(GetInterfaceText (243,3) = 'Frog Prince') then
begin
result := true;
writeln ('[Reflection] Interacting with frog..');
Exit;
end;
until (TimeFromMark(NPCTime) > 10000)

Writeln('[Reflection] Took too long interact with the frog');
end;
end else
begin
WalkToTile(NPCs[I].Tile, 0, 0);
Continue;
end;

end;

until (TimeFromMark(iTime) > 60000)
writeln ('[Reflection] Error finding frog! Time > 1 min');
end;

{*******************************************************************************
function R_FrogPrincessChat : Boolean;
by: Cstrike
Description: Continues chat with frog princess as to exit the random. Call this
procedure after you know you're interacting with the princess. Needs failsafe.
*******************************************************************************}
function R_FrogPrincessChat: Boolean;
begin
Writeln('[Reflection] Finishing off talking..');
If (GetInterfaceText(243, 7) = 'Click here to continue')then
While Not (Pos('you so much', (GetInterfaceText(243, 4))) > 0) do
begin
ClickToContinue;
Wait(600+Random(300));
end;
Writeln('[Reflection] Last click!');
ClickToContinue;
Wait(4000+Random(1500));
Result := Not r_InFrogCave;
end;

{*******************************************************************************
function R_SolveFrogCave : Boolean;
by: Cstrike
Description: Attempts to solve frog random, returns true if successful.
*******************************************************************************}
function R_SolveFrogCave : Boolean;
var
TimedCount, ChatTimeOut : Integer;
begin
if Not R_InFrogCave then
Exit;

// Talk to frog herald
R_FrogTalkToHerald;
wait (1000+random(2500));

// While talking, shut him up
MarkTime(ChatTimeOut);
While (GetInterfaceText(242, 6) = 'Click here to continue')do
begin
Wait(600+Random(300));
ClickToContinue;
if ChatTimeOut > 12000 then Break;
end;

// Just in case anything random happens... it will catch all other interfaces
MarkTime(ChatTimeOut);
While (R_FrogChattingInterfaceOpen)do
begin
Wait(600+Random(300));
ClickToContinue;
if ChatTimeOut > 12000 then Break;
end;

// Talk to and solve princess
MarkTime (TimedCount);
repeat
if R_FrogFindClickPrincess then
Result := R_FrogPrincessChat;
until (TimeFromMark(TimedCount) > 120000)or(Result)
end;

It never talked to the king frog in the first place (or would keep running away from him). This SHOULD fix it.

DeSnob

2010-11-18 18:32:45

This is godly. I gotta get back into botting!

pyroryan

2010-11-18 18:45:55

Committed