King

05-07-2013, 03:22 AM

Hey all, finally got around to posting this <3

ExbqObeERHk

Code for the script mentioned:

Example of DDTM being called in a function to load it.

function LoadDDTMWalk(WalkNumber: Integer): Integer;

var

dtmMainPoint: TDTMPointDef;

dtmSubPoints: array[0..3] of TDTMPointDef;

TempTDTM: TDTM;

begin

case WalkNumber of

1: begin

begin

dtmMainPoint.x := 1122;

dtmMainPoint.y := 177;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 931654;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1122;

dtmSubPoints[0].y := 177;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 931654;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1119;

dtmSubPoints[1].y := 167;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 12161405;

dtmSubPoints[1].Tolerance := 30;

dtmSubPoints[2].x := 1121;

dtmSubPoints[2].y := 187;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 12161405;

dtmSubPoints[2].Tolerance := 30;

dtmSubPoints[3].x := 1128;

dtmSubPoints[3].y := 177;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 931654;

dtmSubPoints[3].Tolerance := 30;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

end;

2: begin

dtmMainPoint.x := 1129;

dtmMainPoint.y := 141;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 3104640;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1129;

dtmSubPoints[0].y := 141;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 3104640;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1108;

dtmSubPoints[1].y := 154;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 12161405;

dtmSubPoints[1].Tolerance := 30;

dtmSubPoints[2].x := 1111;

dtmSubPoints[2].y := 161;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 12161405;

dtmSubPoints[2].Tolerance := 30;

dtmSubPoints[3].x := 1154;

dtmSubPoints[3].y := 161;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 931654;

dtmSubPoints[3].Tolerance := 30;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

//'''''''''''''''''''''''''''''''''''''''''\\

// Walking to Altar \\

//'''''''''''''''''''''''''''''''''''''''''\\

3: begin

dtmMainPoint.x := 1111;

dtmMainPoint.y := 203;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 2264190;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1111;

dtmSubPoints[0].y := 203;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 2264190;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1137;

dtmSubPoints[1].y := 220;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 11036250;

dtmSubPoints[1].Tolerance := 35;

dtmSubPoints[2].x := 1134;

dtmSubPoints[2].y := 149;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 610078;

dtmSubPoints[2].Tolerance := 35;

dtmSubPoints[3].x := 1117;

dtmSubPoints[3].y := 144;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 610078;

dtmSubPoints[3].Tolerance := 35;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

4: begin

dtmMainPoint.x := 1113;

dtmMainPoint.y := 228;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 7369593;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1113;

dtmSubPoints[0].y := 228;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 7369593;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1133;

dtmSubPoints[1].y := 215;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 610078;

dtmSubPoints[1].Tolerance := 35;

dtmSubPoints[2].x := 1112;

dtmSubPoints[2].y := 211;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 11036250;

dtmSubPoints[2].Tolerance := 35;

dtmSubPoints[3].x := 1103;

dtmSubPoints[3].y := 197;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 610078;

dtmSubPoints[3].Tolerance := 35;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

5: begin

dtmMainPoint.x := 1114;

dtmMainPoint.y := 216;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 7369593;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1114;

dtmSubPoints[0].y := 216;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 7369593;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1095;

dtmSubPoints[1].y := 250;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 12161405;

dtmSubPoints[1].Tolerance := 35;

dtmSubPoints[2].x := 1097;

dtmSubPoints[2].y := 212;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 610078;

dtmSubPoints[2].Tolerance := 35;

dtmSubPoints[3].x := 1114;

dtmSubPoints[3].y := 236;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 931654;

dtmSubPoints[3].Tolerance := 35;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

end;

end;

Example of DDTM in use.

function WalkToAltar: Boolean;

var

WalkDTM: integer;

aFound: Extended;

begin

WalkDTM := LoadDDTMWalk(3);

if FindDTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

begin

Mouse(X, Y, 2, 2, True);

FFlag(0);

WriteDebug('Balloon Point 1 done');

end

else

WriteDebug('Cant find the DDTM');

WalkDTM := LoadDDTMWalk(4);

if FindDTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

begin

Mouse(X, Y, 2, 2, True);

FFlag(0);

WriteDebug('Balloon Point 2 done');

end

else

writedebug('Cant find the DDTM');

WalkDTM := LoadDDTMWalk(5);

if FindDTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

begin

Mouse(X, Y, 2, 2, True);

FFlag(0);

WriteDebug('Balloon Point 1 done');

end

else

WriteDebug('Cant find the DDTM');

end;

Didnt cover this in the video, should have.

How to AutoColor points:

Credit to NKN for writing the code for me in skype!

function FindTheColor(color: integer): Integer;

var

x,y:integer;

TPA:TPointArray;

begin

if FindColorSpiralTolerance(x, y, color, MMX1, MMY1, MMX2, MMY2, 30) then

result := GetColor(x, y)

else

result := -1;

end;

How to use it in a DDTM procedure :

function LoadDDTMWalk(WalkNumber: Integer): Integer;

var

dtmMainPoint: TDTMPointDef;

dtmSubPoints: array[0..3] of TDTMPointDef;

TempTDTM: TDTM;

begin

case WalkNumber of

1: begin

begin

dtmMainPoint.x := 1122;

dtmMainPoint.y := 177;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 931654;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1122;

dtmSubPoints[0].y := 177;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 931654;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1119;

dtmSubPoints[1].y := 167;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := FindTheColor(12161405);

dtmSubPoints[1].Tolerance := 30;

dtmSubPoints[2].x := 1121;

dtmSubPoints[2].y := 187;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := FindTheColor(12161405);

dtmSubPoints[2].Tolerance := 30;

dtmSubPoints[3].x := 1128;

dtmSubPoints[3].y := 177;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := FindTheColor(931654);

dtmSubPoints[3].Tolerance := 30;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

end;

This Auto-Colors the point to find it a bit better. Another way to do this is to use ACA's AutoColor function and implement it just like this.

http://villavu.com/forum/showthread.php?t=25312

^Link to the editor

ExbqObeERHk

Code for the script mentioned:

Example of DDTM being called in a function to load it.

function LoadDDTMWalk(WalkNumber: Integer): Integer;

var

dtmMainPoint: TDTMPointDef;

dtmSubPoints: array[0..3] of TDTMPointDef;

TempTDTM: TDTM;

begin

case WalkNumber of

1: begin

begin

dtmMainPoint.x := 1122;

dtmMainPoint.y := 177;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 931654;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1122;

dtmSubPoints[0].y := 177;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 931654;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1119;

dtmSubPoints[1].y := 167;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 12161405;

dtmSubPoints[1].Tolerance := 30;

dtmSubPoints[2].x := 1121;

dtmSubPoints[2].y := 187;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 12161405;

dtmSubPoints[2].Tolerance := 30;

dtmSubPoints[3].x := 1128;

dtmSubPoints[3].y := 177;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 931654;

dtmSubPoints[3].Tolerance := 30;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

end;

2: begin

dtmMainPoint.x := 1129;

dtmMainPoint.y := 141;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 3104640;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1129;

dtmSubPoints[0].y := 141;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 3104640;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1108;

dtmSubPoints[1].y := 154;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 12161405;

dtmSubPoints[1].Tolerance := 30;

dtmSubPoints[2].x := 1111;

dtmSubPoints[2].y := 161;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 12161405;

dtmSubPoints[2].Tolerance := 30;

dtmSubPoints[3].x := 1154;

dtmSubPoints[3].y := 161;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 931654;

dtmSubPoints[3].Tolerance := 30;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

//'''''''''''''''''''''''''''''''''''''''''\\

// Walking to Altar \\

//'''''''''''''''''''''''''''''''''''''''''\\

3: begin

dtmMainPoint.x := 1111;

dtmMainPoint.y := 203;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 2264190;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1111;

dtmSubPoints[0].y := 203;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 2264190;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1137;

dtmSubPoints[1].y := 220;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 11036250;

dtmSubPoints[1].Tolerance := 35;

dtmSubPoints[2].x := 1134;

dtmSubPoints[2].y := 149;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 610078;

dtmSubPoints[2].Tolerance := 35;

dtmSubPoints[3].x := 1117;

dtmSubPoints[3].y := 144;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 610078;

dtmSubPoints[3].Tolerance := 35;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

4: begin

dtmMainPoint.x := 1113;

dtmMainPoint.y := 228;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 7369593;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1113;

dtmSubPoints[0].y := 228;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 7369593;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1133;

dtmSubPoints[1].y := 215;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 610078;

dtmSubPoints[1].Tolerance := 35;

dtmSubPoints[2].x := 1112;

dtmSubPoints[2].y := 211;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 11036250;

dtmSubPoints[2].Tolerance := 35;

dtmSubPoints[3].x := 1103;

dtmSubPoints[3].y := 197;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 610078;

dtmSubPoints[3].Tolerance := 35;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

5: begin

dtmMainPoint.x := 1114;

dtmMainPoint.y := 216;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 7369593;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1114;

dtmSubPoints[0].y := 216;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 7369593;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1095;

dtmSubPoints[1].y := 250;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := 12161405;

dtmSubPoints[1].Tolerance := 35;

dtmSubPoints[2].x := 1097;

dtmSubPoints[2].y := 212;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := 610078;

dtmSubPoints[2].Tolerance := 35;

dtmSubPoints[3].x := 1114;

dtmSubPoints[3].y := 236;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := 931654;

dtmSubPoints[3].Tolerance := 35;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

end;

end;

Example of DDTM in use.

function WalkToAltar: Boolean;

var

WalkDTM: integer;

aFound: Extended;

begin

WalkDTM := LoadDDTMWalk(3);

if FindDTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

begin

Mouse(X, Y, 2, 2, True);

FFlag(0);

WriteDebug('Balloon Point 1 done');

end

else

WriteDebug('Cant find the DDTM');

WalkDTM := LoadDDTMWalk(4);

if FindDTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

begin

Mouse(X, Y, 2, 2, True);

FFlag(0);

WriteDebug('Balloon Point 2 done');

end

else

writedebug('Cant find the DDTM');

WalkDTM := LoadDDTMWalk(5);

if FindDTMRotated(WalkDTM, x, y, MMX1, MMY1, MMX2, MMY2, -Pi/2, Pi/2, Pi/30, aFound) then

begin

Mouse(X, Y, 2, 2, True);

FFlag(0);

WriteDebug('Balloon Point 1 done');

end

else

WriteDebug('Cant find the DDTM');

end;

Didnt cover this in the video, should have.

How to AutoColor points:

Credit to NKN for writing the code for me in skype!

function FindTheColor(color: integer): Integer;

var

x,y:integer;

TPA:TPointArray;

begin

if FindColorSpiralTolerance(x, y, color, MMX1, MMY1, MMX2, MMY2, 30) then

result := GetColor(x, y)

else

result := -1;

end;

How to use it in a DDTM procedure :

function LoadDDTMWalk(WalkNumber: Integer): Integer;

var

dtmMainPoint: TDTMPointDef;

dtmSubPoints: array[0..3] of TDTMPointDef;

TempTDTM: TDTM;

begin

case WalkNumber of

1: begin

begin

dtmMainPoint.x := 1122;

dtmMainPoint.y := 177;

dtmMainPoint.AreaSize := 3;

dtmMainPoint.AreaShape := 0;

dtmMainPoint.Color := 931654;

dtmMainPoint.Tolerance := 255;

dtmSubPoints[0].x := 1122;

dtmSubPoints[0].y := 177;

dtmSubPoints[0].AreaSize := 3;

dtmSubPoints[0].AreaShape := 0;

dtmSubPoints[0].Color := 931654;

dtmSubPoints[0].Tolerance := 255;

dtmSubPoints[1].x := 1119;

dtmSubPoints[1].y := 167;

dtmSubPoints[1].AreaSize := 3;

dtmSubPoints[1].AreaShape := 0;

dtmSubPoints[1].Color := FindTheColor(12161405);

dtmSubPoints[1].Tolerance := 30;

dtmSubPoints[2].x := 1121;

dtmSubPoints[2].y := 187;

dtmSubPoints[2].AreaSize := 3;

dtmSubPoints[2].AreaShape := 0;

dtmSubPoints[2].Color := FindTheColor(12161405);

dtmSubPoints[2].Tolerance := 30;

dtmSubPoints[3].x := 1128;

dtmSubPoints[3].y := 177;

dtmSubPoints[3].AreaSize := 3;

dtmSubPoints[3].AreaShape := 0;

dtmSubPoints[3].Color := FindTheColor(931654);

dtmSubPoints[3].Tolerance := 30;

TempTDTM.MainPoint := dtmMainPoint;

TempTDTM.SubPoints := dtmSubPoints;

Result := AddDTM(TempTDTM);

end;

end;

This Auto-Colors the point to find it a bit better. Another way to do this is to use ACA's AutoColor function and implement it just like this.

http://villavu.com/forum/showthread.php?t=25312

^Link to the editor