mxtrix
2013-12-17 01:47:45
Hey guys, I have recently come back to Simba after more than a year and have commenced making a Teak power-cutter. The script is complete however initially I used this to identify the teaks:
However it was inaccurate and I wanted to find a more reliable method so I found TPAs. After reading some tutorials throughout the forums I have written a simple procedure to do this- this can be seen below:
However when compiling I get the error: Exception in Script: Unknown declaration "TPAToATPEx" at line 59, column 12. I am trying to find all of the matching points and group them in rectangles with dimensions of 2x10 pixels (roughly what the trunk of each teak is). Below is a picture of the result from using ACA to test the effectiveness. I understand that the only failsafe present is that where it checks the uptext but I am just trying to get this to work first. I would like the procedure to find all of teak trunks and to click in the centre of the rectangle of the closest 'rectangle' of TPAs to the centre point (which was 273, 187). If anyone could help me it would be greatly appeciated.
[ATTACH=CONFIG]22568[/ATTACH]
not mainscreen.findObject(x, y, [6912650], [5], colorSetting(2, 1, 10), mainscreen.getCenterPoint(), 25, 80, 80, ['Teak'], mainscreen.getBounds(), MOUSE_LEFT)However it was inaccurate and I wanted to find a more reliable method so I found TPAs. After reading some tutorials throughout the forums I have written a simple procedure to do this- this can be seen below:
Procedure FindTeak;
var
TeakTPA:TPointArray;
ATPA : T2DPointArray;
I, X, Y : Integer;
begin
FindColorsSpiralTolerance(273, 187, TeakTPA, 6647686, 0, 0, 575, 388, 6);
ATPA := TPAToATPEx(TeakTPA, 2, 10);
For I := 0 To High(ATPA) Do
Begin
If MiddleTPAEx(ATPA[I], X, Y) Then
Mouse(x, y, 0, 0);
If (IsMouseOverText(['Teak','eak'],RandomRange(200,300))) Then
Mouse(x, y, 0, 0);
fastClick(MOUSE_LEFT);
Break;
End;
end; However when compiling I get the error: Exception in Script: Unknown declaration "TPAToATPEx" at line 59, column 12. I am trying to find all of the matching points and group them in rectangles with dimensions of 2x10 pixels (roughly what the trunk of each teak is). Below is a picture of the result from using ACA to test the effectiveness. I understand that the only failsafe present is that where it checks the uptext but I am just trying to get this to work first. I would like the procedure to find all of teak trunks and to click in the centre of the rectangle of the closest 'rectangle' of TPAs to the centre point (which was 273, 187). If anyone could help me it would be greatly appeciated.
[ATTACH=CONFIG]22568[/ATTACH]