HI @adr.bot gn. I've managed to set a script for alarm captcha in the server i'm playing:
uses
SysUtils, Classes;
function SetForegroundWindow(hwnd: integer):boolean; stdcall; external 'user32.dll';
const
// words / phrase to detect
CaptchaTexts: array of string = ['=', 'Question:', '=', '?'];
// play sound when detected (true - yes / false - no)
CaptchaSound = true;
// sound file name (in the Sounds folder)
CaptchaSoundName = 'hp.wav';
// highlight the desired window on the taskbar (true - yes / false - no)
CaptchaFlashWindow = true;
// move the window to the foreground (true - yes / false - no)
CaptchaSetForegroundWindow = true;
procedure CaptchaThread(CaptchaTexts: array of string);
var
a1, a2: integer;
s1, s2: integer;
EngineCustom: TL2Control;
i, j: integer;
Have: boolean;
L: TStringList;
SoundPath: string;
begin
SoundPath:= ExePath + 'Sounds\' + CaptchaSoundName;
if (CaptchaSound) and (not FileExists(SoundPath)) then
begin
print('No sound file found. Path: ' + SoundPath);
Script.Stop;
end;
while (true) do
begin
delay(1000);
for i:= 0 to 100 do
begin
EngineCustom:= GetControlByIndex(i);
if (EngineCustom = nil) then
break;
if (EngineCustom.Status <> lsOnline) then
continue;
Have:= false;
//print(EngineCustom.hlpText);
//print(EngineCustom.CBTime);
print(GetTickCount());
print(EngineCustom.HlpTime);
s1:=GetTickCount();
s2:=EngineCustom.HlpTime;
print(s1-s2);
//engine.dlgtext.contains
L:= TStringList.Create; // Create an object (list for strings)
L.Add(EngineCustom.hlpText);//(EngineCustom.hlpText); // Add the line to the
L.Sort;
//L.SaveToFile('C:/1.html'); // Save the list to the file
//L.Free;
if (Pos('Question:', L.Text) > 0) and ((s1-s2) < 19000)then//L.Find('Question:', i) then//EngineCustom.hlpText.contains('Question:') then
begin
Have:= true;
if (Have) then
begin
L.Free;
PlaySound(exepath+'\sounds\'+'PlayerAlarm'+'.wav');
delay(5000);
end;
//PlaySound(exepath+'\sounds\'+'PlayerAlarm'+'.wav');
if (user.target.dead) then begin
while user.incombat do
delay(1000);
engine.autosoulshot(5789, true);
engine.autotarget(2500);
engine.attack;
engine.pickup;
end;
engine.restart; //restart to char select screen;
engine.gamestart(0); //0 is char id
end
end;
end;
end;
begin
Script.NewThread(@CaptchaThread(CaptchaTexts));
end.
---------
Alarm works fine. And i added the last 2 lines (engine.restart) since once captcha window appears (tutorial window), if i relog the char, the captcha wont kick me and i can continue playing normally.
But what i dont know how to do, is once alarm sounds (something like... if (Pos('Question:', L.Text) > 0) and ((s1-s2) < 19000)then//L.Find('Question:', i) ????
Make the char finish aggro mobs and once out of combat relog.