JAD
07-01-2007, 11:15 PM
Well, if you want to use these, feel free to use/modify them in any way you want, as long as proper credits are given!
Heres my axe head finding/fixing procedure. It also gets the axe head colors.. (needed for picking it up).
procedure LoadDTMs;
begin
Status('Loading all DTMs');
AxeDTM := DTMFromString('78DA633CCEC4C0D0CBC800021012C2E247E 23' +
'39E02AA994840CD11A09A7904D45C07AAE926A0E602504D2B 0135' +
'97F1ABF90F04002C1A0CA1');
BrokenAxeDTM := DTMFromString('78DA637CC7C4C0308F910104202484C58FC 46' +
'7FC0854D34340CD0FA09A2E026AFE03D5F41250C3C0CCC0D0 4E40' +
'CD6FA039AD04D47C05AA69C1ADE63F100000CD040E2F');
AxeHandleDTM := DTMFromString('78DA63D46162601066640001080961F123F 11' +
'915816AF408A8D100AA5124A0469508357A40352204D42800 D568' +
'E256F31F08000D2D0629');
AxeHeadDTM := DTMFromString('78DA637CC2C0C050C5C800021012C2E241E 23' +
'3BE02127504D480CCA927A0E62590A824A0E60190A825A0E6 3590' +
'A8C6ADE63F10000036F00CB1');
end;
procedure DeclareJADVars;
begin
JadX1[1] := 167; //Box 5
JadY1[1] := 113;
JadX2[1] := 334;
JadY2[1] := 226;
JADX1[2] := 0; //Box 4
JADY1[2] := 113;
JADX2[2] := 167;
JADY2[2] := 226;
JADX1[3] := 0; //Box 7
JADY1[3] := 226;
JADX2[3] := 167;
JADY2[3] := 339;
JADX1[4] := 167; //Box 8
JADY1[4] := 226;
JADX2[4] := 334;
JADY2[4] := 339;
JADX1[5] := 334; //Box 9
JADY1[5] := 226;
JADX2[5] := 501;
JADY2[5] := 339;
JADX1[6] := 334; //Box 6
JADY1[6] := 113;
JADX2[6] := 501;
JADY2[6] := 226;
JADX1[7] := 167; //Box 2
JADY1[7] := 0;
JADX2[7] := 334;
JADY2[7] := 113;
JADX1[8] := 334; //Box 3
JADY1[8] := 0;
JADX2[8] := 501;
JADY2[8] := 113;
JADX1[9] := 0; //Box 1
JADY1[9] := 0;
JADX2[9] := 167;
JADY2[9] := 113;
end;
{************************************************* *************************
------> All functions related to the axe/axe head here <------
************************************************** ************************}
{************************************************* *******
function GetOnAxeHead(Ax,Ay: Integer): Boolean;
By: JAD
Description: Gets the mouse on the axe head. Used in the
PickUpAxeHead function below.
************************************************** ******}
function GetOnAxeHead(Ax,Ay: Integer): Boolean;
var
I, Q:Integer;
Found: Boolean;
begin
for I:= 1 to 9 do
begin
for Q := Q to 10 do
begin
if(FindColorSpiralTolerance(Ax,Ay,AxeHeadColor[1],JadX1[i],JadY1[i],JadX2[i],JadY2[i],Q))or
(FindColorSpiralTolerance(Ax,Ay,AxeHeadColor[2],JadX1[i],JadY1[i],JadX2[i],JadY2[i],Q))or
(FindColorSpiralTolerance(Ax,Ax,AxeHeadColor[3],JadX1[i],JadY1[i],JadX2[i],JadY2[i],Q))then
begin
Found := True;
Break;
end;
end;
if(Found)then
begin
MMouse(Ax,Ay,0,0);
wait(200+random(200));
if(IsUpText('ead'))then
begin
Result := True;
GetMousePos(Ax,Ay);
Exit;
end;
end;
wait(300+random(300));
end;
end;
///////////////////////////////////////////////////
////// Gets the axe head coords. Used for //////
////// auto coloring the axe below //////
////////////////////////////////////////////////
function GetAxeHeadCoords: TPoint;
var Jx,Jy: Integer;
begin
Status('Getting axe head coordinates');
if(Players[CurrentPlayer].Boolean2)then
GameTab(5) else
GameTab(4);
wait(200+random(200));
if(FindDTM(AxeDTM,Jx,Jy,MIX1,MIY1,MIX2,MIY2))then
begin
Result.x := Jx + 10;
Result.y := Jy - 5;
Status('Found axe head coordinates');
Exit;
end else
begin
Writeln('Did NOT find axe. Please make sure player ');
Writeln(IntToStr(CurrentPlayer) + '''s Boolean2 is set correctly!');
Writeln('Or make sure you have an axe with you, not in bank.');
LogOut;
end;
end;
///////////////////////////////////////////////////
////// Gets the axe head colors and saves //////
////// them to the AxeHeadColor array //////
////////////////////////////////////////////////
function GetAxeHeadColors: Boolean;
var AxeHeadCoords: TPoint;
begin
if(not(LoggedIn))then
Exit;
if(Players[CurrentPlayer].Boolean2) = true then
GameTab(5) else
GameTab(4);
AxeHeadCoords := GetAxeHeadCoords;
Result := True;
AxeHeadColor[1] := GetColor(AxeHeadCoords.x,AxeHeadCoords.y);
AxeHeadColor[2] := GetColor(AxeHeadCoords.x-2,AxeHeadCoords.y-1);
AxeHeadColor[3] := GetColor(AxeHeadCoords.x+3,AxeHeadCoords.y+2);
Writeln('Axe head colors are ' + IntToStr(AxeHeadColor[1]) + ', ' +
IntToStr(AxeHeadColor[2]) + ' and ' + IntToStr(AxeHeadColor[3]) + '.');
end;
///////////////////////////////////////////////////
////// results true if we don't have an //////
////// axe (or one in good condition) //////
////////////////////////////////////////////////
function AxeExists: Boolean;
begin
if(Players[CurrentPlayer].Boolean2) = true then
GameTab(5) else
GameTab(4);
if(FindDTM(AxeDTM,x,y,MIX1,MIY1,MIX2,MIY2))then
begin
Result := True;
Status('We still have an axe');
Exit;
end else
begin
Result := False;
Writeln('We may have broken an axe/lost the axe head. Trying to solve now..');
end;
end;
///////////////////////////////////////////////////
////// Picks up the axe head. Used in the //////
////// function below //////
////////////////////////////////////////////////
function PickUpHead: Boolean;
var Jx,Jy, I: Integer;
begin
for I := 1 to 5 do
begin
if(GetOnAxeHead(Jx,Jy))then
begin
Result := True;
GetMousePos(Jx,Jy);
Mouse(Jx,Jy,0,0,true);
wait(1000+random(500));
Exit;
end;
wait(2000+random(1000));
end;
end;
///////////////////////////////////////////////////
////// Does everything to handle the axe //////
////// head flying off random //////
////////////////////////////////////////////////
function GetAxeBackTogether: Boolean;
begin
if(not(LoggedIn))then
Exit;
if(FindDTM(AxeHandleDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
if(Players[CurrentPlayer].Boolean2) = true then
begin
Mouse(x,y,1,1,true);
wait(500+random(500));
GameTab(4);
end;
if(PickUpHead)then
begin
if(FindDTM(AxeHandleDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
Mouse(x,y,1,1,false);
ChooseOption(x,y,'se');
wait(1000+random(500));
if(FindDTM(AxeHeadDTM,x,y,MIX1,MIY1,MIX2,MIY2))the n
begin
Mouse(x,y,1,1,true);
wait(1000+random(1000));
if(FindDTM(AxeDTM,x,y,MIX1,MIY1,MIX2,MIY2))then
begin
Result := True;
Writeln('put together the axe');
AxesAttached := AxesAttached + 1;
end else
begin
Result := False;
Writeln('Didnt successfully put together the axe :( Switching players..');
LogOut;
Exit;
end;
end;
end;
end;
end;
Result := False;
end;
function CheckAndSolveAxe: Boolean;
begin
if(not(AxeExists))then
begin
if(FindDTM(BrokenAxeDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
Writeln('we broke an axe. Going to check if we have extra ones in the bank');
BrokenAxe := True;
Result := True;
Exit;
end;
if(FindDTM(AxeHandleDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
if(not(GetAxeBackTogether))then
begin
Result := True;
Writeln('We lost the axe head :( Going to check if we have extra axes in the bank');
BrokenAxe := True;
Exit;
end;
end;
end;
end;
Put these in your global variables:
var
AxeHeadColor: array[1..3] of Integer;
JadX1: array[1..9] of Integer;
JadY1: array[1..9] of Integer;
JadX2: array[1..9] of Integer;
JadY2: array[1..9] of Integer;
BrokenAxeDTM, AxeHandleDTM, AxeHeadDTM, AxesAttached: Integer;
BrokenAxe: Boolean;
NOTE: Put Players.Boolean2 in your DeclarePlayers procedure. It just asks if the axe is weilded or not. So just add that to all your player arrays :)
You can take everything out with the BrokenAxe variable if you want... I use that so when chopping, it exits out of the chopping procedure if BrokenAxe ='s true, goes to the bank and withdraws and axe. You can take that out or try to use it if you want ;)
Then, all you need to do is call for CheckAndSolveAxe and you should be good :)
Here's my ent finding/handling function:
///////////////////////////////////////////////////
////// My Ent checker/handler //////
/////////////////////////////////////////////////
function CheckForEnt: Boolean;
var TPA: TPointArray;
begin
if(not(LoggedIn))then
Exit;
if(FindColorTolerance(x,y,55255,6,6,117,27,10))or
(FindColorTolerance(x,y,976101,6,6,117,27,10))then
begin
if(not(IsUpText('op'))) and (not(IsUpText('own')))then
Exit;
wait(1);
FindColorsSpiralTolerance(x,y,TPA,55255,6,6,117,27 ,10);
if(GetArrayLength(TPA) - 1 > 4)then
begin
Result := True;
Writeln('We found an ent!! Trying to avoid now..');
Mouse(648,84,3,3,true);
JadFlag(0,15);
FTWait(60+random(5));
if(Players[CurrentPlayer].Boolean2)then
GameTab(5) else
GameTab(4);
Result := FindDTM(x,y,AxeDTM,MIX1,MIY1,MIX2,MIY2);
if(Result)then
begin
Writeln('Whew! We avoided the ent.. Carrying on with chopping');
Ents := Ents + 1;
Exit;
end else
begin
if(FindDTM(x,y,BrokenAxeDTM,MIX1,MIY1,MIX2,MIY2))t hen
begin
Writeln('Oh darn.. We broke an axe :( going to check if you have extras in the bank');
BrokenAxe := True;
Exit;
end;
end;
end;
Result := False;
end;
end;
Same thing for this.. Your going to need the variables declared above and the DTM's for this to compile/work ;)
I just posted these because I had already made them in my script.. And SRL's FindEnt function doesn't work, and I don't think there axe head finding works (at least too well) so I thought I'd post it for my fellow scripters who need either/both of these :)
Enjoy!
~JAD
Heres my axe head finding/fixing procedure. It also gets the axe head colors.. (needed for picking it up).
procedure LoadDTMs;
begin
Status('Loading all DTMs');
AxeDTM := DTMFromString('78DA633CCEC4C0D0CBC800021012C2E247E 23' +
'39E02AA994840CD11A09A7904D45C07AAE926A0E602504D2B 0135' +
'97F1ABF90F04002C1A0CA1');
BrokenAxeDTM := DTMFromString('78DA637CC7C4C0308F910104202484C58FC 46' +
'7FC0854D34340CD0FA09A2E026AFE03D5F41250C3C0CCC0D0 4E40' +
'CD6FA039AD04D47C05AA69C1ADE63F100000CD040E2F');
AxeHandleDTM := DTMFromString('78DA63D46162601066640001080961F123F 11' +
'915816AF408A8D100AA5124A0469508357A40352204D42800 D568' +
'E256F31F08000D2D0629');
AxeHeadDTM := DTMFromString('78DA637CC2C0C050C5C800021012C2E241E 23' +
'3BE02127504D480CCA927A0E62590A824A0E60190A825A0E6 3590' +
'A8C6ADE63F10000036F00CB1');
end;
procedure DeclareJADVars;
begin
JadX1[1] := 167; //Box 5
JadY1[1] := 113;
JadX2[1] := 334;
JadY2[1] := 226;
JADX1[2] := 0; //Box 4
JADY1[2] := 113;
JADX2[2] := 167;
JADY2[2] := 226;
JADX1[3] := 0; //Box 7
JADY1[3] := 226;
JADX2[3] := 167;
JADY2[3] := 339;
JADX1[4] := 167; //Box 8
JADY1[4] := 226;
JADX2[4] := 334;
JADY2[4] := 339;
JADX1[5] := 334; //Box 9
JADY1[5] := 226;
JADX2[5] := 501;
JADY2[5] := 339;
JADX1[6] := 334; //Box 6
JADY1[6] := 113;
JADX2[6] := 501;
JADY2[6] := 226;
JADX1[7] := 167; //Box 2
JADY1[7] := 0;
JADX2[7] := 334;
JADY2[7] := 113;
JADX1[8] := 334; //Box 3
JADY1[8] := 0;
JADX2[8] := 501;
JADY2[8] := 113;
JADX1[9] := 0; //Box 1
JADY1[9] := 0;
JADX2[9] := 167;
JADY2[9] := 113;
end;
{************************************************* *************************
------> All functions related to the axe/axe head here <------
************************************************** ************************}
{************************************************* *******
function GetOnAxeHead(Ax,Ay: Integer): Boolean;
By: JAD
Description: Gets the mouse on the axe head. Used in the
PickUpAxeHead function below.
************************************************** ******}
function GetOnAxeHead(Ax,Ay: Integer): Boolean;
var
I, Q:Integer;
Found: Boolean;
begin
for I:= 1 to 9 do
begin
for Q := Q to 10 do
begin
if(FindColorSpiralTolerance(Ax,Ay,AxeHeadColor[1],JadX1[i],JadY1[i],JadX2[i],JadY2[i],Q))or
(FindColorSpiralTolerance(Ax,Ay,AxeHeadColor[2],JadX1[i],JadY1[i],JadX2[i],JadY2[i],Q))or
(FindColorSpiralTolerance(Ax,Ax,AxeHeadColor[3],JadX1[i],JadY1[i],JadX2[i],JadY2[i],Q))then
begin
Found := True;
Break;
end;
end;
if(Found)then
begin
MMouse(Ax,Ay,0,0);
wait(200+random(200));
if(IsUpText('ead'))then
begin
Result := True;
GetMousePos(Ax,Ay);
Exit;
end;
end;
wait(300+random(300));
end;
end;
///////////////////////////////////////////////////
////// Gets the axe head coords. Used for //////
////// auto coloring the axe below //////
////////////////////////////////////////////////
function GetAxeHeadCoords: TPoint;
var Jx,Jy: Integer;
begin
Status('Getting axe head coordinates');
if(Players[CurrentPlayer].Boolean2)then
GameTab(5) else
GameTab(4);
wait(200+random(200));
if(FindDTM(AxeDTM,Jx,Jy,MIX1,MIY1,MIX2,MIY2))then
begin
Result.x := Jx + 10;
Result.y := Jy - 5;
Status('Found axe head coordinates');
Exit;
end else
begin
Writeln('Did NOT find axe. Please make sure player ');
Writeln(IntToStr(CurrentPlayer) + '''s Boolean2 is set correctly!');
Writeln('Or make sure you have an axe with you, not in bank.');
LogOut;
end;
end;
///////////////////////////////////////////////////
////// Gets the axe head colors and saves //////
////// them to the AxeHeadColor array //////
////////////////////////////////////////////////
function GetAxeHeadColors: Boolean;
var AxeHeadCoords: TPoint;
begin
if(not(LoggedIn))then
Exit;
if(Players[CurrentPlayer].Boolean2) = true then
GameTab(5) else
GameTab(4);
AxeHeadCoords := GetAxeHeadCoords;
Result := True;
AxeHeadColor[1] := GetColor(AxeHeadCoords.x,AxeHeadCoords.y);
AxeHeadColor[2] := GetColor(AxeHeadCoords.x-2,AxeHeadCoords.y-1);
AxeHeadColor[3] := GetColor(AxeHeadCoords.x+3,AxeHeadCoords.y+2);
Writeln('Axe head colors are ' + IntToStr(AxeHeadColor[1]) + ', ' +
IntToStr(AxeHeadColor[2]) + ' and ' + IntToStr(AxeHeadColor[3]) + '.');
end;
///////////////////////////////////////////////////
////// results true if we don't have an //////
////// axe (or one in good condition) //////
////////////////////////////////////////////////
function AxeExists: Boolean;
begin
if(Players[CurrentPlayer].Boolean2) = true then
GameTab(5) else
GameTab(4);
if(FindDTM(AxeDTM,x,y,MIX1,MIY1,MIX2,MIY2))then
begin
Result := True;
Status('We still have an axe');
Exit;
end else
begin
Result := False;
Writeln('We may have broken an axe/lost the axe head. Trying to solve now..');
end;
end;
///////////////////////////////////////////////////
////// Picks up the axe head. Used in the //////
////// function below //////
////////////////////////////////////////////////
function PickUpHead: Boolean;
var Jx,Jy, I: Integer;
begin
for I := 1 to 5 do
begin
if(GetOnAxeHead(Jx,Jy))then
begin
Result := True;
GetMousePos(Jx,Jy);
Mouse(Jx,Jy,0,0,true);
wait(1000+random(500));
Exit;
end;
wait(2000+random(1000));
end;
end;
///////////////////////////////////////////////////
////// Does everything to handle the axe //////
////// head flying off random //////
////////////////////////////////////////////////
function GetAxeBackTogether: Boolean;
begin
if(not(LoggedIn))then
Exit;
if(FindDTM(AxeHandleDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
if(Players[CurrentPlayer].Boolean2) = true then
begin
Mouse(x,y,1,1,true);
wait(500+random(500));
GameTab(4);
end;
if(PickUpHead)then
begin
if(FindDTM(AxeHandleDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
Mouse(x,y,1,1,false);
ChooseOption(x,y,'se');
wait(1000+random(500));
if(FindDTM(AxeHeadDTM,x,y,MIX1,MIY1,MIX2,MIY2))the n
begin
Mouse(x,y,1,1,true);
wait(1000+random(1000));
if(FindDTM(AxeDTM,x,y,MIX1,MIY1,MIX2,MIY2))then
begin
Result := True;
Writeln('put together the axe');
AxesAttached := AxesAttached + 1;
end else
begin
Result := False;
Writeln('Didnt successfully put together the axe :( Switching players..');
LogOut;
Exit;
end;
end;
end;
end;
end;
Result := False;
end;
function CheckAndSolveAxe: Boolean;
begin
if(not(AxeExists))then
begin
if(FindDTM(BrokenAxeDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
Writeln('we broke an axe. Going to check if we have extra ones in the bank');
BrokenAxe := True;
Result := True;
Exit;
end;
if(FindDTM(AxeHandleDTM,x,y,MIX1,MIY1,MIX2,MIY2))t hen
begin
if(not(GetAxeBackTogether))then
begin
Result := True;
Writeln('We lost the axe head :( Going to check if we have extra axes in the bank');
BrokenAxe := True;
Exit;
end;
end;
end;
end;
Put these in your global variables:
var
AxeHeadColor: array[1..3] of Integer;
JadX1: array[1..9] of Integer;
JadY1: array[1..9] of Integer;
JadX2: array[1..9] of Integer;
JadY2: array[1..9] of Integer;
BrokenAxeDTM, AxeHandleDTM, AxeHeadDTM, AxesAttached: Integer;
BrokenAxe: Boolean;
NOTE: Put Players.Boolean2 in your DeclarePlayers procedure. It just asks if the axe is weilded or not. So just add that to all your player arrays :)
You can take everything out with the BrokenAxe variable if you want... I use that so when chopping, it exits out of the chopping procedure if BrokenAxe ='s true, goes to the bank and withdraws and axe. You can take that out or try to use it if you want ;)
Then, all you need to do is call for CheckAndSolveAxe and you should be good :)
Here's my ent finding/handling function:
///////////////////////////////////////////////////
////// My Ent checker/handler //////
/////////////////////////////////////////////////
function CheckForEnt: Boolean;
var TPA: TPointArray;
begin
if(not(LoggedIn))then
Exit;
if(FindColorTolerance(x,y,55255,6,6,117,27,10))or
(FindColorTolerance(x,y,976101,6,6,117,27,10))then
begin
if(not(IsUpText('op'))) and (not(IsUpText('own')))then
Exit;
wait(1);
FindColorsSpiralTolerance(x,y,TPA,55255,6,6,117,27 ,10);
if(GetArrayLength(TPA) - 1 > 4)then
begin
Result := True;
Writeln('We found an ent!! Trying to avoid now..');
Mouse(648,84,3,3,true);
JadFlag(0,15);
FTWait(60+random(5));
if(Players[CurrentPlayer].Boolean2)then
GameTab(5) else
GameTab(4);
Result := FindDTM(x,y,AxeDTM,MIX1,MIY1,MIX2,MIY2);
if(Result)then
begin
Writeln('Whew! We avoided the ent.. Carrying on with chopping');
Ents := Ents + 1;
Exit;
end else
begin
if(FindDTM(x,y,BrokenAxeDTM,MIX1,MIY1,MIX2,MIY2))t hen
begin
Writeln('Oh darn.. We broke an axe :( going to check if you have extras in the bank');
BrokenAxe := True;
Exit;
end;
end;
end;
Result := False;
end;
end;
Same thing for this.. Your going to need the variables declared above and the DTM's for this to compile/work ;)
I just posted these because I had already made them in my script.. And SRL's FindEnt function doesn't work, and I don't think there axe head finding works (at least too well) so I thought I'd post it for my fellow scripters who need either/both of these :)
Enjoy!
~JAD