SRL Archive - Research & Development Lounge

SolveSecurityGate [Security Stronghold]


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.

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.

kitchenrange

2008-12-09 23:31:36

awesome, ur the man.

benjaa

2008-12-10 00:05:39

haha, did you even test it?

HyperSecret

2008-12-10 01:33:20

I would make it a boolean possibly? So a person could do something like

If SolveSecurityGate then Move to this part of stronghold

or something like that. Personally I think that would make it better.

benjaa

2008-12-10 01:38:07

From: HyperSecret
I would make it a boolean possibly? So a person could do something like

If SolveSecurityGate then Move to this part of stronghold

or something like that. Personally I think that would make it better.


oh ok, ill change that now

thanks for the input

Edit: Updated to make result a boolean, also added NotFound option

marpis

2008-12-10 10:58:14

Why would you move around the stronghold? o_O
Great idea anyway :)

HyperSecret

2008-12-10 11:34:40

If you are fighting in the Stronghold and want to bank in somewhere like edgeville, this would definitely be useful.

Sir R. M8gic1an

2008-12-11 12:29:31

From: benjaa
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.



heh, here's a tip for you. instead of comparing all the texts by constantly getting the NPC text and checking if it matches an answer, load the text. it'll be faster.

~RM

n3ss3s

2008-12-11 13:38:52

        repeat
Wait(100 + Random(100));
until (FindNPCChattext('orrect', Nothing));


benjaa

2008-12-11 18:08:36

instead of comparing all the texts by constantly getting the NPC text and checking if it matches an answer, load the text. it'll be faster.


how do i do this? because i found that it lagged heaps

repeat
Wait(100 + Random(100));
until (FindNPCChattext('orrect', Nothing));


DAMN! forgot to change it