SCAR Code:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Woodcutting routines --//
//-----------------------------------------------------------------//
// * function FindAxe: Boolean; // * by Sumilion
// * procedure FindBirdsNest; // * by Liquid and Starblaster100
// * function FindEnt(TreeColor: Integer): Boolean; // * by Sumilion
// * procedure SetupWoodcutting; // * SRL
var
EquipAxe: Boolean;
{************************************************* ******************************
function FindAxe: Boolean;
By: Sumilion
Description: Finds if there is an axe present. Axe can be wielded or unwielded.
Stores place in Boolean var EquipAxe.
************************************************** *****************************}
function FindAxe: Boolean;
var
InvAxe, WieldAxe, Ix, Iy, i: Integer;
dtmAxes: array[0..6] of Integer;
begin
if LoggedIn then
begin
GameTab(4);
dtmAxes[1] := DTMFromString('78DA639CCEC4C0F09401051485F13188006 94' +
'620FE0F048C4B806AEEA2AA718E4864E082AA0101C6C54035 F751' +
'D5D887C6A1AA590A547313558D4B740A8A1A00CFA10E03'); //rune
dtmAxes[2] := DTMFromString('78DA6374606060686440014D497C0C22409 A1' +
'188FF0301A337905187AAC6C6D786810BAA0604187D804415 AA1A' +
'7B7F7B5435BE40A21C558D73B0338A1A00C1660AA8'); //addy
dtmAxes[3] := DTMFromString('78DA633CC4C4C010C0C8800C5A53F818528 03' +
'448F43F10309E05AAF14155636111CCC0055503028CE7816A 5C51' +
'D5D839C4A2AA3981A9C6C52D0D450D0061FC0C64'); //mith
dtmAxes[4] := DTMFromString('78DA63CC636260D8C3C8800C5A53F818528 03' +
'448F43F10305602D5EC4055939B9ACAC0055503028CD54035 1B51' +
'D594E5E5A2AA29C154D3545989A20600C3BC0E32'); //steel
dtmAxes[5] := DTMFromString('78DA63BCC9C4C0309191010498182020C68 59' +
'34103488344FF0301E353A04C2F230332F0707161E082AA01 01C6' +
'0740356DA86A22838351D5BC00AAE94655932ACA89AAE639A 6394' +
'1DEDE286A00B1F90F6D'); //iron
dtmAxes[6] := DTMFromString('78DA63EC626060086140016DA97C0C22409 A1' +
'188FF0301E33420C307558D97A5220317540D08304E051201 A86A' +
'DCCCE451D54C07129EA86AFC6C5450D40000D77E0AA2'); //bronze
GameTab(5);
for WieldAxe := 1 to 7 do
begin
if(WieldAxe = 7)then
Break;
if(FindDtm(dtmAxes[WieldAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
Break;
end;
GameTab(4);
for InvAxe := 1 to 7 do
begin
if(InvAxe = 7)then
Break;
if(FindDtm(dtmAxes[InvAxe], Ix, Iy, MIX1, MIY1, MIX2, MIY2))then
Break;
end;
if(InvAxe = 7)and(WieldAxe = 7)then
begin
Result := False;
Writeln('No axe was found.');
for i := 0 to 6 do
FreeDtm(dtmAxes[i]);
Exit;
end;
if((InvAxe - WieldAxe) < 0)then
EquipAxe := False
else
EquipAxe := True;
case Min(WieldAxe, InvAxe) of
1: WriteLn('Using Rune axe');
2: WriteLn('Using Addy axe');
3: WriteLn('Using Mith axe');
4: WriteLn('Using Steel axe');
5: WriteLn('Using Iron axe');
6: WriteLn('Using Bronze axe');
end;
Result := True;
for i := 0 to 6 do
FreeDtm(dtmAxes[i]);
end;
end;
{************************************************* ******************************
procedure FindBirdsNest;
By: Liquid and Starblaster100
Description: If a birds nest is found, it will pick it up
************************************************** *****************************}
procedure FindBirdsNest;
var
tries, x, y: Integer;
begin
if (Pos(GetNewChatMsg, 'A bird') <> 0) then
begin
repeat
if not (FindObj(x, y, 'Take Bird', 3952984, 10)) or
not (FindObj(x, y, 'Take Bird', 1713706, 10)) or
not (FindObj(x, y, 'Take Bird', 1581604, 10)) then
begin
KeyDown(VK_LEFT);
Wait(700 + Random(500));
KeyUp(VK_LEFT);
Wait(400 + Random(300));
end;
if not (FindObj(x, y, 'Take Bird', 3952984, 10)) or
not (FindObj(x, y, 'Take Bird', 1713706, 10)) or
not (FindObj(x, y, 'Take Bird', 1581604, 10)) then
begin
x := 648;
y := 83;
tries := tries + 1;
FindColorSpiral(x, y, 241, 570, 5, 725, 155);
Mouse(x + 3, y + 3, 2, 2, True);
Flag;
Wait(200 + Random(100));
end;
if (FindObj(x, y, 'Take Bird', 3952984, 10)) or
(FindObj(x, y, 'Take Bird', 1713706, 10)) or
(FindObj(x, y, 'Take Bird', 1581604, 10)) then
begin
WriteLn('Birds Nest Found');
Wait(450 + Random(400));
GetMousePos(x, y);
Mouse(x, y, 0, 0, True);
Flag;
Wait(500 + Random(300));
if (Screenshots) then
SaveScreenshot('Birds Nest - SRL - ' + IntToStr(GetTimeRunning) + '.bmp');
tries := tries + 100;
Birdsnest := Birdsnest + 1;
Mouse(583, 226, 2, 2, False);
Wait(100 + Random(100));
ChooseOption('Examine');
Exit;
end;
until (FindObj(x, y, 'Take Bird', 3952984, 10)) or
(FindObj(x, y, 'Take Bird', 1713706, 10)) or
(FindObj(x, y, 'Take Bird', 1581604, 10)) or (tries > 5)
end;
end;
{************************************************* ******************************
function FindEnt(fx, fy: Integer; AvoidWhenFound: Boolean): Boolean;
By: Sumilion
Description: Will look for an Ent and avoid if found.
************************************************** *****************************}
function FindEnt(fx, fy: Integer; AvoidWhenFound: Boolean): Boolean;
var
arUpTextEntColorPoints: TPointArray;
x, y, EntTime, tcts: Integer;
begin
if not(LoggedIn)then
Exit;
GetMousePos(x, y);
if(x <> fx)or(y <> fy)then
MMouse(fx, fy, 0, 0);
if(IsUpText('Chop'))then
begin
tcts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.4, 0.4);
FindColorsTolerance(arUpTextEntColorPoints, 51657, 80, 6, 127, 20, 5);
Result := Length(arUpTextEntColorPoints) > 10;
ColorToleranceSpeed(tcts);
end;
if(Result)then
begin
WriteLn('Ent Found!!');
if(AvoidWhenFound)then
begin
Writeln('Waiting for it to go away.');
MouseFindNoFlag(MMCX, MMCY, -1, 1);
MarkTime(EntTime);
while(TimeFromMark(EntTime) < 35000)do
if(Random(20) > 15)then
IdleTime(500, 500, 0.4)
else
Wait(500 + Random(500));
EntsAvoided := EntsAvoided + 1;
end;
end;
end;
{************************************************* ******************************
procedure SetupWoodcutting;
By: SRL
Description: Declares Global Bitmaps.
************************************************** *****************************}
procedure SetupWoodcutting;
begin
end;
Actually ... this is just a list of procedures and functions. Of course it doesn't work.