Jump to content
shadowrecon

ClearSameIntegers

Recommended Posts

Well after trying to use it in the auto color function, simply replacing the ClearSameInt() function with the TIAUnique, i got a type mismatch, went up and checked the variable to make sure it was a TintegerArray and sure enough it was, whats the deal with that?

function FindYew(var fx, fy: Integer): Boolean;
var
 arP, arAP: TPointArray;
 arC, arUC: TIntegerArray;
 ararP: T2DPointArray;
 tmpCTS, i, j, arL, arL2: Integer;
 P: TPoint;
 R, G, B: Integer;
 X, Y, Z: Extended;
begin
 tmpCTS := GetColorToleranceSpeed;
 ColorToleranceSpeed(2);
 SetColorSpeed2Modifiers(1.12, 1.20);

 if not(FindColorsTolerance(arP, 3224634, MSX1, MSY1, MSX2, MSY2, 5)) then
 begin
   Writeln('Failed to find the color, no object found.');
   ColorToleranceSpeed(tmpCTS);
   SetColorSpeed2Modifiers(0.2, 0.2);
   Exit;
 end;

 arC := GetColors(arP);
 arUC := arC;
 TIAUnique(arUC);
 arL := High(arUC);
 arL2 := High(arC);

 for i := 0 to arL do
 begin
   ColorToRGB(arC[i], R, G, B);

   if (R >= 41) and (R <= 75) and (G >= 39) and (G <= 68) and (B >= 39) and (B <= 58) then
   begin
     ColorToXYZ(arC[i], X, Y, Z);

     if (X >= 2.08) and (X <= 5.59) and (Y >= 2.14) and (Y <= 5.79) and (Z >= 2.29) and (Z <= 4.71) then
     begin
       for j := 0 to arL2 do
       begin
         if (arUC[i] = arC[j]) then
         begin
           SetLength(arAP, Length(arAP) + 1);
           arAP[High(arAP)] := arP[j];
         end;
       end;
     end;
   end;
 end;

 SortTPAFrom(arAP, Point(MSCX, MSCY));
 ararP := SplitTPAEx(arAP, 100, 100);
 arL := High(ararP);

 for i := 0 to arL do
 begin
   if (Length(ararP[i]) < 10) then Continue;
   P := MiddleTPA(ararP[i]);
   MMouse(P.x, P.y, 5, 5);
   Wait(100 + Random(100));
   if (IsUpText('Yew')) then
   begin;
     Result := True;
     Break;
   end;
 end;

 ColorToleranceSpeed(tmpCTS);
 SetColorSpeed2Modifiers(0.2, 0.2);

 if (i = arL + 1) then
 begin
   Writeln('FindObject could not find object.');
   Exit;
 end;

 GetMousePos(fx, fy);
end;

 

so what your saying is osi isnt part of scar, its a plugin? =p

 

 

After looking over the TIAUnique function noticed it uses a Tintarray not a Tintegerarray, changed the array to Tintarray and it worked.... wtf? lol why are the array name being changed? is there a difference between the to? and is there a scar equivalent for SortTpaFrom() function ? =))

 

 

after some more digging i found the answer in the wiki SortTPAEx is what im looking for correct? anyways thanks guys!

Edited by shadowrecon
solved my problem
Link to comment
Share on other sites

Because TIntArray is shorter...

 

Also, Wanted is right, it was in a plugin which was part of SRL... It wasn't in the include itself. Please, in the future if you have suggestions, place it in the bugtracker.

 

why do u keep stating it should go in the 'bug tracker' that mantis bugtracker is not very desirable to go login and ect. wouldn't it be more appropriate to go in the 'discussion forum' under development? as this is a discussion and not a problem. As this has nothing to do with a current bug of the software, but more of a discussion on what i think should be implemented? Just stating, and you are correct looks like i did post in the wrong forum..

Link to comment
Share on other sites

I know that, im just confused as to why there is a discussion forum then? I was just trowing around an idea, not a absolute fact =p anywho ill keepideas to myself from now as they have to be put in a separate forum =/ (which i think is complete bogus! but it his forum so im gonna roll with it.. to speak)

Link to comment
Share on other sites

Suggestions go in the bug tracker. That way I can easily manage keep track of what I have and haven't processed. In my personal opinion, if people aren't willing to go through the "trouble" of logging in to mantis and placing a suggestion there, it's probably not worth the trouble for me to implement it.

Link to comment
Share on other sites

I gotcha, ill make sure future suggestions go in the bug tracker, but if this would of been posted there i may of not found out the answer which was that there is already a function that does this very same thing. but i guess the post should of been as a question to if it existed and then with the statement that if not it should be implemented.

 

my bad..

Link to comment
Share on other sites

I gotcha, ill make sure future suggestions go in the bug tracker, but if this would of been posted there i may of not found out the answer which was that there is already a function that does this very same thing. but i guess the post should of been as a question to if it existed and then with the statement that if not it should be implemented.

 

my bad..

 

If a suggestion or bug doesn't pan out, I leave a comment just as I would on a topic, stating why it isn't implemented or fixed, I believe the system notifies you by email about it, not sure though.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...