SRL Archive - OSR Help

My attempt at a tree chopper


Nations_collapse

2013-02-26 10:31:32

Hello, I figured I would attempt to do some Simba. I really dont wanna leech off the community, and rather be proud of myself on scripting my own work but I continuously encounter issues like this. When I encounter these issues I cant seem to focus enough to find the right approach to scripting in Simba.
Here is my code I am not sure what exactly is going on, I read someones amazing tutorial and made a custom TPA finder and Color tolerancespeed modifier. Issue I have is activating the script onto clicking the color found.
Here is my code

program TPALearningTut;
{$I SRL\SRL.Simba}
{$I P07Include.Simba}
function FindTree(x, y: Integer): Boolean;
var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);////Sets the color tolerance speed to 2 so we can do HSL tolerance stuff
SetColorSpeed2Modifiers(0.329, 3.13);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2840398, MSX1, MSY1, MSX2, MSY2,8);
ColorToleranceSpeed(CTS);
ATPA := TPAToATPAEx(TPA, 15, 15);
For I :=0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 2, 2);
if(P07_IsUpTextMultiCustom(['hop','own','ree'])) Then
begin
Result := True;
GetMousePos(x, y);
Break;
end;
end;
end;

procedure Tree;
var x, y: integer;
begin
If FindTree(x, y) then
begin
Mouse(x, y, 0, 0, True);
WaitOption('Pick', 3000);
end;
end;

begin
Tree;
end.

Here is my findings


R: 66 | 77 | 87
G: 80 | 84 | 91
B: 30 | 55 | 59

H: 21.3333333333333 | 20.6896551724137 | 18.75
S: 45.4545454545454 | 20.8633093525179 | 21.3333333333333
L: 21.5686274509803 | 27.2549019607843 | 29.4117647058823

X: 5.34977110870793 | 6.92048023287261 | 8.46098267304723
Y: 6.98930971956758 | 8.19426355783886 | 9.82417459400542
Z: 2.29540441580592 | 4.83133229563778 | 5.58798643183905

Highest RGB values = R: 87 | G: 91 | B: 59
Lowest RGB values = R: 66 | G: 80 | B: 30
Differ RGB values = R: 21 | G: 11 | B: 29
Middle RGB values = R: 76 | G: 85 | B: 44
Middle RGB color = 2905420

Highest HSL values = H: 21.3333333333333 | S: 45.4545454545454 | L: 29.4117647058823
Lowest HSL values = H: 18.75 | S: 20.8633093525179 | L: 21.5686274509803
Differ HSL values = H: 2.58333333333333 | S: 24.5912361020274 | L: 7.84313725490196
Middle HSL values = H: 20.0416666666666 | S: 33.1589274035317 | L: 25.4901960784313
Middle HSL color = 2840398

Highest XYZ values = X: 8.46098267304723 | Y: 9.82417459400542 | Z: 5.58798643183905
Lowest XYZ values = X: 5.34977110870793 | Y: 6.98930971956758 | Z: 2.29540441580592
Differ XYZ values = X: 3.1112115643393 | Y: 2.83486487443784 | Z: 3.29258201603312
Middle XYZ values = X: 6.90537689087758 | Y: 8.4067421567865 | Z: 3.94169542382248
Middle XYZ color = 3102285

divided by
H 2.58333333333333 / L 7.84313725490196 = 0.3293749999999996

S 24.5912361020274 / L 7.84313725490196 = 3.135382603008494

L 7.84313725490196 = Tolerance (round up) = 8.0 =8

Middle HSL color = 2840398