Naike
2010-10-16 19:26:19
Functions we will be working with
This is the setup for all the randoms that can appear while you're botting.
It'll declare:
What this will do, is prepare us from whatever random that will appear.
With the correct info, such as the above, all we need to do is run R_SolveNonTalkingRandoms and it'll detect and solve the random!
So how does R_SolveNonTalkingRandoms work?
Simple as that really.
It's very similar to SRLs random finding.
Any other questions?, feel free to ask.
- r_SetupRandoms
- r_GetMusic
- R_SolveNonTalkingRandoms
Const
r_RandomCount = 18;
R_RANDOM_ABYSS = 0;
R_RANDOM_BEEKEEPER = 1;
R_RANDOM_CAPNARRAV = 2;
R_RANDOM_CERTER = 3;
R_RANDOM_DRILLDEMON = 4;
R_RANDOM_EVILBOB = 5;
R_RANDOM_EXAM = 6;
R_RANDOM_FREAKYFORESTER = 7;
R_RANDOM_FROG = 8;
R_RANDOM_GRAVEDIGGER = 9;
R_RANDOM_MAZE = 10;
R_RANDOM_MIME = 11;
R_RANDOM_MOLLY = 12;
R_RANDOM_PILLORY = 13;
R_RANDOM_PINBALL = 14;
R_RANDOM_PRISON = 15;
R_RANDOM_QUIZ = 16;
R_RANDOM_SANDWICHLADY = 17;
type
r_Random = Record
RandName, Music: String;
r_InRandom, r_SolveRandom: function: Boolean;
end;
var
r_RandomArr: Array [0..17] of r_Random;
r_RandomVarSet: Boolean;
Procedure r_SetupRandoms;
begin
With r_RandomArr[R_RANDOM_ABYSS] do
begin
RandName := 'Abyss';
Music := 'into the abyss';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_BEEKEEPER] do
begin
RandName := 'Beekeeper';
Music := '';
r_InRandom := @r_InBeekeeper;
r_SolveRandom := @R_SolveBeekeeper;
end;
With r_RandomArr[R_RANDOM_CAPNARRAV] do
begin
RandName := 'Cap n'' Arrav';
Music := 'sea shanty';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_CERTER] do
begin
RandName := 'Certer';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_DRILLDEMON] do
begin
RandName := 'Drill Demon';
Music := 'corporal punishment';
r_InRandom := @R_InDemon;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_EVILBOB] do
begin
RandName := 'Evilbob';
Music := 'evil bob''s island';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_EXAM] do
begin
RandName := 'Exam';
Music := 'school''s out';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_FREAKYFORESTER] do
begin
RandName := 'Freaky forester';
Music := 'pheasant peasant';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_FROG] do
begin
RandName := 'Frog';
Music := 'frogland';
r_InRandom := @R_InFrogCave;
r_SolveRandom := @R_SolveFrogCave;
end;
With r_RandomArr[R_RANDOM_GRAVEDIGGER] do
begin
RandName := 'Gravedigger';
Music := 'spooky';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_MAZE] do
begin
RandName := 'Maze';
Music := 'time out';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_MIME] do
begin
RandName := 'Mime';
Music := 'artistry';
r_InRandom := @R_InMime;
r_SolveRandom := @R_SolveMime;
end;
With r_RandomArr[R_RANDOM_MOLLY] do
begin
RandName := 'Molly';
Music := 'head to head';
r_InRandom := @R_InMolly;
r_SolveRandom := @R_SolveMolly;
end;
With r_RandomArr[R_RANDOM_PILLORY] do
begin
RandName := 'Pillory';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_PINBALL] do
begin
RandName := 'Pinball';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_PRISON] do
begin
RandName := 'Prison';
Music := 'in the clink';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_QUIZ] do
begin
RandName := 'Quiz';
Music := '';
r_InRandom := nil;
r_SolveRandom := nil;
end;
With r_RandomArr[R_RANDOM_SANDWICHLADY] do
begin
RandName := 'Sandwhich lady';
Music := 'snack attack';
r_InRandom := @r_InSandwichLadyRandom;
r_SolveRandom := @r_SolveSandwichRandom;
end;
r_RandomVarSet := True;
end; This is the setup for all the randoms that can appear while you're botting.
It'll declare:
- The random name (in a string var, RandName)
- Music(the music played in the random)
- r_InRandom(the function to check that you're in the random)
- r_SolveRandom(the solving function for the random)
What this will do, is prepare us from whatever random that will appear.
With the correct info, such as the above, all we need to do is run R_SolveNonTalkingRandoms and it'll detect and solve the random!
So how does R_SolveNonTalkingRandoms work?
function R_SolveNonTalkingRandoms: Boolean;
var
I, iTime: Integer;
Music: String;
InRand: Boolean;
begin
If Not LoggedIn then
Exit;
If Not r_RandomVarSet then
r_SetupRandoms;
Music := LowerCase(r_GetMusic);
for I := 0 to r_RandomCount-1 do
begin
If (r_RandomArr[I].Music = Music)or(r_RandomArr[I].Music = '')then
if (r_RandomArr[I].r_InRandom <> nil) then
InRand := r_RandomArr[I].r_InRandom()
else
begin
If (Not(r_RandomArr[I].r_InRandom <> nil)and(r_RandomArr[I].Music = ''))then
Continue;
Writeln('[Reflection] Might be in a random(missing r_InRandom function), terminating.');
Players[CurrentPlayer].Rand := r_RandomArr[I].RandName;
Logout;
Exit;
end;
If InRand then
begin
//Players[CurrentPlayer].Rand := r_RandomArr[I].RandName;
Writeln('[Reflection] Trying to solve: ' + r_RandomArr[I].RandName);
if (r_RandomArr[I].r_SolveRandom <> nil) then
Result := r_RandomArr[I].r_SolveRandom()
else
begin
Writeln('[Reflection] No random solver for this random yet!, terminating');
Logout;
Exit;
end;
If not Result then
begin
Writeln('[Reflection] Random solving for ' + r_RandomArr[I].RandName + ' failed, terminating.');
Logout;
Exit;
end else
Writeln('[Reflection] Random solved');
iTime := GetSystemTime;
While (Not IsIdle) do
begin
Wait(100+Random(100));
if (GetSystemTime-iTime > 60*1000)then
begin
Writeln('[Reflection] Took more than a minute to get out of the random, terminating.');
LogOut;
Exit;
end;
end;
UseRewardBox;
Exit;
end;
end;
end; - Check if music played is the same as the ones played when you're located in a random event.
- If music is correct, it'll run the specific r_InRandom function which matches the random with that music being played
- If r_InRandom is true, r_SolveRandom will start and solve the random.
Simple as that really.
It's very similar to SRLs random finding.
Any other questions?, feel free to ask.