Narcle
2008-05-23 08:03:53
I want to get this even farther to include ranging setup and magic. But mainly this is for melee weapons because of all the different types. As most of you know not all weapons have all 3 stats, and they are in different places in the combat tab. Some have just Attack/defence or just Attack/Strength. So this procedure and function solves this problem to correctly select the right one.
You'll notice in CombatLookup; that there is a second GetTextAtEx what this does is also include range weaponry. I haven't divulged further into it so I just left it for now.
You'll notice in CombatLookup; that there is a second GetTextAtEx what this does is also include range weaponry. I haven't divulged further into it so I just left it for now.
{*******************************************************************************
procedure CombatLookup;
By: Narcle
Description: Records weapon data: Attack, Strength, Defence, Shared, Ranged
*******************************************************************************}
procedure CombatLookup;
var
x, y, i, WaitT:integer;
Xarr, Yarr:array of integer;
TB: TBox;
TP: TPointArray;
begin
Xarr := [600, 685, 600, 685];
Yarr := [275, 275, 330, 330];
GameTab(1);
for i := 0 to 3 do
begin
MMouse(Xarr[i], Yarr[i], 7, 7);
repeat
WaitT := WaitT+1;
wait(100);
if WaitT >= 30 then exit;
until findcolor(x, y, 10551295, 540, 205, 750, 465);
GetClientDimensions(TB.X2, TB.Y2);
TB.X1 := 0;
TB.Y1 := 0;
FindColorsTolerance(TP, 10551295, TB.X1, TB.Y1, TB.X2, TB.Y2, 0);
If Length(TP) = 0 Then Exit;
TB := GetTPABounds(TP);
Players[currentplayer].Strings[i+50] := Lowercase(Between('(', ' XP',
GetTextAtEx(TB.X1+2, TB.Y1+27, 0, SmallChars, False, True, 0, 1, 0, 20, False, tr_AllChars)));
if Players[currentplayer].Strings[i+50] = '' then
begin
Players[currentplayer].Strings[i+50] := Lowercase(Between('(', ' XP',
GetTextAtEx(TB.X1+2, TB.Y1+14, 0, SmallChars, False, True, 0, 1, 0, 20, False, tr_AllChars)));
end;
Writeln(Players[currentplayer].Strings[i+50]);
end;
end;
{*******************************************************************************
function CombatSelect(kind: string): boolean;
By: Narcle
Description: Selects combat from combat data recorded.
*******************************************************************************}
function CombatSelect(kind: string): boolean;
var
i:integer;
begin
for i := 0 to 3 do
if Lowercase(kind) = Players[currentplayer].Strings[i+50] then
begin
SetFightMode(i+1);
Hoverskillis := kind;
result := true;
exit;
end;
end;