Log in

View Full Version : [Box Clicking]



VillaVuFTW
02-27-2012, 01:27 AM
Okay.. I'm pretty fond with scripting..

I've got myself a spiffy little Astral Script,

Problem I have is... It always likes to click on the Stones that surround the thing, and I have it checking the UpText before clicking..

My solution would be to draw a box, and click the points in the box.. can somebody tell me how I would go about doing that?

Bonfield
02-27-2012, 01:34 AM
Can you post what you have it will be easier to make a solution to your problem if I can see how you are finding your coords

Nebula
02-27-2012, 01:35 AM
MouseBox(); ?


Post the procedure/function so we can help further.

VillaVuFTW
02-27-2012, 01:49 AM
Well here's what it was.. I'm attempting from another script to implement to this one

Function FindingAltar:Boolean;
Var
XXX, YYY, XX2, YY2, XX3, YY3, PlusOne:Integer;
Begin
Wait(1500);
If FindNormalRandoms then
Begin
ShutDown;
End else
XXX := X;
YYY := Y;

XX2 := X;
YY2 := Y;

If FindObjTPA(XXX, YYY, AltarColor, 5, 1, 20, 20, 150, ['Altar']) then
Begin
MMouse(XXX, YYY,6,6);
If IsUpText('Altar') then
Begin
Wait(RandomRange(320, 340));
ClickMouse2(True);
Wait(RandomRange(905, 950));
EmptyC;
Wait(100+RandomRange(100,200));
If FindObjTPA(XX2, YY2, AltarColor, 10, 1, 20, 20, 150, ['Altar']) then
Begin
MMouse(XX2,YY2,3,3);
ClickMouse2(True);
end;
Wait(RandomRange(905, 950));
EmptyA;
Wait(100+RandomRange(100, 200));
MMouse(XX2, YY2, 6, 6);
ClickMouse2(True);
Wait(RandomRange(125, 322));

End else
FindingAltar;
End else
Begin
WalkingToAltar;
FindingAltar;
End;
End;

How it finds it.

function AltarColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
R, G, B: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(6.45, 0.14);

FindColorsSpiralTolerance(MSCX, MSCY, arP, 8750977, MSX1, MSY1, MSX2, MSY2, 5);
if (Length(arP) = 0) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

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

if (R >= 122) and (R <= 148) and (G >= 122) and (G <= 148) and (B >= 116) and (B <= 141) then
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 18.44) and (X <= 27.22) and (Y >= 19.64) and (Y <= 28.98) and (Z >= 19.63) and (Z <= 28.98) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
end;

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

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;


MouseBox(); ?


Post the procedure/function so we can help further.

How do you get the x1, y1, x2, y2 for MouseBox? O_O

I've tried doing that before never really understood, so I'm using MSX1 MSY1, etc, instead.

Er1k
02-27-2012, 07:31 AM
You should really look into TPA/ATPA and then get the bounds of the TPA/ATPA (getTPABounds / getATPABounds), then the bounds will be the x1, x2, y1, y2 of your box you need to search in.

Actually in the autocolor function, I think arP is already the TPA you have found using that color.

Bonfield
02-27-2012, 08:07 AM
I was going to post that as soon as I saw findobj look into TPAs then you can use middleTPA to get the middlepoint then create your box around that