SRL Archive - OSR Help

Trouble finding an onscreen ladder


Peanuts

2013-06-10 02:15:49

I'm trying to find the ladder above the mining guild, in falador..

There are doors, stairs, window frames, house frames.. with similar colors..

What do you suggest to accurately find the ladder

Is there DDTMS for MS? cant find a tut lol


BUMPBUMPBUMPBUMpBUMP

Flight

2013-06-10 02:35:04

Can you post a picture?

Peanuts

2013-06-10 02:37:16

From: Flight
Can you post a picture?


[ATTACH=CONFIG]21621[/ATTACH]

Thanks flight.

EDIT: It sps walks.. moves the angle..
i didnt have it to set to anything before searching..?

thats the angle it would be set at .. in the previous pic

Flight

2013-06-10 03:29:26

Alright, could you post a picture with your angle set to how it will be when you walk here? (North I would assume) Just edit your previous post and I'll see it.

Edit:
Well you can set SPS to only walk at North, I guess you have yours set to SPS_AnyAngle := True;.

Chris

2013-06-10 06:33:04

Maybe you could make it set the angle to west, east, north or south and then make a TPA of the roadcolor, after that get the bounds of that TPA and search for the ladder color in that box.
I haven't done any RuneScape scripting in a while, but this would probably work.

rj

2013-06-10 09:41:08

@Peanuts


As you can see here the entrance around the ladder has a unique color for the most part:


There are some other matching colors, but that can be fixed by Ollybest's TPA filter. What it does is it filters TPA's that have a certain number of points:

procedure filterTPAsBetween(var atpa: T2DPointArray; len1, len2: integer);
var
h, l, i: integer;
c: T2DPointArray;
begin
h := high(atpa);

for i := 0 to h do
begin
l := length(atpa[i]);

if (not (inRange(l, len1, len2))) then
begin
setLength(c, length(c) + 1);
c[high(c)] := atpa[i];
end;
end;

atpa := c;
end;

Example:


filterTPAsBetween(ATPA, 1, 650)

That would filter/delete TPA's that have 1-650 points in them

Here is the TPA being debugged:


Now all we have to do is wait for the uptext


Here's the code let me know if you need anything to be explained

{$DEFINE SMART8}
{$i srl/srl.simba}
{$i srl/srl/misc/SmartGraphics.simba}
procedure filterTPAsBetween(var atpa: T2DPointArray; len1, len2: integer);
var
h, l, i: integer;
c: T2DPointArray;
begin
h := high(atpa);

for i := 0 to h do
begin
l := length(atpa[i]);

if (not (inRange(l, len1, len2))) then
begin
setLength(c, length(c) + 1);
c[high(c)] := atpa[i];
end;
end;

atpa := c;
end;
Function FindLadder: Boolean;
var
B: TBox;
TPA,TPA2: TPointArray;
i,CTS,X,Y: Integer;
ATPA: T2DPointArray;
begin
Result := False;

if (not loggedin) then exit;

CTS := GetColorToleranceSpeed;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.51);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3032670, MSX1, MSY1, MSX2, MSY2, 12);
SetColorSpeed2Modifiers(0.02, 0.02);
ColorToleranceSpeed(CTS);

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

ATPA := TPAToATPAEx(TPA, 70, 70);
filterTPAsBetween(ATPA, 1, 650)
SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));
smart_debugATPA(true,ATPA);
for i := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], X, Y);
MMouse(X, Y, 6, 6);
if WaitUpTextMulti(['adder','limb'], 300) then
begin
Result := True;
Exit;
end;
end;
end;
begin
SetupSRL;
FindLadder;
end.

partly ripped off of flight.

Peanuts

2013-06-10 13:53:58

From: Officer Barbrady
@Peanuts


As you can see here the entrance around the ladder has a unique color for the most part:


There are some other matching colors, but that can be fixed by Ollybest's TPA filter. What it does is it filters TPA's that have a certain number of points:

procedure filterTPAsBetween(var atpa: T2DPointArray; len1, len2: integer);
var
h, l, i: integer;
c: T2DPointArray;
begin
h := high(atpa);

for i := 0 to h do
begin
l := length(atpa[i]);

if (not (inRange(l, len1, len2))) then
begin
setLength(c, length(c) + 1);
c[high(c)] := atpa[i];
end;
end;

atpa := c;
end;

Example:


filterTPAsBetween(ATPA, 1, 650)

That would filter/delete TPA's that have 1-650 points in them

Here is the TPA being debugged:


Now all we have to do is wait for the uptext


Here's the code let me know if you need anything to be explained

{$DEFINE SMART8}
{$i srl/srl.simba}
{$i srl/srl/misc/SmartGraphics.simba}
procedure filterTPAsBetween(var atpa: T2DPointArray; len1, len2: integer);
var
h, l, i: integer;
c: T2DPointArray;
begin
h := high(atpa);

for i := 0 to h do
begin
l := length(atpa[i]);

if (not (inRange(l, len1, len2))) then
begin
setLength(c, length(c) + 1);
c[high(c)] := atpa[i];
end;
end;

atpa := c;
end;
Function FindLadder: Boolean;
var
B: TBox;
TPA,TPA2: TPointArray;
i,CTS,X,Y: Integer;
ATPA: T2DPointArray;
begin
Result := False;

if (not loggedin) then exit;

CTS := GetColorToleranceSpeed;

ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.08, 0.51);
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3032670, MSX1, MSY1, MSX2, MSY2, 12);
SetColorSpeed2Modifiers(0.02, 0.02);
ColorToleranceSpeed(CTS);

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

ATPA := TPAToATPAEx(TPA, 70, 70);
filterTPAsBetween(ATPA, 1, 650)
SortATPAFromFirstpoint(ATPA, Point(MSCX, MSCY));
smart_debugATPA(true,ATPA);
for i := 0 to High(ATPA) do
begin
MiddleTPAEx(ATPA[i], X, Y);
MMouse(X, Y, 6, 6);
if WaitUpTextMulti(['adder','limb'], 300) then
begin
Result := True;
Exit;
end;
end;
end;
begin
SetupSRL;
FindLadder;
end.

partly ripped off of flight.


Thx bro!