JuKKa
2008-05-01 06:59:53
program New;
{.Include SRL/SRL.Scar}
Function TPAToDDTM(Var DTM: Integer; Item, SubPoints: Integer): Boolean;
Var
MainPoint: TDTMPointDef;
SubPoint: Array of TDTMPointDef;
TempTDTM: TDTM;
I, X, Y: Integer;
TB: TBox;
TP: TPoint;
TPA: TPointArray;
Begin
If(Item < 1)Or(Item > 28)Then
Begin
Writeln('Item cant be '+IntToStr(Item));
Exit;
End Else
If(Loggedin)And(TabExists(4))Then
GameTab(4)
Else Exit;
If(Item < 1)Or(Item > 28)Then
Begin
Writeln('Item cant be '+IntToStr(Item));
Exit;
End Else GameTab(4);
If(Not ExistsItem(Item))Then Exit;
TP := ItemCoords(Item);
GetInvItemBounds(Item, TB);
FindColorsSpiralTolerance( Tp.X, Tp.Y, TPA, 65536, TB.X1, TB.Y1, TB.X2, TB.Y2, 0);
MiddleTPAEx(TPA, X, Y);
SetArrayLength(SubPoint, GetArrayLength(TPA));
MainPoint.x := X;
MainPoint.y := Y;
MainPoint.Tolerance := 255;
For I:= 0 To High(TPA) Do
Begin
If( I >= SubPoints )Then Break;
SubPoint[I].x := TPA[I].X;
SubPoint[I].y := TPA[I].Y;
SubPoint[I].Color := 65536;
End;
TempTDTM.MainPoint := MainPoint;
TempTDTM.SubPoints := SubPoint;
DTM := AddDTM(TempTDTM);
If(DTM > 0)Then
Result := True;
End;
Var
T, X, Y, DTM2: Integer;
Begin
SetupSRL;
T := GetSystemTime;
TPAToDDTM(DTM2, 2, 500);
Writeln('Took = ' + IntToStr(GetSystemTime - T)+' MSec to make DDTM');
If(DTM2 > 0)Then
Begin
T := GetSystemTime;
FindDTM(DTM2, X, Y, MIX1, MIY1, MIX2, MIY2);
Writeln('Took = ' + IntToStr(GetSystemTime - T)+' MSec to find DTM');
MMouse(X, Y, 0, 0);
End;
End.Function TPAToDDTM(Var DTM: Integer; Item, SubPoints: Integer): Boolean;
the function returns True when it successfully creates a DDTM!
Varialbes:
DTM = This variable will store the DTM(DDTM) it creates.
Item = 1-28 any item in the inventory.
SubPoints = How many subpoints do u want to make? recommended 4-20.
I have made a ddtm that had 250 subpoints didnt matter its not that much slower. its just useless to have so many subpoints.
I could add tolerance & color etc. support for the mainpoint if people want ;).