Naike
2009-06-15 19:36:34
Some people have been requesting a alternative to solve the random theirself when SRL detects it, so I thought I make one..
Note: This needs testing, as I'm in no mood for randoms hunt, but judging from the code, this won't fail.
If you self solve a random, you will not get any "extra" points to SRL-Stats(when it comes up again), as you solved it, not SRL".
Basicly all this does is the following.
When you use FindNormalRandoms SRL triggers SovleTeleportRandoms which
checks if you're in a random or not. If you're stuck inside a random and you've
used SetupRandomTool a form will pop up, and depending on the parameters
you used in SetupRandomTool it might use "Alert();".
On the form there's 2 buttons
But if you choose "Solve it yourself" then the script will pause.
In the mean while you solve the random.
When you're done and outside the random, you simply click the FKey given
in SetupRandomTool and the script will continue.
Simple, No?
Setting up this little tool is easier then you think.
You simply download RandomTool and put it in Core/AntiRandoms
then you replace SolveTeleportRandoms in Core/AntiRandoms/AntiRandoms.scar with this.
Last thing, Add {.include SRL/SRL/Core/AntiRandoms/RandomTool.scar} between 65 / 66 in SRL.Scar
so it actully includes it.
Now you got everything.
All you do now, is placing
I've attached a file called "RandomToolTest.scar", Run it, without replacing anything, to see how the form works.
Hope you enjoy this, N1ke!.
Note: This needs testing, as I'm in no mood for randoms hunt, but judging from the code, this won't fail.
If you self solve a random, you will not get any "extra" points to SRL-Stats(when it comes up again), as you solved it, not SRL".
Basicly all this does is the following.
When you use FindNormalRandoms SRL triggers SovleTeleportRandoms which
checks if you're in a random or not. If you're stuck inside a random and you've
used SetupRandomTool a form will pop up, and depending on the parameters
you used in SetupRandomTool it might use "Alert();".
On the form there's 2 buttons
- Solve it yourself
- Exit
But if you choose "Solve it yourself" then the script will pause.
In the mean while you solve the random.
When you're done and outside the random, you simply click the FKey given
in SetupRandomTool and the script will continue.
Simple, No?
Setting up this little tool is easier then you think.
You simply download RandomTool and put it in Core/AntiRandoms
then you replace SolveTeleportRandoms in Core/AntiRandoms/AntiRandoms.scar with this.
function SolveTeleportRandoms: Boolean;
var
TypeID, H, I, J: Integer;
B: TBox;
RandResult: Boolean;
Rand_Music: string;
InitCompAngle: Extended;
begin
TypeID := Rand_GetRandomType;
H := High(Randoms);
for I := 0 to H do
begin
if (TypeID = Randoms[I].TypeID) then
begin
if (Randoms[I].IsInRandom <> nil) then
RandResult := Randoms[I].IsInRandom();
if (Randoms[I].IsInRandom = nil) or (RandResult) then
begin
Result := (Length(Randoms[I].Texts) = 0) and (Randoms[I].Music = '');
if (not(Result)) and (Randoms[I].Music <> '') then
begin
if (Rand_Music = '') then Rand_Music := Lowercase(GetMusic);
Result := (Rand_Music = Randoms[I].Music);
end;
if (not(Result)) and (Length(Randoms[I].Texts) > 0) then
begin
for J := 0 to High(Randoms[I].Texts) do
begin
B := Randoms[I].TextBoxes[J];
Result := (FindTextTPA(Randoms[I].TextColors[J], 0, B.X1, B.Y1, B.X2, B.Y2, Randoms[I].Texts[J], Randoms[I].TextFonts[J], Nothing));
if (Result) then Break;
end;
end;
end;
end;
if (not(Result)) then Continue;
InitCompAngle := rs_GetCompassAngleDegrees;
WriteLn('***** STR: FOUND RANDOM: ''' + Capitalize(Randoms[I].Name) + ''' *****');
AddToSRLLog('***** STR: FOUND RANDOM: ''' + Capitalize(Randoms[I].Name) + ''' *****');
TakeScreen('Found ' + Capitalize(Randoms[I].Name) + ' random');
Players[CurrentPlayer].Rand := Capitalize(Randoms[I].Name);
If r_UseRandomTool then
begin
If r_Alert then
Alert('Random found!');
r_RunAlert;
r_ResetAll;
If r_CheckAction then
begin
WriteLn('***** STR: ''' + Capitalize(Randoms[I].Name) + ''' RANDOM SOLVED BY HAND! *****');
AddToSRLLog('***** STR: ''' + Capitalize(Randoms[I].Name) + ''' RANDOM SOLVED BY HAND! *****');
Players[CurrentPlayer].Rand := '';
Wait(10000 + Random(2000));
Exit;
end;
end;
SetAngle(True);
MakeCompass('N');
RandResult := False;
if (Randoms[I].SolveRandom <> nil) and (SolveSRLRandoms) then
RandResult := Randoms[I].SolveRandom();
if (RandResult) then
begin
WriteLn('***** STR: ''' + Capitalize(Randoms[I].Name) + ''' RANDOM SOLVED SUCCESSFULLY! *****');
AddToSRLLog('***** STR: ''' + Capitalize(Randoms[I].Name) + ''' RANDOM SOLVED SUCCESSFULLY! *****');
Inc(RandSolved[Randoms[I].RandIndex]);
Players[CurrentPlayer].Rand := '';
Wait(10000 + Random(2000));
end else
begin
WriteLn('***** STR: ''' + Capitalize(Randoms[I].Name) + ''' RANDOM SOLVING FAILED! *****');
AddToSRLLog('***** STR: ''' + Capitalize(Randoms[I].Name) + ''' RANDOM SOLVING FAILED! *****');
Inc(RandFailed[Randoms[I].RandIndex]);
Players[CurrentPlayer].Active := False;
LogOut;
while (LoggedIn) do
Wait(2000);
end;
MakeCompass(InitCompAngle);
SetAngle(True);
Exit;
end;
end;Last thing, Add {.include SRL/SRL/Core/AntiRandoms/RandomTool.scar} between 65 / 66 in SRL.Scar
so it actully includes it.
Now you got everything.
All you do now, is placing
Procedure SetupRandomTool(TimeOutWait, FKeyForFinish: Integer; AlertIfRandom: Boolean);
Before you actully get a random :)I've attached a file called "RandomToolTest.scar", Run it, without replacing anything, to see how the form works.
Hope you enjoy this, N1ke!.