Wanted
2007-12-26 14:13:51
Look at this simple Examine Coal script.
I was making a tutorial and when I got the fail safes portion of the tutorial I got bored and spent a few hours figuring out how to make the best possible fail safe with out going overboard or anything.
I think what I'm trying to show everyone is just the general concept of having multi-steps here, then repeating them a random number of times if they fail just like a human would.
Any ideas?
program ExamineCoal;
{.Include SRL\SRL.SCAR}
procedure SetUpScript;
begin
SetUpSRL;
ClearDeBug;
FindRS;
ActivateClient;
Wait(2000);
end;
function ExamineCoal: Boolean;
var
EC: TPoint;
DTMCoal: LongInt;
FindTrys, UpTextTrys, ExamineTrys: Byte;
begin
DTMCoal := DTMFromString('78DA630C6662609066644006FA7AF20CFF813448F43F10300602D5F0A1AA81C8C248209D04542346404D2C508D3201350140359A04D4B800D5C81150E30554238A5F0D007EE308A0');
for FindTrys := 1 to (3 + Random(3)) do
begin
if (FindDTM(DTMCoal, EC.X, EC.Y, MIX1, MIY1, MIX2, MIY2)) then
begin
for UpTextTrys := 1 to (3 + Random(3)) do
begin
MMouse(EC.X, EC.Y, 5, 5);
Wait(200 + Random(100));
if (IsUpText('Coal')) then
begin
GetMousePos(EC.X, EC.Y);
for ExamineTrys := 1 to (2 + Random(2)) do
begin
Mouse(EC.X, EC.Y, 0, 0, False);
Wait(200 + Random(100));
if (ChooseOption('Examine')) then
begin
Wait(1000 + Random(500));
if (InChat('non-renewable')) then
begin
Result := True;
WriteLn(' Chat box text found, examination confirmed!');
FreeDTM(DTMCoal);
Exit;
end
else
WriteLn(' Did not find chat box text.');
end
else
WriteLn(' Try : ' + IntToStr(ExamineTrys) + '. Did not find choose option selection.');
end;
end
else
WriteLn(' Try : ' + IntToStr(UpTextTrys) + '. Did not find "IsUpText" in the upper left corner.');
end;
end
else
WriteLn(' Try : ' + IntToStr(FindTrys) + '. Did not find coal.');
end;
WriteLn('All attempts failed, logging...');
FreeDTM(DTMCoal);
LogOut;
end;
begin
SetUpScript;
if (not (ExamineCoal)) then
WriteLn('function ExamineCoal: Boolean; returned: False.');
end.I was making a tutorial and when I got the fail safes portion of the tutorial I got bored and spent a few hours figuring out how to make the best possible fail safe with out going overboard or anything.
I think what I'm trying to show everyone is just the general concept of having multi-steps here, then repeating them a random number of times if they fail just like a human would.
Any ideas?