SCAR Code:
{*******************************************************************************
function FindTheAxe(var AxePos: integer; var TypeOfAxe: string; AxeInInv: boolean): boolean;
By: PriSoner
Description: Attempts to find an axe in the players inventory or hand.
If an axe is found it checks to see if the player can use it for
woodcutting and checks to see if it can be wielded. If an axe has to be
in the inventory it always moves it to slot 1 if it isn;t already there.
AxeInInv: Set to True and it will move axe from hand to inventory slot 1 if it can.
Set to False and it will move axe from inventory to hand.
AxePos: Returns 0 if no axe is found, 1 if Axe is in hand & 2 if axe is in inventory.
It does this because even if you have Set AxeInv to False it is still
possible that the axe may not be wieldable. Usefull to know if depositing in bank etc.
TypeOfAxe: Return the Type of Axe Being used or 'None Found' if no axe is present.
FindTheAxe returns True if a usable axe is found.
*******************************************************************************}
type AllAxes = record
AxeDTM: integer;
AxeName: string;
MinLvl: integer;
AttLvl: integer;
end;
function FindTheAxe(var AxePos: integer; var TypeOfAxe: string; AxeInInv: boolean): boolean;
var ax, ay, SklWood, SklAtt, ctab, DTMAxe: integer;
i: integer;
AxeList: Array of AllAxes;
begin
SetLength(AxeList, 8);
AxeList[0].AxeDTM := DTMFromString('78DA6314616060E0664001A962BC0CFC409A1' +
'188FF0301231790C1C58006189148202D03243809A81106124204' +
'D430010919FC6A00E8B5053D');
AxeList[0].AxeName := 'Dragon Axe';
AxeList[0].AttLvl := 60;
AxeList[0].MinLvl := 61;
AxeList[1].AxeDTM := DTMFromString('78DA639CCEC4C0F09401051485F1318800694' +
'620FE0F048C4B806AEEA2AA718E4864E082AA0101C6C54035F751' +
'D5D887C6A1AA590A547313558D4B740A8A1A00CFA10E03');
AxeList[1].AxeName := 'Rune Axe';
AxeList[1].AttLvl := 40;
AxeList[1].MinLvl := 41;
AxeList[2].AxeDTM := DTMFromString('78DA6374606060686440014D497C0C22409A1' +
'188FF0301A337905187AAC6C6D786810BAA0604187D804415AA1A' +
'7B7F7B5435BE40A21C558D73B0338A1A00C1660AA8');
AxeList[2].AxeName := 'Adamant Axe';
AxeList[2].AttLvl := 30;
AxeList[2].MinLvl := 31;
AxeList[3].AxeDTM := DTMFromString('78DA633CC4C4C010C0C8800C5A53F81852803' +
'448F43F10309E05AAF14155636111CCC0055503028CE7816A5C51' +
'D5D839C4A2AA3981A9C6C52D0D450D0061FC0C64');
AxeList[3].AxeName := 'Mithril Axe';
AxeList[3].AttLvl := 20;
AxeList[3].MinLvl := 21;
AxeList[4].AxeDTM := DTMFromString('78DA63E4656060E06240038C0C1C609281E13' +
'F1030F200194C986A1024901606126CA82AC4444450D5B0020919' +
'FCE60000E9AC04AD');
AxeList[4].AxeName := 'Black Axe';
AxeList[4].AttLvl := 10;
AxeList[4].MinLvl := 6;
AxeList[5].AxeDTM := DTMFromString('78DA63CC636260D8C3C8800C5A53F81852803' +
'448F43F10305602D5EC4055939B9ACAC0055503028CD540351B51' +
'D594E5E5A2AA29C154D3545989A20600C3BC0E32');
AxeList[5].AxeName := 'Steel Axe';
AxeList[5].AttLvl := 5;
AxeList[5].MinLvl := 6;
AxeList[6].AxeDTM := DTMFromString('78DA63BCC9C4C0309191010498182020C6859' +
'34103488344FF0301E353A04C2F230332F0707161E082AA0101C6' +
'0740356DA86A22838351D5BC00AAE94655932ACA89AAE639A6394' +
'1DEDE286A00B1F90F6D');
AxeList[6].AxeName := 'Iron Axe';
AxeList[6].AttLvl := 1;
AxeList[6].MinLvl := 1;
AxeList[7].AxeDTM := DTMFromString('78DA63EC626060086140016DA97C0C22409A1' +
'188FF0301E33420C307558D97A5220317540D08304E051201A86A' +
'DCCCE451D54C07129EA86AFC6C5450D40000D77E0AA2');
AxeList[7].AxeName := 'Bronze Axe';
AxeList[7].AttLvl := 1;
AxeList[7].MinLvl := 1;
ctab := GetCurrentTab;
SklWood := GetSkillInfo('woodcutting',False);
SklAtt := GetSkillInfo('attack', False);
for i := 0 to High(AxeList) do
begin
GameTab(4);
DTMAxe := AxeList[i].AxeDTM;
if FindDTM(DTMAxe, ax, ay, 546, 203, 737, 466) then
begin
if (SklWood < AxeList[i].MinLvl) then
begin
writeLn('Found ' + AxeList[i].AxeName + ' but you do not have a high enough Woodcutting level to use it.');
writeLn('You Need to be Woocutting Level ' + IntToStr(AxeList[i].MinLvl) + ' or higher.');
writeLn('Looking for another axe..........');
end else
begin
if (SklAtt >= AxeList[i].AttLvl) and not AxeInInv then
begin
writeLn('Found a ' + AxeList[i].AxeName + ' and moving it into your players hand.');
Mouse(ax, ay, 10, 4, true);
wait(600 + Random(600));
AxePos := 1;
AxeInInv := false;
end else
begin
if (ax < 600) and (ay < 245) then writeLn('Found a ' + AxeList[i].AxeName + '.') else
begin
writeLn('Found a ' + AxeList[i].AxeName + 'and moving it to slot 1.');
MMouse(ax, ay, 0, 0);
HoldMouse(ax, ay, true);
wait(600 + Random(600));
MMouse(575, 230, 0, 0);
ReleaseMouse(575, 230, true);
end;
AxePos := 2;
AxeInInv := true;
end;
wait(500 + Random(400));
result:= true;
FreeDTM(DTMAxe);
GameTab(ctab);
TypeOfAxe := AxeList[i].AxeName;
exit;
end;
end;
end;
for i := 0 to High(AxeList) do
begin
GameTab(5);
DTMAxe := AxeList[i].AxeDTM;
if FindDTM(DTMAxe, ax, ay, 568, 285, 603, 321) then
begin
AxePos := 1;
if AxeInInv then
begin
writeLn('Found a ' + AxeList[i].AxeName + ' in your players hand. Moving to slot 1 of inventory.');
Mouse(ax, ay, 1, 1, true);
wait(700 + random(700));
GameTab(4);
wait(700 + random(700));
FindDTM(DTMAxe, ax, ay, 546, 203, 737, 466);
if not (ax < 600) and (ay < 245) then
begin
MMouse(ax, ay, 0, 0);
HoldMouse(ax, ay, true);
wait(600 + Random(600));
MMouse(575, 230, 0, 0);
ReleaseMouse(575, 230, true);
end;
AxePos := 2;
end else writeLn('Found a ' + AxeList[i].AxeName + ' in your players hand.');
result:= true;
FreeDTM(DTMAxe);
GameTab(ctab);
TypeOfAxe := AxeList[i].AxeName;
exit;
end;
end;
AxePos := 0;
result:= false;
TypeOfAxe := 'None Found';
FreeDTM(DTMAxe);
GameTab(ctab);
end;