Basically, instead of using findObject you'll have to use something like I wrote above since findObject doesn't output a TPA for us to grab bounds to find the second colour. Your entire findObject line will be replaced in your procedure.
I don't use/never tried using findObject, but I take it you've got it left clicking once on a bush (but you can't seem to differentiate between shaking and non-shaking bushes? [assuming you're making a sprite charm hunter]). Pixelshift is definitely possible, but I would imagine it would be slow in finding shaking bushes since you would be checking over one search area at a time for x-amount of time in a field of 10+ bushes (unless of course you are using this to confirm shaking bushes after the secondary colour search).
A function (albeit messy) you would use would be like this (haven't tested):
Simba Code:
function findActiveBush(colour1, colour2, tolerance1, tolerance2: Integer; hue1, sat1, hue2, sat2: Extended): Boolean;
var
BoundsTPA, InnerTPA: TPointArray;
Bounds2D, Inner2D: T2DPointArray;
i: Integer;
begin
if FindColorsTolerance(BoundsTPA, colour1, mainScreen.getBounds(), tolerance1, colorSetting(2, hue1, sat1)) then
begin
Bounds2D := BoundsTPA.split(100,100); //I prefer to use cluster, but use whatever you need it for.
Bounds2D.sortBySize; //or any other sorting method here, depending on what you are finding.
if FindColorsTolerance(InnerTPA, colour2, Bounds2D[0].getBounds(), tolerance2, colorSetting(2, hue2, sat2)) then
begin //uses the bounds of the first found object to find colours within it.
Inner2D := InnerTPA.cluster(20);
Inner2D.sortBySize;
for i:=low(Inner2D) to high(Inner2D) do
begin
smartImage.clearArea(mainScreen.getBounds);
smartImage.debugATPA(Inner2D);
smartImage.debugTPA(Inner2D[i]);
MouseBox(Inner2D[i].getBounds, MOUSE_RIGHT, MOUSE_HUMAN); //from this line, it goes through each valid ATPA and performs an action
if (chooseOption.select(['some option here'], 500)) then
begin
result := true;
//actions to perform.
end;
end;
end;
end;
end;
If you get exceptions with drawing, edit out the smartImage lines or enable smart drawing in your script.