SRL Archive - Jr. Member General Help and Discussion

Best OS Walking Method


BigRedJapan

2014-10-01 00:14:41

What is the best Method for Walking, Ive tried SPS, but its been failing on me, I do not know if radial is good, and dtm objects isnt that great. Im on Old School.

ineedbot

2014-10-01 02:25:46

Reflection is by far the best, but I've had a look at AeroLib's SEWalker, I'm getting accuracy to +-3 pixels, and its a color walking method!

samerdl

2014-10-01 11:53:32

Reflection walking is the most accurate and probably easiest to use.

I've used something similar to this:



procedure WaitHumanClick;
begin
case random(600) of
1..450: Wait(RandomRange(600, 800));
451..570: Wait(RandomRange(800, 900));
571..590: Wait(RandomRange(900, 1000));
591..600: Wait(RandomRange(1000, 1200));
end;
end;

function Clickobject(Objpoint: tpoint; Uptext: TStringArray; MaxDistance, RunOffSetX, RunOffsetY: integer): Boolean;
var
Bp, Booth: TPoint;
begin
if (not LoggedIn) then // Failsafe.
Exit; // If not loggedin then it exists the loop.
if R_DistanceFromTile(Objpoint) > MaxDistance then // If your current location is further than the Max distance point for the destination.
begin
Bp.x := Objpoint.x + RunOffsetX; // Grabs the X and Y coords for the object/destination and adds offset to them
Bp.Y := Objpoint.y + RunOffsetY;
R_WalkPath([Bp]); // waits the path.
WaitHumanClick; // Waits a random range..
end;
if R_DistanceFromTile(Objpoint) < 5 then // But if its closer to the obj then it just initiates the click.
begin
Booth := R_TileToMs(ObjPoint); // converts the obj into a coordinate.
MMouse(Booth.X, Booth.Y, 3, 3); // Moves mouse to the coord..
waithumanclick; // waits..
if (R_IsUpTextMulti(Uptext)) then // if uptext..
begin
result := true; // then its true.
end;
end;
end;

In usage..


procedure test1;
begin
if Clickobject(point(CofferX, CofferY), ['Unlock'], randomrange(5,7), randomrange(-2,2),randomrange(2,- 2) then
clickmouse2(mouse_left);
end;

This is what i used mainly for most of my scripts, primarily to my self-nmz booster script and for another script i was trying to work on for NMZ.

Kyle

2014-10-01 14:35:48

Yeah reflection is the easiest and most accurate by far. Here's an excerpt from my Reflection tutorial:

MapWalk:

[INDENT]By far the most important reason that one will choose to use reflection, is the ability that it has to be used for mapwalking features. For the most part, reflection walking "should" be 100% accurate and won't fail. The reason I say "should" is because stuff happens, and it is still good to use failsafes.

The first function is simply
R_WalkPath(Path: TPointArray): boolean;
this function will walk along a path designated by the TPointArray in the parameters. In order to know the points in order to walk, we can use a great tool written by @Turpinator. This tool can be found it reflection/tools. What this does, is when the script is started, each time you enable SMART, a new point is made.

This array of points can then be used with R_WalkPath in order to walk along it.

An example of a path from Varock East bank to the west bank:
R_WalkPath([Point(3245, 3429), Point(3231, 3429), Point(3216, 3428), Point(3206, 3428), Point(3195, 3429), Point(3185, 3429), Point(3184, 3437)]);

It is VERY important to know, each point must be showing on the minimap from the previous point, so you can't "skip" points when making a path.

R_BlindWalk(P: TPoint): Boolean;
This simply, makes a array of points from our current location to the final point, and walks it using R_WalkPath. This is great to use when you need to walk a straight line. It will NOT go around walls/obstacles.

The last MapWalk function is
R_TileOnMM(Tile: TPoint): boolean;
This returns true if the given point is on the Minimap. Usefull mainly for Failsafes.[/INDENT]




You also didn't mention if you wanted to walk on the minimap or mainscreen? The above is for minimap, let me know if you also need help with mainscreen and i'll post up those methods!

Turpinator

2014-10-01 15:17:58

From: elfyyy
It is VERY important to know, each point must be showing on the minimap from the previous point, so you can't "skip" points when making a path.


As a good 'rule of thumb,' keep spots no more than 3-5 tiles away from each other. On a really long path, many points can decrease performance, but no one should ever really be writing a path this long that it would cause a performance hit.

BigRedJapan

2014-10-03 01:43:05

Thank you guys.

Shatterhand

2014-10-03 18:09:04

My custom human like blind walk method. It will try to blind walk to dest and stop if distance is less than maxdist.

procedure R_BlindWalkToTileEx(dest: TPoint; maxdist: Integer);
var
start, middle, P : TPoint;
X, Y : Integer;
begin
if (R_DistanceFromTile(dest) < maxdist+1) then Exit;

repeat
if not LoggedIn then Exit;

if (R_DistanceFromTile(dest) < maxdist+1) then Exit;

P := R_TileToMS(dest);
if not ((P.X = -1) and (P.Y = -1)) then
begin
Wait(RandomRange(500, 1000));
R_WalkToTileMS(dest);
Wait(RandomRange(500, 1000));
end;

if (R_DistanceFromTile(dest) < maxdist+1) then Exit;

P := R_TileToMS(dest);
if (P.X = -1) and (P.Y = -1) then
begin
start := R_GetTileGlobal;

X := dest.X - start.X;
Y := dest.Y - start.Y;

//Writeln('X: ' + ToStr(X));
//Writeln('Y: ' + ToStr(Y));

repeat
if not LoggedIn then Exit;

if (X > 0) then X := X-1;
if (X < 0) then X := X+1;
if (Y > 0) then Y := Y-1;
if (Y < 0) then Y := Y+1;
if (R_WalkToTileMM(Point(start.X+X, start.Y+Y))) then
begin
Flag;
Break;
end;

until False
end;
until False
end;

BigRedJapan

2014-11-02 21:04:25

I am at a this Destination.

  if R_TiletoMM([Point(2037204196 + RandomRange(-1, 1), 185627106 + RandomRange(-1, 1))]) then 

And I want the script to wait until its at this destination before it continues to make its command, but the codeis giving me a mismatch error.

Kyle

2014-11-02 21:27:43

From: Rules of Joe
I am at a this Destination.

  if R_TiletoMM([Point(2037204196 + RandomRange(-1, 1), 185627106 + RandomRange(-1, 1))]) then 

And I want the script to wait until its at this destination before it continues to make its command, but the codeis giving me a mismatch error.


You inputed a TPA, when it uses just a point… Just use if R_NearTile(Point(blah1, blah2), 10) then

Don't use + Random() as it makes it inaccurate.

Btw, I'll reply to your pm tomorrow, busy atm

BigRedJapan

2014-11-02 21:31:31

okay thank you.

So something like this??

  if R_NearTile(Point(2037204196, 185627106), true) then  

Kyle

2014-11-02 21:58:36

From: Rules of Joe
okay thank you.

So something like this??

  if R_NearTile(Point(2037204196, 185627106), true) then  


if R_NearTile(Point(6575, 4234), 10) then