SRL Archive - Jr. Member General Help and Discussion

finding object in a difficult area?


sipfer3

2014-10-08 15:45:38

hello guys,

so i am currently strugling with finding an ladder in an wooden room.
This is the procedure im using (thanks to major nad his guide at this point ;) )

procedure findLadderDown();
var
x, y, i: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
failTimer: TTimeMarker;

begin
if not isLoggedIn() then
exit;
repeat
findColorsSpiralTolerance(x, y, TPA, 1848902, mainScreen.getBounds(), 12, colorSetting(2, 0.11, 0.30));

if (Length(TPA) < 1) then
exit;

ATPA := TPA.toATPA(3, 3);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['limb Ladder'], 500) then
begin
failTimer.start();
fastClick(MOUSE_RIGHT);
wait(randomRange(1000,1500));
chooseOption.select(['limb-down', 'adder']);
wait(randomRange(3500,4000));
sendKeys('2', 50, 50);
repeat
wait(100);
until((isDown = true) or (failTimer.getTIme() > 15000));
exit;
break;
end;
end;
until(isDown = true);
end;

sadly the area where the ladder is, is the same color like the floor and the walls, so the procedure will give around 100-200 results. It is working, but it takes time, so it looks REALLY bot like. I was just wondering if theres any chance some on could help me? :P

thanks

sipfer

tls

2014-10-08 15:52:55

Image of the area?

sipfer3

2014-10-08 15:58:22

here it is :
[ATTACH=CONFIG]24181[/ATTACH]
left side is the area it will also find, right side is the ladder.
sorry for the small image but i dont want anyone release a script for that before i can :x :P

Hoodz

2014-10-08 15:59:31

is there a minimap icon or something for downstairs?

Lipcot

2014-10-08 16:00:41

You could do something like this. If you now where you are, you can do a searchbox to search for that color on a given area, and sort the atpa from that point, so the stairs will be one of the first TPA's . this procedure i use to go downstairs in wooden place with wood stairs :)

Hope you can learn somethhing from it: (notice DOWNSTAIRSSAFE is another procedure in which i search but without a searchbox, in case something goes wrong)

procedure Downstairs();
var
x, x2, y2, y, i: integer;
TPA, TPA2: TPointArray;
p: Tpoint;
ATPA: T2DPointArray;
searchbox, searchbox2: tbox;
begin
if not isLoggedIn() then
exit;

if MinimapBlack then
begin
writeLn('We Are at the Bank');
end else
begin
writeLn('We are not Upstairs. Exiting loop');
exit;
end;

mouseSpeed := 30 + random(5);
minimap.setAngle(MM_DIRECTION_WEST);
wait(randomRange(400, 600));

repeat

Searchbox:= inttobox(4, 125, 140, 318);
//SmartImage.DrawBox(SearchBox);

findColorsSpiralTolerance(x, y, TPA, StairsDownColor, searchbox, StairsDownTol, colorSetting(2, StairsDownHue, StairsDownSat));
findColorsSpiralTolerance(x2, y2, TPA2, StairsDownColor2, searchbox, StairsDownTol2, colorSetting(2, StairsDownHue2, StairsDownSat2));
tpa.combine(tpa2);

if (Length(TPA2) < 1) then
begin
writeLn('*Couldnt find any color*');
DownstairsSafe;
end;

ATPA := TPA2.Cluster(20);
ATPA.filterBetween(0, 15);
atpa.sortFromFirstPoint(point(4, 200));
//smartImage.debugATPA(ATPA);
//write(atpa);

wait(randomRange(400, 600));

for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_MOVE);
if isMouseOverText(['taircase', 'Staircase'], 100) then
begin
fastClick(MOUSE_LEFT);
wait(randomRange(5000, 7000));

if not notmoving then
wait(randomRange(1000, 2000));

// smartImage.clear();
end else
begin
DownstairsSafe();
end;
end;
until not MiniMapBlack;
end;

you could also try looking for the shadowy part of the stairs now i've seen the image. Cause you have a TOL of 12, so thats why you are getting 123892 colors.

sipfer3

2014-10-08 16:00:58

nop there isnt any item close which i could use. only some npc but they are all over that area

edit: undorak7, nice i really didnt think of that. It is not 100% the same spot ill stand but to only search in a box will make it alot faster already. thanks

Lipcot

2014-10-08 16:23:22

From: sipfer3
nop there isnt any item close which i could use. only some npc but they are all over that area

edit: undorak7, nice i really didnt think of that. It is not 100% the same spot ill stand but to only search in a box will make it alot faster already. thanks


Tell me if you can work it out, if not i can give you a hand later

sipfer3

2014-10-08 16:37:55

From: undorak7
Tell me if you can work it out, if not i can give you a hand later


that was a great tipp. form over 1k results (checked it again it were wa ymore than 200) to around 20-40, depends on where i am standing.
now i try to make it getting in a certain area so it only gets the ladder as result. best tipp ever :) thanks!

Lipcot

2014-10-08 17:14:57

From: sipfer3
that was a great tipp. form over 1k results (checked it again it were wa ymore than 200) to around 20-40, depends on where i am standing.
now i try to make it getting in a certain area so it only gets the ladder as result. best tipp ever :) thanks!


Anytime :)

bg5

2014-10-10 22:14:40

Look into my plugin: https://villavu.com/forum/showthread.php?t=83795&p=1038051 I was testing it in more unpleasant environment (like example 2) ,it can find your ladder pretty quick ,I think :)

PM me if you need any help with it.