SCAR Code:
{*******************************************************************************
function CheckQuest(Quest: string): Boolean;
By: lordsaturn
Description: Will return true if the quest 'Quest' is completed, and perform the
action declared in 'Action'.
*******************************************************************************}
function CheckQuest(Quest: string; Action: fnct_ActionOptions): Boolean;
var
arS: TStringArray;
arI: TIntegerArray;
x, y, fx, fy, i, c, fColor, WT, L: Integer;
UltiBool: Boolean;
begin
arS := TrimString(Quest);
L := Length(arS) - 1;
for i := 0 to L do
begin
if arS[i] = 'i' then arS[i] := 'II';
if arS[i] = 'okt' then arS[i] := 'ok';
end;
arI := [65280, 65535, 255];
GameTab(3);
while not UltiBool do
begin
c := c + 1;
if c = 2 then
if GetColor(728, 245) <> 1316634 then
Mouse(728, 250, 4, 4, True);
if c = 3 then
begin
MMouse(728, 446, 5, 5);
GetMousePos(x, y);
HoldMouse(x, y, True);
end;
if GetColor(728, 419) = 1316634 then
begin
Writeln('We could not find the quest name.');
Result := False;
Exit;
end;
for i := 0 to 2 do
begin
UltiBool := FindTextArrayTPAEx(arI[i], 0, 547, 227, 720, 454, fx, fy, arS, StatChars, 140, 13);
if UltiBool then
begin
arI[i] := fColor;
Break;
end;
end;
end;
if UltiBool then
begin
if c > 2 then
begin
WT := 100+Random(700);
Wait(WT); //for randomization
ReleaseMouse(x, y, True);
end;
if fColor = arI[0] then
Result := True;
if Action = Nothing then Exit;
if WT > 0 then fy := fy - (WT/5) - 11;
MMouse(fx, fy, 4, 4);
if not FindTextArrayTPA(16777215, 0, 547, 227, 720, 454, arS, StatChars) then
begin
for i := 0 to 2 do
if FindTextArrayTPAEx(arI[i], 0, 547, 227, 720, 454, fx, fy, arS, StatChars, 140, 13) then
Break;
if i = 3 then Exit;
MMouse(fx, fy, 4, 4);
end;
if Action = Move then Exit;
GetMousePos(fx, fy);
case Action of
ClickLeft: Mouse(fx, fy, 0, 0, True);
ClickRight: begin
Mouse(fx, fy, 0, 0, False);
ChooseOption('ead');
end;
end;
MouseBox(455, 66, 474, 84, 1);
//CloseWindows;
end;
end;
SCAR Code:
{*******************************************************************************
function GetQP: Integer;
By: lordsaturn
Description: Will return number of quest points.
*******************************************************************************}
function GetQP: Integer;
var
x, y: integer;
s: string;
begin
if GetCurrentTab <> 3 then GameTab(3);
if FindColor(x, y, 2070763, 650, 205, 712, 226) then
begin
s := Trim(GetTextAtEx(x - 2, y - 2, 5, SmallChars, False, False, 0, 1, 2070763, 3, False, tr_AllChars));
try
Result := StrToInt(s);
except
if Pos('g', Lowercase(s)) <> 0 then
begin
s := Uppercase(ReplaceRegex(Lowercase(s), 'g', '6'));
try
Result := StrToInt(s);
except
writeln('GetQP failed and got: '+s);
end;
end;
end;
end;
end;