SRL Archive - Help and Support

Is this a good anti-random procedure?


Zach1188

2007-11-17 17:28:05

I'm a little unclear on how to check for randoms efficiently, however I have the basics down. Is this a decent procedure? I also commented it in places. Please read the comments, I have a few questions.

(Procedure "CheckForRandoms" is dominant)


function FindQuickRandoms: boolean; //Boolean; True = unsolvable
begin
SolvePinball;
if InQuizRandom then
SolveQuiz; //Is this the quiz with Dr. Mordaut?

if DetectFrogCave then
SolveFrogSwamp;

if (FindDead) or (FindMime) or (FindMaze) or (NoSymbols) or
(NoGameTab) or (InBlack) then //NoSymbols is my own procedure
begin
result:= true;
exit;
end else result:= False;
end;

function CheckForRandoms(FullCheck: boolean): boolean;
var
NonInvRand, TalkRand: boolean;
begin
If Not(LoggedIn) then LoginPlayer;
if not(NoAxe) then //Dont check if it already knows there's no axe
if not(FindAxe2) then NoAxe:= true;
AvoidFight;
If FullCheck then
begin
if FindNormalRandoms then result:= True; //FIND ALL RANDOMS
exit; //No reason to continue checking for randoms
end; //Please give feedback here, I'm unsure exactly what FindNormalRandoms
//checks for.

if FindQuickRandoms then
begin
Result := True;
Players[CurrentPlayer].loc := 'Teleported to random.';
EndAuto('Unsolvable random found. Screenshot taken.', true, true);
Logout;
exit;
end;

//if talking random found AND it found points with tree color, then..
If ((FindTalk) and (Length(TreePTS) > 0)) then
begin
for x:= 0 to Length(TreePTS) - 1 do
begin
MMouse(TreePTS[i].x, TreePTS[i].y, 3 - Random(2), 1);
if IsUpText('down Yew') then
begin
result:= True;
exit;
end;
end;
end else result:= False;
end;

Narcle

2007-11-18 04:25:19

Your antirandom is pretty big, I generally take advantage of the new Rev 6 system and just use theirs and add personal antirandoms if necessary.

FindNormalRandoms checks for everything : Findtalk & findnoninventory randoms as well as if your in a random. This does not include the things that can cause problems in a script because all vary e.g. FindFight, Findpickaxe, FindAxe etc…

If the script is majority of the time in gametab(4) then a regular FindNormalRandoms + all the randoms that could happen to you can be applied every time.

Heres what I use in my scripts:
You'll noticed I have it set up like FTwait, but with 1 exception, you can put in 0 for a single no wait time check. I replace all my FTwait's in my scripts with this however depending on script FTwait can be a better option.
var rct,rct2:integer;//only needed for fighter
Function RandomsCheck(Time: Integer): Boolean;
var
ti,t: Integer;
begin
if time = 0 then Ti := 1 else Ti := time;
begin
for T := 1 to Ti do
begin
FindPick; //for mining
FindInventoryRandoms; //should always have
FindNormalRandoms; //if majority of time in gametab(4)
if (rct2 = 0) then begin MarkTime(rct); rct2 := 1; end; //fighter
if (rct2 = 1) and (TimeFromMark(rct) >= (30000+random(10000))) then
begin
outfight;
FindInventoryRandoms;
rct2 := 0;
end; //fighter
if FindTalk then //Extracheck & for fighter
begin
Result := True;
FindNormalRandoms;
end;
if FindFight then //for a non-fighter
begin
Result := True;
RunTo('N', True);
Wait(15000 + random(5000));
Runback;
end;
if time = 0 then exit else Wait(200 + Random(50));
end;
end;
end;

Just add what you think is needed, and for a full check make it if (time = 0) thats what I would do anyway.

nielsie95

2007-11-18 06:48:57


{*******************************************************************************
function FindMime: Boolean;
by: Stupid3ooo
Description: Checks for mime and switches player.
*******************************************************************************}

function FindMime: Boolean;
begin
result := false;
end;

{*******************************************************************************
function FindMaze: Boolean;
by: Stupid3ooo
Description: Checks for Maze and switches player.
*******************************************************************************}

function FindMaze: Boolean;
begin
result := false;
end;

So those 2 wont help much.
NoGameTabLocs handles every non-talking random.
If you want to know if it solved it; you can do:


function FindQuickRandoms: boolean; //Boolean; True = unsolvable
begin
if NoGameTabLocs then
Result := LoggedIn
else
Result := False;
end;

Zach1188

2007-11-18 12:25:16

Here's my new procedure:

procedure CheckForRandoms;
var CheckTime, Dist:integer;
NormRands: boolean;
begin
MarkTime(CheckTime);
If Not(LoggedIn) then LoginPlayer;
MakeCompass('N');
if not(NoAxe) then //Dont check if it already knows there's no axe
if not(FindAxe2) then NoAxe:= true;
AvoidFight;
if PinBallDetected then SolvePinball;

//if found random found AND it found points with tree color, then..
If (FindTalk) then
begin
DwarfItem;
FindNormalRandoms;
if (NoGameTab) or (InBlack) or (NoSymbols) then
begin
EndAuto('Unsolvable random found. Screenshot taken.', true, true);
end else if Length(TreePTS) > 0 then
begin
for x:= 0 to Length(TreePTS) - 1 do
begin
begin
MMouse(TreePTS[i].x, TreePTS[i].y, 3 - Random(2), 1);
if IsUpText('down Yew') then
begin
Mouse(TreePTS[i].x, TreePTS[i].y, 0, 0, true);
exit;
end;
end;
end;
end;
end;
SRLRandomsReport;
AddToReport('Randoms check took ' + IntToStr(TimeFromMark(CheckTime)) + ' msec.');
end;
And is FindNonInventoryRandoms; really necessary? It looks like it's included in FindNormalRandoms;