benjaa
2008-12-09 20:05:59
This function solves all the questions that pop up on the gates in security stronghold.
SolveSecurityGate(NotFound:Boolean);
NotFound is the result if the text was not found in the first place.
ie, if it doesn't find 'Answer me this', do you want the result true or false.
In the first version I put together, the procedure would search for part of the question and solve with the exact answer. This however, lagged way too much, so I cut it down to search for all the different types of answers.
The only way this wouldn't work, is if answers overlapped - but I am 98% sure they won't.
Anyways, tell me what you think.
You can you this complicated script to test it. :p
SolveSecurityGate(NotFound:Boolean);
NotFound is the result if the text was not found in the first place.
ie, if it doesn't find 'Answer me this', do you want the result true or false.
Updating Soon
function SolveSecurityGate(NotFound : boolean) : boolean;
var
Answer : array of string;
i : integer;
begin
//-------------------------------------//
Answer := ['o.', 'then change','obody','forget your password','months','Game Inbox',
'assword','eport','unOrb','unescape','ype in recov','stolen','inform',
'eport', 'emorable', 'obody', 'amous', 'inform', 'any banker', 't give him'];
//---------------------------------------//
if(FindNPCChatText('nswer me this', Nothing))then
begin
ClickToContinue;
repeat
Wait(200 + Random(200));
until (not FindNPCChatText('nswer me this', Nothing));
for i:=0 to GetArrayLength(Answer) do
begin
if(FindNPCChatText(Answer[i], ClickLeft))then
begin
repeat
Wait(100 + Random(100));
until (FindNPCChattext('orrect', Nothing));
ClickToContinue;
Writeln('Solved with answer['+IntToStr(i)+'] "'+Answer[i]+'"');
Result := True;
Break;
end;
end;
end else
begin
Result := NotFound;
Writeln('Did not find question');
end;
end;In the first version I put together, the procedure would search for part of the question and solve with the exact answer. This however, lagged way too much, so I cut it down to search for all the different types of answers.
The only way this wouldn't work, is if answers overlapped - but I am 98% sure they won't.
Anyways, tell me what you think.
You can you this complicated script to test it. :p
program New;
{.include SRL/SRL.scar}
function SolveSecurityGate(NotFound : boolean) : boolean;
var
Answer : array of string;
i : integer;
begin
//-------------------------------------//
Answer := ['o.', 'then change','obody','forget your password','months','Game Inbox',
'assword','eport','unOrb','unescape','ype in recov','stolen','inform',
'eport', 'emorable', 'obody', 'amous', 'inform', 'any banker', 't give him'];
//---------------------------------------//
if(FindNPCChatText('nswer me this', Nothing))then
begin
ClickToContinue;
repeat
Wait(200 + Random(200));
until (not FindNPCChatText('nswer me this', Nothing));
for i:=0 to GetArrayLength(Answer) do
begin
if(FindNPCChatText(Answer[i], ClickLeft))then
begin
repeat
Wait(100 + Random(100));
until (FindNPCChattext('orrect', Nothing));
ClickToContinue;
Writeln('Solved with answer['+IntToStr(i)+'] "'+Answer[i]+'"');
Result := True;
Break;
end;
end;
end else
begin
Result := NotFound;
Writeln('Did not find question');
end;
end;
begin
SetupSRL;
ClearDebug;
ActivateClient;
SolveSecurityGate(false);
end.