SRL Archive - General Botting Help

Need help with walking


Trojan_

2011-11-05 16:16:01

How do i code so my character moves to a specific area ingame?

Gu3st...

2011-11-05 16:16:58

There's several different ways to do so. for how long of a distance do you want to walk?

Trojan_

2011-11-05 16:20:58

Hmm, not worldwide, basically a few tiles should do the work, draynor - willow trees?

noidea

2011-11-05 17:33:52

From: Trojan_
Hmm, not worldwide, basically a few tiles should do the work, draynor - willow trees?


With Simba and SRL, you're going to want to change your mindset. You dont want to walk to a certain tile. You want to walk into that area. Area being, a range. You will almost never be able to walk to an exact point.

If you want to walk to the fishing area in draynor, there are a couple of things youll want to look for.

o The Fishing symbol. Will you be able to see the fishing spot symbol from where you are?
o Will looking for the colour of the trees and walking towards that colour be accurate enough?
o What about the water? What if walk towards certain areas of the water on the minimap. We could do some math to help improve accuracy on this.
o Make a bitmap or a dtm of the area and walk to it?

Not necessarily in that order. Before attempting this, you may want to learn the basics if you havent already. TPA's, DTM's, and all that stuff will be important to the success of your script.

Good luck :)

Trojan_

2011-11-05 17:48:46

From: noidea
With Simba and SRL, you're going to want to change your mindset. You dont want to walk to a certain tile. You want to walk into that area. Area being, a range. You will almost never be able to walk to an exact point.

If you want to walk to the fishing area in draynor, there are a couple of things youll want to look for.

o The Fishing symbol. Will you be able to see the fishing spot symbol from where you are?
o Will looking for the colour of the trees and walking towards that colour be accurate enough?
o What about the water? What if walk towards certain areas of the water on the minimap. We could do some math to help improve accuracy on this.
o Make a bitmap or a dtm of the area and walk to it?

Not necessarily in that order. Before attempting this, you may want to learn the basics if you havent already. TPA's, DTM's, and all that stuff will be important to the success of your script.

Good luck :)

The willow tree colour should do the trick, also, i'm new to Colour coding So where should i start with TPA/DTM?
I'm new here since of the crash of Reflection/Injection

Nava2

2011-11-05 18:03:24

Check out a tutorial on DDTMs (Dynamic DTMs) they will work nicely. :)

noidea

2011-11-05 19:12:50

The autocolors are still broken, so if you're planning on using the tree color, FindTreeColor still works.

function FindTreeColor: Integer;
var
TPA, TestTPA: TPointArray;
ATPA: T2DPointArray;
H, S, L: Extended;
i, TestColor, R, G, B, AL: Integer;
BlackListCol: TIntegerArray;
begin
result := -1;
if FindMMColorsSpiralTolerance(TPA, 1528609, 70) then
begin
AL := high(TPA);
For i := 0 to AL do
begin
TestColor := GetColor(TPA[i].x, TPA[i].y);
if not InIntArray(BlackListCol, TestColor) then
begin
ColorToRGB(TestColor, R, G, B);
ColorToHSL(TestColor, H, S, L);
if InRange(R - B, -10, 50) then
if InRange(R - G, -75, -30) then
if InRange(G - B, 50, 88) then
if L < 31.5 then
if GetColor(TPA[i].x - 1, TPA[i].y) = TestColor then
if GetColor(TPA[i].x, TPA[i].y + 1) = TestColor then
if GetColor(TPA[i].x, TPA[i].y - 1) = TestColor then
begin
FindColorsSpiralTolerance(mmcx, mmcy, TestTPA, TestColor, mmx1, mmy1, mmx2, mmy2, 0);
if Length(TestTPA) > 0 then
begin
ATPA := TPAtoATPAEx(TestTPA, 11, 10);
SortATPAFrom(ATPA, Point(mmcx, mmcy));
if not InRange(Length(ATPA[0]), 21, 28) then
if Length(ATPA[0]) < 30 then
if not InRange(Length(ATPA[0]), 8, 10) then
begin
writeln('Tree colour = '+ Inttostr(TestColor));
Result := TestColor;
exit;
end else
begin
ColorToHSL(TestColor, H, S, L);
if L > 24 then
begin
SetArrayLength(BlackListCol, Length(BLackListCol) + 1);
BlackListCol[High(BlackListCol)] := TestColor;
end;
end;
end;
end;
end;
end;
end;
writeln('Couldn''t find tree color!');
Result := -1;
end;

procedure tofish();
var
treetpa, watertpa: tpointarray;
lowest, sym: tpoint;
i, lowy, d, treecol: integer;
begin
if not loggedin then exit;
treecol := findtreecolor;
findcolorstolerance(treetpa, treecol, mmx1, mmy1, mmx2, mmy2, 0);
if (treecol > 0) and (length(treetpa) > 0) then
begin
writeln('Walking to trees via treecolor');
FilterPointsPie(treetpa, 85, 115, 50, 70, mmcx, mmcy);
for i := 0 to high(treetpa) do
if lowest.y < treetpa[i].y then lowest := treetpa[i];
mfnf(lowest.x, lowest.y, 1, 1);
flag;
wait(300+random(300));
end else
begin
writeln('Couldnt find treecolor, attempting to walk to the farthest water spot');
//Hopefully this will do till the autocolors are fixed......
findcolorstolerance(watertpa, 10327174, mmx1, mmy1, mmx2, mmy2, 10);
if length(watertpa) > 0 then
begin
debugtpa(watertpa, 'a');
lowy := 0;
for i := 1 to high(watertpa) do
if watertpa[i].y < watertpa[lowy].y then lowy := i;
mfnf(watertpa[lowy].x-7, watertpa[lowy].y-3, 1, 1);
flag;
wait(300+random(300));
end else
begin
if findsymbol(sym.x, sym.y, 'fish') then
begin
mfnf(sym.x, sym.y-5, 1, 1)
flag;
wait(300+random(300));
end else
begin
writeln('Couldnt get to fishing spot!');
killplayer();
end
end;
end;
end;

That is my walking procedure, please dont copy it, but do learn from it :)

Note: TPA = TPointArray = array of tpoint

tpoint = a set of x and y in one var

var t: tpoint;
t := point(1, 2);
writeln(t.x);
writeln(t.y);

Trojan_

2011-11-05 20:52:21

From: noidea
The autocolors are still broken, so if you're planning on using the tree color, FindTreeColor still works.

function FindTreeColor: Integer;
var
TPA, TestTPA: TPointArray;
ATPA: T2DPointArray;
H, S, L: Extended;
i, TestColor, R, G, B, AL: Integer;
BlackListCol: TIntegerArray;
begin
result := -1;
if FindMMColorsSpiralTolerance(TPA, 1528609, 70) then
begin
AL := high(TPA);
For i := 0 to AL do
begin
TestColor := GetColor(TPA[i].x, TPA[i].y);
if not InIntArray(BlackListCol, TestColor) then
begin
ColorToRGB(TestColor, R, G, B);
ColorToHSL(TestColor, H, S, L);
if InRange(R - B, -10, 50) then
if InRange(R - G, -75, -30) then
if InRange(G - B, 50, 88) then
if L < 31.5 then
if GetColor(TPA[i].x - 1, TPA[i].y) = TestColor then
if GetColor(TPA[i].x, TPA[i].y + 1) = TestColor then
if GetColor(TPA[i].x, TPA[i].y - 1) = TestColor then
begin
FindColorsSpiralTolerance(mmcx, mmcy, TestTPA, TestColor, mmx1, mmy1, mmx2, mmy2, 0);
if Length(TestTPA) > 0 then
begin
ATPA := TPAtoATPAEx(TestTPA, 11, 10);
SortATPAFrom(ATPA, Point(mmcx, mmcy));
if not InRange(Length(ATPA[0]), 21, 28) then
if Length(ATPA[0]) < 30 then
if not InRange(Length(ATPA[0]), 8, 10) then
begin
writeln('Tree colour = '+ Inttostr(TestColor));
Result := TestColor;
exit;
end else
begin
ColorToHSL(TestColor, H, S, L);
if L > 24 then
begin
SetArrayLength(BlackListCol, Length(BLackListCol) + 1);
BlackListCol[High(BlackListCol)] := TestColor;
end;
end;
end;
end;
end;
end;
end;
writeln('Couldn''t find tree color!');
Result := -1;
end;

procedure tofish();
var
treetpa, watertpa: tpointarray;
lowest, sym: tpoint;
i, lowy, d, treecol: integer;
begin
if not loggedin then exit;
treecol := findtreecolor;
findcolorstolerance(treetpa, treecol, mmx1, mmy1, mmx2, mmy2, 0);
if (treecol > 0) and (length(treetpa) > 0) then
begin
writeln('Walking to trees via treecolor');
FilterPointsPie(treetpa, 85, 115, 50, 70, mmcx, mmcy);
for i := 0 to high(treetpa) do
if lowest.y < treetpa[i].y then lowest := treetpa[i];
mfnf(lowest.x, lowest.y, 1, 1);
flag;
wait(300+random(300));
end else
begin
writeln('Couldnt find treecolor, attempting to walk to the farthest water spot');
//Hopefully this will do till the autocolors are fixed......
findcolorstolerance(watertpa, 10327174, mmx1, mmy1, mmx2, mmy2, 10);
if length(watertpa) > 0 then
begin
debugtpa(watertpa, 'a');
lowy := 0;
for i := 1 to high(watertpa) do
if watertpa[i].y < watertpa[lowy].y then lowy := i;
mfnf(watertpa[lowy].x-7, watertpa[lowy].y-3, 1, 1);
flag;
wait(300+random(300));
end else
begin
if findsymbol(sym.x, sym.y, 'fish') then
begin
mfnf(sym.x, sym.y-5, 1, 1)
flag;
wait(300+random(300));
end else
begin
writeln('Couldnt get to fishing spot!');
killplayer();
end
end;
end;
end;

That is my walking procedure, please dont copy it, but do learn from it :)

Note: TPA = TPointArray = array of tpoint

tpoint = a set of x and y in one var

var t: tpoint;
t := point(1, 2);
writeln(t.x);
writeln(t.y);


Nice, what i don't get is how i'm gonna get the co-ordinates? Not 300 which is millisecounds, but x = something etc…, can i make it click an area by x= and y= etc, What does RGB Mean…? I don't get those points

noidea

2011-11-05 21:47:01

From: Trojan_
Nice, what i don't get is how i'm gonna get the co-ordinates? Not 300 which is millisecounds, but x = something etc…, can i make it click an area by x= and y= etc, What does RGB Mean…? I don't get those points


Oh, you can copy paste FindTreeColor into your script. Its an old srl function that still works that was scrapped and the new one doesnt. What I was talking about was the function that walks to the trees/fishing spot ;)

Trojan_

2011-11-06 09:59:53

From: noidea
Oh, you can copy paste FindTreeColor into your script. Its an old srl function that still works that was scrapped and the new one doesnt. What I was talking about was the function that walks to the trees/fishing spot ;)

I'm getting a error by the code, anyway what your trying to tell me is that i should printscreen a area i want to walk edit it, a example is the sea…this colour and make it click there as example?

Trojan_

2011-11-22 18:29:15

Had exams and haven't been online for a while anyway does autocolour work and some guides tell me to printscreen the item and then make it more viable and then attach the code into Simba, i'm not great but i'm learning :s

Echo_

2011-11-22 19:40:10

DDTMs are an effective way of finding areas on the minimap, there's a great tutorial on it here:

http://villavu.com/forum/showthread.php?t=10008

Flight

2011-11-22 21:19:36

I made a very efficient MM symbol-finder and I assume there at Draynor you have both a Bank map symbol for the bank and a tree symbol for the willow area. My function will find the correct symbol you're looking for, give you the X/Y coord of the middle of that symbol and tell you your distance to the symbol. That should cover walking to and from the willows/bank and tell you which one you're near.

If you'd like it let me know.

marpis

2011-11-23 08:06:51

http://villavu.com/forum/showthread.php?t=66266

SPS will walk pretty much anywhere with ease. :)

Here's an example:
program new;
{.include srl/srl.scar}
{.include sps/sps.simba}

// This function will walk you to Draynor willow trees,
// assuming you're only 1 click away
function WalkToWillows: boolean;
begin
Result := SPS_WalkToPos(4155, 3700);
end;

// This function will walk you to Draynor bank,
// assuming you're only 1 click away
function WalkToWillows: boolean;
begin
Result := SPS_WalkToPos(4185, 3670);
end;

{


YOUR OWN PROCEDURES AND FUNCTIONS HERE


}



begin
SetupSRL;
SPS_Setup(RUNESCAPE_SURFACE, ['10_8', '10_9']);

{
YOUR SCRIPTS MAIN EXECUTION HERE
}
end.

You should also learn the concept of DTMs, and make a function that will check if we have arrived at the correct position after walking. If you like, you can also just walk with DTMs, which is prefered over SPS if you're only walking from Draynor bank to Draynor willows, but when you want to write say, an all-locations-in-one-script-woodcutter, SPS makes walking whole lot easier. :)