SRL Archive - OSR Help

Ladder detecting (picture inside)


Mor

2012-04-05 13:31:57

How can I detect this ladder?


my script to find it doesnt work:

  var Ladder,x,y:integer;
ToArea:TPointArray;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
Ladder := DTMFromString('mwQAAAHic42RgYDBiYmAwAWJDILYGYi0g1gViKyC2BGINIOZlZGD4BlSrwAhhg/B3BgiWZ4TgbGcVBjd9WYaZaQ4MmjLCDKGmsgz+JooMgWZKDHMynBiqg0wYiAGMRGA4AADm/AyO');
repeat
if FindDTM(Ladder, x, y,MSX1, MSY1, MSX2, MSY2) then
begin
Mouse(x, y, 0, 0, true);
end;
until isUpText('lank');

nickrules

2012-04-05 13:51:23

CTS2/DTMs with high tolerance, etc.
Basically, the normal ways.

What about it is hard to detect?

Mor

2012-04-05 13:57:14

From: nickrules
CTS2/DTMs with high tolerance, etc.
Basically, the normal ways.

What about it is hard to detect?


I tried DTM,Pls look the code I'v added.
what is wrong with it?

Abu

2012-04-05 13:58:01

If you can walk to a certain point consistently, then why not just a make a TBox around the door and then make your script find the color within that TBox?


EDIT: then you can put in that TBox co-ordinates instead of MSX1, MSY1, MSX2, MSY2….

Mor

2012-04-05 14:04:33

From: abu_jwka
If you can walk to a certain point consistently, then why not just a make a TBox around the door and then make your script find the color within that TBox?


EDIT: then you can put in that TBox co-ordinates instead of MSX1, MSY1, MSX2, MSY2….


I will try to do it and edit .
Thanks

Abu

2012-04-05 14:06:17

From: Mor
I will try to do it and edit .
Thanks


Here, I wrote up this little explanation for someone else and now I'm gonna post it here too :)

I thought you would say that, first imagine making a box around the door, now make it slightly bigger so that the door would still be in that box if you moved a bit to the left or a bit to the right.

Still got that box image in your head? Good? Now get your color picker tool and click the top left hand corner of your imaginary box. Then click the bottom right-hand corner.

Well done! You should now have four co-ordinates in your debug box, replace them with MSX1, MSY1, MSX2, MSY2 and your box will come to life!

Voila!

Mor

2012-04-05 14:34:39

From: abu_jwka
Here, I wrote up this little explanation for someone else and now I'm gonna post it here too :)


I did it, still doesnt work.

here is the code after the changes:

  var Ladder,x,y:integer;
ToArea:TPointArray;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
repeat
Ladder:= DTMFromString('mrAAAAHic42BgYGBlZGBgAeJfQLYwIwT/BLKFoPQ9IH4PxEeB+BiUD8LvoOJt6S4MgdYKDDNKfRnaMlwYahLsGPrzPBiCbRQZQmwVGQgBRgIYBgASvxJe');
if FindDTM(Ladder, x, y,239, 200, 264, 249) then
begin
Mouse(x, y, 0, 0, true);
end;
until isUpText('lank');

Abu

2012-04-05 14:39:23

Make a bigger box…



EDIT: Check your DTM is working by printing it into the DTM Editor….. sometimes if you reload Runescape the graphics change and the DTM won't be found

iBlank

2012-04-05 14:42:11

Try FindDTMRotated as well.

RISK

2012-04-05 15:00:08

TPAs/ATPAs. You can create specific minimum and maximum pixels to create a very strict way of searching for the object. That would solve it for you.

Mor

2012-04-05 15:09:27

From: abu_jwka
Make a bigger box…



EDIT: Check your DTM is working by printing it into the DTM Editor….. sometimes if you reload Runescape the graphics change and the DTM won't be found


I found 2 problems:
1.when I check it in DTM Editor I see something else highlighted in the
picture ,
far away from the object that I want to find. and I have tried 3 times to make new DTM, and the same problem…
2.when I start the script the mouse doesn't move.
how can I fix it?

Abu

2012-04-05 15:21:01

From: Mor
I found 2 problems:
1.when I check it in DTM Editor I see something else highlighted in the
picture ,
far away from the object that I want to find. and I have tried 3 times to make new DTM, and the same problem…
2.when I start the script the mouse doesn't move.
how can I fix it?


It means you need to make better DTM's. If you still can't make one good enough, I suggest using a different method, TPA's maybe?

Mor

2012-04-05 15:30:10

Finally, I did it with the TPA method. :)
thank you all for the helping!!!
I really appreciate that

x[Warrior]x3500

2012-04-05 15:31:24

From: RISK
TPAs/ATPAs. You can create specific minimum and maximum pixels to create a very strict way of searching for the object. That would solve it for you.


thats what i would suggest also. imo, its the best way of detecting any object on the MS (generally).

nvm u fixed it. good job!

Mor

2012-04-05 15:48:21

Now I need little suggestion from you for the repeat condition. It will continue to find the ladder until what?I cant find any condition for it because there is nothing like uptext after click this ladder.
here is my script and I marked the repeat…until problem:

procedure XXX;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i : Integer;
ToArea:TPointArray;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
[B][SIZE="2"]repeat
FindColorsTolerance(MyTPA, 2772329, 235, 203, 271, 271, 10);
if Length(MyTPA) = 0 then FindColorsTolerance(MyTPA, 3432579, MSX1, MSY1, MSX2, MSY2, 10);
for i := 0 to High(MyTPA)do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if (IsUpTextMultiCustom(['lank'])) then
begin
wait(500);
GetMousePos(x, y);
Mouse(x, y, 2, 2, true);
Wait(500+random(250));
end;
end;
[U][SIZE="3"][COLOR="Red"]until ???[/COLOR][/SIZE][/U][/SIZE][/B]
Wait(350+random(350));
SPS_Setup(runescape_surface,['9_10','8_10']);
ToBananasArea := [Point(3657, 4078), Point(3648, 4076), Point(3634, 4077), Point(3625, 4077), Point(3611, 4077), Point(3597, 4079), Point(3585, 4075), Point(3575, 4071), Point(3567, 4065), Point(3558, 4061), Point(3548, 4059), Point(3534, 4058), Point(3525, 4057), Point(3510, 4055), Point(3501, 4055), Point(3497, 4050), Point(3500, 4043), Point(3502, 4021)];
SPS_WalkPath(ToBananasArea);
wait(1000);
end;

Abu

2012-04-05 15:57:45

until True?

Once it's found it it will stop…

Mor

2012-04-05 16:15:51

From: abu_jwka
until True?

Once it's found it it will stop…



lol thank you.
I didn't know about this function, it makes all very simple :)

nickrules

2012-04-05 16:59:57

From: abu_jwka
until True?

Once it's found it it will stop…


No, that just means it's going to *assume* it got out of the boat.

procedure XXX;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i : Integer;
ToArea:TPointArray;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
[B]repeat
FindColorsTolerance(MyTPA, 2772329, 235, 203, 271, 271, 10);
if Length(MyTPA) = 0 then FindColorsTolerance(MyTPA, 3432579, MSX1, MSY1, MSX2, MSY2, 10);
for i := 0 to High(MyTPA)do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
end;
[COLOR="DarkOrange"]until(IsUpTextMultiCustom(['lank']))[/COLOR]
clickmouse2(mouse_left);[/B]
Wait(350+random(350));
SPS_Setup(runescape_surface,['9_10','8_10']);
ToBananasArea := [Point(3657, 4078), Point(3648, 4076), Point(3634, 4077), Point(3625, 4077), Point(3611, 4077), Point(3597, 4079), Point(3585, 4075), Point(3575, 4071), Point(3567, 4065), Point(3558, 4061), Point(3548, 4059), Point(3534, 4058), Point(3525, 4057), Point(3510, 4055), Point(3501, 4055), Point(3497, 4050), Point(3500, 4043), Point(3502, 4021)];
SPS_WalkPath(ToBananasArea);
wait(1000);
end;

Restructure your loop, now it will loop finding until it sees uptext, break, and then click.

Excuse my standards, I made the edit in-browser.

Mor

2012-04-05 17:15:08

From: nickrules
No, that just means it's going to *assume* it got out of the boat.

procedure XXX;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i : Integer;
ToArea:TPointArray;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
[B]repeat
FindColorsTolerance(MyTPA, 2772329, 235, 203, 271, 271, 10);
if Length(MyTPA) = 0 then FindColorsTolerance(MyTPA, 3432579, MSX1, MSY1, MSX2, MSY2, 10);
for i := 0 to High(MyTPA)do
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
end;
[COLOR="DarkOrange"]until(IsUpTextMultiCustom(['lank']))[/COLOR]
clickmouse2(mouse_left);[/B]
Wait(350+random(350));
SPS_Setup(runescape_surface,['9_10','8_10']);
ToBananasArea := [Point(3657, 4078), Point(3648, 4076), Point(3634, 4077), Point(3625, 4077), Point(3611, 4077), Point(3597, 4079), Point(3585, 4075), Point(3575, 4071), Point(3567, 4065), Point(3558, 4061), Point(3548, 4059), Point(3534, 4058), Point(3525, 4057), Point(3510, 4055), Point(3501, 4055), Point(3497, 4050), Point(3500, 4043), Point(3502, 4021)];
SPS_WalkPath(ToBananasArea);
wait(1000);
end;

Restructure your loop, now it will loop finding until it sees uptext, break, and then click.

Excuse my standards, I made the edit in-browser.


Thank you .
And no problem about your standards,As it doesn't bother me in this case.:)
edit: your fix doesn't work for me,after clicking on the ladder it continues to search.
the True function works good.

And thank you all again.

nickrules

2012-04-05 19:05:17

From: Mor
Thank you .
And no problem about your standards,As it doesn't bother me in this case.:)
edit: your fix doesn't work for me,after clicking on the ladder it continues to search.
the True function works good.

And thank you all again.


That's impossible. It would only click if it was hovering over the object, at which point, it would no longer be searching, because it had broken out of that loop. I'll take a look again at what might be going on, because if it keeps searching, there's something bigger that's wrong.

E: While not directly related to the problem, this should work better:
procedure XXX;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i : Integer;
ToArea:TPointArray;
tobananasarea:tpointarray;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
FindColorsTolerance(MyTPA, 2772329, 235, 203, 271, 271, 10);
if Length(MyTPA) = 0 then
FindColorsTolerance(MyTPA, 3432579, MSX1, MSY1, MSX2, MSY2, 10);

for i := 0 to High(MyTPA)do //hovers over each point in the array the array
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if IsUpTextMultiCustom(['lank']) then
clickmouse2(mouse_left);
break;
end;

Wait(350+random(350));
SPS_Setup(runescape_surface,['9_10','8_10']);
ToBananasArea := [Point(3657, 4078), Point(3648, 4076), Point(3634, 4077), Point(3625, 4077), Point(3611, 4077), Point(3597, 4079), Point(3585, 4075), Point(3575, 4071), Point(3567, 4065), Point(3558, 4061), Point(3548, 4059), Point(3534, 4058), Point(3525, 4057), Point(3510, 4055), Point(3501, 4055), Point(3497, 4050), Point(3500, 4043), Point(3502, 4021)];
SPS_WalkPath(ToBananasArea);
wait(1000);
end;

Mor

2012-04-06 04:25:55

From: nickrules
That's impossible. It would only click if it was hovering over the object, at which point, it would no longer be searching, because it had broken out of that loop. I'll take a look again at what might be going on, because if it keeps searching, there's something bigger that's wrong.

E: While not directly related to the problem, this should work better:
procedure XXX;
var
MyTPA : TPointArray;
MyPoint : TPoint;
x, y, i : Integer;
ToArea:TPointArray;
tobananasarea:tpointarray;
begin
MakeCompass('N');
SetAngle(SRL_ANGLE_HIGH);
FindColorsTolerance(MyTPA, 2772329, 235, 203, 271, 271, 10);
if Length(MyTPA) = 0 then
FindColorsTolerance(MyTPA, 3432579, MSX1, MSY1, MSX2, MSY2, 10);

for i := 0 to High(MyTPA)do //hovers over each point in the array the array
begin
MyPoint := MyTPA[i]
MMouse (MyPoint.x, MyPoint.y, 3, 3);
if IsUpTextMultiCustom(['lank']) then
clickmouse2(mouse_left);
break;
end;

Wait(350+random(350));
SPS_Setup(runescape_surface,['9_10','8_10']);
ToBananasArea := [Point(3657, 4078), Point(3648, 4076), Point(3634, 4077), Point(3625, 4077), Point(3611, 4077), Point(3597, 4079), Point(3585, 4075), Point(3575, 4071), Point(3567, 4065), Point(3558, 4061), Point(3548, 4059), Point(3534, 4058), Point(3525, 4057), Point(3510, 4055), Point(3501, 4055), Point(3497, 4050), Point(3500, 4043), Point(3502, 4021)];
SPS_WalkPath(ToBananasArea);
wait(1000);
end;


Now it works perfect.
Probably the repeat was the problem.
Thank you.