So yeah.
This is a typical picture of the Great Orb Project. The last altar, so all the altars are visible on top.

Need to filter out some parts. Yellow/orange-ish area is what I need to search in. Green boxes can be left out.

What's the best way to do this? Any way I can merge some boxes together into one search? Or is the best option just to make some boxes and search in them individually?
Box #1: (right)
(421, 193, 515, 311)
Box #2: (top)
(39, 11, 370, 76)
You can search for TPA ,then delete from TPA pixels ,which are in green box.
h := high(TPA);
for a:= 0 to h do
if PointInBox(TPA[a],GreenBox) then
DeleteValueInTPA(TPA,a);
nickrules
2012-05-01 17:45:31
var blacklistbox1,blacklistbox2:TBox;
TPA:TPointArray;
begin
blacklistbox1 := IntToBox(421,193,515,311);
blacklistbox2 := inttobox(39,11,370,76);
findTPA((31231231@#));
for i := 0 to high(TPA) do
begin
if (not PointInBox(TPA[i],blacklistbox1)) and (not Pointinbox(TPA[i],blacklistbox2)) then
begin
mmouse(TPA[i].x,TPA[i].y,5,5);
if waituptext('aidjfoasidof',300) then
begin
clickmouse2(mouse_left)
end;
end;
end;
end;
what this does is check if the point
isn't in one of those boxes, mmouses to it, then checks uptext and left clicks. If you don't understand any part, just ask :)
From: beginner5
You can search for TPA ,then delete from TPA pixels ,which are in green box.
h := high(TPA);
for a:= 0 to h do
if PointInBox(TPA[a],GreenBox) then
DeleteValueInTPA(TPA,a);
I see, was just about to try experiment with this but I see nick has expanded it :P Thanks.
From: nickrules
var blacklistbox1,blacklistbox2:TBox;
TPA:TPointArray;
begin
blacklistbox1 := IntToBox(421,193,515,311);
blacklistbox2 := inttobox(39,11,370,76);
findTPA((31231231@#));
for i := 0 to high(TPA) do
begin
if (not PointInBox(TPA[i],blacklistbox1)) and (not Pointinbox(TPA[i],blacklistbox2)) then
begin
mmouse(TPA[i].x,TPA[i].y,5,5);
if waituptext('aidjfoasidof',300) then
begin
clickmouse2(mouse_left)
end;
end;
end;
end;
what this does is check if the point isn't in one of those boxes, mmouses to it, then checks uptext and left clicks. If you don't understand any part, just ask :)
I see. This also means that it searches the whole client and not just the mainscreen? Or do I have to make a seperate Box where it should search in (using coords of the mainscreen) and then it will check every point except those boxes you already made. Interesting. Will look into it tomorrow, off to sleep now. Thanks ;)
Brandon
2012-05-01 18:58:17
Function SearchNotIn(Area1, Area2: TBox): Boolean;
var
TPA: TPointArray;
X, Y, I: Integer;
begin
FindColorsTolerance(TPA, Colour, MSX1, MSY1, MSX2, MSY2, Tolerance);
if (Length(TPA) < 1) then
Exit;
TPA:= ClearTPAFromTPA(TPA, TPAFromBox(Area1));
TPA:= ClearTPAFromTPA(TPA, TPAFromBox(Area2));
//Do whatever here with TPA.
end;
Searches just the mainscreen. Removes the specified boxes from the result.
nickrules
2012-05-01 20:56:32
From: J J
I see, was just about to try experiment with this but I see nick has expanded it :P Thanks.
I see. This also means that it searches the whole client and not just the mainscreen? Or do I have to make a seperate Box where it should search in (using coords of the mainscreen) and then it will check every point except those boxes you already made. Interesting. Will look into it tomorrow, off to sleep now. Thanks ;)
Where I wrote FindTPA(buttonsmashing), you'd just put findcolorstolerance, or whatever color
s finding method you so choose.
E: Which means you can search wherever you so choose.
iBlank
2012-05-02 00:38:42
Function FindMonster(x, y: Integer): Boolean;
Var
CTS, I: Integer;
TPA: TPointArray;
ATPA: Array of TPointArray;
Begin
CTS := GetColorToleranceSpeed;
Area1 := IntToBox(13,28,48,136);
Area2 := IntToBox(245,135,290,185);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.57);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5672059, MSX1, MSY1, MSX2, MSY2, 20);
ColorToleranceSpeed(CTS);
TPA:= ClearTPAFromTPA(TPA, TPAFromBox(Area1));
TPA:= ClearTPAFromTPA(TPA, TPAFromBox(Area2));
ATPA := TPAToATPAEx(TPA, 30, 30);
For I := 0 To High(ATPA) Do
Begin
MiddleTPAEx(ATPA[i], x, y);
MMouse(x, y, 0, 0);
If(WaitUpTextMulti(['Dea','eath','th ess','wrai','aith'],800)) Then
Begin
Result := True;
GetMousePos(x, y);
Break;
End;
End;
End;
This is the function I am currently using to find monsters and nodes in Runespan but leave out the colors on my character and the icons in the upper left area. Hope it helps to see it "in action"!
Thanks for the example Alevere :) (And the others, ofcourse.)
I've been working on it but I'm actually making it more advanced by drawing circles instead of boxes. And I want to draw circles around every altar and it should also detect how many circles it should draw. Eg. Mind Altar = altar #2 so it should draw a circle around altar #1 and altar #2 on the mainscreen. I pretty much got it working. Takes more time than expected to get everything right.. But yeah it was worth it.
Altar locations from the top of the screen
Altar #1 Middle = (66, 44) Box = (39, 11, 93, 76)
Altar #2 Middle = (123, 44) Box = (96, 11, 150, 76)
Altar #3 Middle = (179, 44) Box = (152, 11, 206, 76)
Altar #4 Middle = (236, 44) Box = (209, 11, 263, 76)
Altar #5 Middle = (292, 44) Box = (265, 11, 319, 76)
Altar #6 Middle = (349, 44) Box = (322, 11, 376, 76)
(33, 11, 384, 77)
57
*NEED TO UPDATE THIS*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Box #1: [rechts]
(421, 193, 515, 311)
Box #2: [top]
(39, 0, 370, 76)
6 altars
39, 0, 370, 76
~CUT OUT THIS AREA~
Altar #1
Middle = (67,44)
TOP = 65,11
Bottom = 66,76
Left = 40,60
Right = 93,60
–>
(40, 11, 93, 76)
MiddleX = 40+93/2 = 66.5
MiddleY = 11+76/2= 43.5
Middle = (67, 44)
RadiusX = 67-40=27
RadiusY = 44-11=33
Altar #2
Middle = (123, 44)
bottom = 123,76
top = 123,11
right = 150,28
left = 96,29
–>
(96, 11, 150, 76)
MiddleX = 96+150/2=123
MiddleY=11+76/2=43.5
Middle = (123, 44)
RadiusX=123-96=27
RadiusY=44-11=33
11+76/2=43.5
76-43.5=32,5
Radius X = 27
Radius Y = 33
Altar #3
Middle = (179, 44)
Top = 178, 11
Bottom = 178, 76
Left = 152,29
Right = 206, 28
(152, 11, 206, 76);
MiddleX = 152+206/2=179
MiddleY=11+76/2=43.5
Middle = (179, 44);
Radius X = 179-152 = 27
Radius Y = 44-11 = 33
Altar #4
top = 230, 11
bottom = 230, 76
left = 203, 29
right = 257, 60
(203, 11, 257, 76)
MiddleX = 203+257/2= 230
MiddleY= 11+76/2 = 44
Middle: (230, 44);
Altar #5
top = 286, 11
bottom = 286,76
left = 259, 29
right = 313, 60
–>
(259, 11, 313, 76)
MiddleX = 259+313/2= 286
MiddlY=11+76/2= 44
(286, 44);
Altar #6
top =
bottom =
left =
right =
–>
()
MiddleX=
MiddleY=
Middle =
All altars =
(39, 11, 378, 311)
for a := 0 to HowManyAltars do
TPA:= ClearTPAFromTPA(TPA, TPAFromCircle(MiddleX[a],MiddleY[a],Radius[a]) );
From: beginner5
for a := 0 to HowManyAltars do
TPA:= ClearTPAFromTPA(TPA, TPAFromCircle(MiddleX[a],MiddleY[a],Radius[a]) );
Thanks, even though I figured it out before reading that :P
I'm testing two new procedures I've made to detect in which team the player is. After that it will start either the yellow orb or the green orb procedure.
Will be editing this procedure soon which used two boxes
function YellowStars:Boolean;
var
X, Y, i: Integer;
P: TPoint;
YellowStarCol: TPointArray;
Area1, Area2: TBox;
YellowStarSplit: T2DPointArray;
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.16, 2.03);
Area1 := IntToBox(39, 0, 370, 76); // Box on top
Area2 := IntToBox(421, 193, 515, 311); // Box on the right
if FindColorsSpiralTolerance(MSCX, MSCY, YellowStarCol, 5236454, MSX1, MSY1, MSX2, MSY2, 10) then
begin
YellowStarCol := ClearTPAFromTPA(YellowStarCol, TPAFromBox(Area1));
YellowStarCol := ClearTPAFromTPA(YellowStarCol, TPAFromBox(Area2));
YellowStarSplit := TPAToATPAEx(YellowStarCol, 30, 30);
SortATPASize(YellowStarSplit, True);
for i:=0 to High(YellowStarSplit) do
begin
P := MiddleTPA(YellowStarSplit[i]);
MMouse(P.X, P.Y, 2, 2);
if WaitUpTextMulti(['ow or', 'Yellow Orb'], 250) then
begin
ClickMouse2(1);
Result:=True;
Break;
end;
end;
end else
begin
WriteLn('We haven`t been able to detect the yellow star colors');
end;
end;
Will be using the result from another procedure I have (DefineArea, which lets me know at which altar the player is) to know how many circles there should be drawed.
Eg. Air altar means there is just one circle to be drawed, it can search on the other spots. Will take some time to make this, but it will avoid bot like behaviour to walk around the altars to find new orbs. Because it can't find some orbs because it blocks out an area :P So I will be cutting out the exact circles for every altar to maximize the effiency.