LordJashin Posted March 7, 2013 Share Posted March 7, 2013 So the idea is to make a new DTM system, that can find them Rotated as well. I wrote up numerous skeletons before, and tried hard. Then I realized I need a new function. function CheckAllColorsInTPA(Colors: TIntArray; TPA: TPointArray): Boolean;: So basically, I want this to return TRUE, if all the colors are found at the points specified in the TPA. Not just if one color is found, and not the others. Here it is: [scar] function CheckAllColorsInTPA(Colors: TIntArray; TPA: TPointArray): Boolean; begin Result := False; for i := 0 to high(Colors) do for j := 0 to high(TPA) do if not FindColor(x, y, Colors, TPA[j].X, TPA[j].Y, TPA[j].X, TPA[j].Y) then Exit Result := True; end; [/scar] New DTM system w/ rotation: 1. Gather all the points and with rotation as the (Difference array) Which means the difference of SubPoints to MainPoint in the DTM (x, y diff) Takes about a second for 0-359 rotation and 0.1 angle stepping (can all be done at script start) 2. Gather colors into an array, so now we have a Colors array, and one with all the SubPoints 3. Find the MainPoint on the screen 4. Then Duplicate the SubPoint array, and offset it by where the MainPoint was found 5. Then check if the colors are found correctly with the subpoints 6. If found then return w/e This is a good basis idea. I can think of some better ways to improve this. It all comes down to improving the color stuff/arrays..... Quote Link to comment Share on other sites More sharing options...
Wanted Posted March 7, 2013 Share Posted March 7, 2013 Add support for Area and Tolerance etc. change the input to Dynamic DTM style. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted March 7, 2013 Author Share Posted March 7, 2013 I never got how the Area Size, Shape, etc worked. Quote Link to comment Share on other sites More sharing options...
Wanted Posted March 7, 2013 Share Posted March 7, 2013 Talking to Freddy, he's telling me that it's not broken. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted March 7, 2013 Author Share Posted March 7, 2013 Last I checked, it was very much so. Maybe I should prove it... Quote Link to comment Share on other sites More sharing options...
Janilabo Posted March 7, 2013 Share Posted March 7, 2013 Welcome back LJ! Glad to see you are working on this project again, hopefully with good results. The only thing I would change for CheckAllColorsInTPA, would be this: function CheckAllColorsInTPA(Colors: TIntArray; TPA: TPointArray): Boolean; var i, j, h1, h2: Integer; begin Result := False; h1 := High(Colors); h2 := High(TPA); for i := 0 to h1 do for j := 0 to h2 do if not FindColor(x, y, Colors[i], TPA[j].X, TPA[j].Y, TPA[j].X, TPA[j].Y) then Exit; Result := True; end; Nice function btw! -Jani Quote Link to comment Share on other sites More sharing options...