PDA

View Full Version : [OGL] Walking



Ross
06-07-2015, 10:48 PM
So here is the pretty reliable way that I walk with OGL. I use 3 relatively simple functions.


Simple wait while the flag texture is shown on the map.
procedure waitFlag;
begin
wait(250);
while (not ogl.getTextures(1275).isEmpty()) do
wait(500);
end;

Walks via tiles offset from player position.
function tileWalk(randomization: integer; offSetTiles: TPointArray): boolean;
var
rx, ry, i: integer;
begin
for i:=0 to high(offSetTiles) do
begin
rx := randomrange(-(randomization), randomization);
ry := randomrange(-(randomization), randomization);
mouse.click(minimap.getScreenPosition(minimap.getL ocalPosition().adjustposition(offsetTiles[i].x+rx, offsetTiles[i].y+ry)), 1);
if ((offSetTiles[i].y > 20) or (offSetTiles[i].y < -20)) or ((offSetTiles[i].x > 15) or (offSetTiles[i].x < -15)) then
wait(3500)
else
wait(1000);
waitflag;
end;
end;

Walks based on static icons on the minimap.
function iconWalk(randomization: integer; icon: glTextureArray; offSetTiles: TPoint): boolean;
var
rx, ry :integer;
begin
rx := randomrange(-(randomization), randomization);
ry := randomrange(-(randomization), randomization);
if icon.isEmpty() then
result:=false
else
begin
mouse.click(minimap.getScreenPosition(minimap.getL ocalPosition(icon[0]).adjustposition(offsetTiles.x+rx, offsetTiles.y+ry)), 1);
if ((offSetTiles.y > 20) or (offSetTiles.y < -20)) or ((offSetTiles.x > 15) or (offSetTiles.x < -15)) then
wait(3500)
else
wait(1000);
waitflag;
result:=true;
end;
exit(result);
end;



Sample code of the above could look something like this:
function walkToBank(): boolean;
begin
lodestoneTeleport;
pointWalk(2, [[-10, 5], [-15, 0], [-10, -3]]);
if (not iconWalk(1, ogl.getTextures([45052], [4668991]), [5, -1]) then
exit(false);
openBank();
end;

So to break it down, it would click a points on the minimap that are:
[left 10, down 5], [left 15, 0], [left 10, up 3] all with a randomness of 2 tiles (meaning it can go up, down, left, and/or right by a max of 2 tiles)
followed by clicking a point that is [right 5, down 1] of the icon texture of the bank, with a randomness of 1 tile, if the texture exists.


And that's it! Very simple. A couple of notes:

Use randomness liberally in areas where accuracy doesn't matter much
Use iconWalk() to make sure you stay on an exact path, it is much more accurate than tileWalk().
Use failsafes for iconWalk() in case it doesn't find the texture like I did above.
Remember not to offset points wider/higher than your minimap dimensions.
Set the number at the end of mouse.click() to 2 in either function to debug one point at a time, since 2 just hovers the mouse.

Clutch
06-07-2015, 10:53 PM
Apparently I can't rep but this is much better then what I've been doing, thanks!

Ross
06-08-2015, 12:01 AM
Apparently I can't rep but this is much better then what I've been doing, thanks!

You're welcome :)

Swag Bag
07-07-2015, 10:04 PM
This is great, my convoluted walking procedure just became legible! Thanks a ton!

Here's an idea for the waitflag procedure. What if you added a distance between the player dot and the flag, and when the player is close enough it exits, so that it looks less bot like.

Ross
07-09-2015, 01:07 AM
This is great, my convoluted walking procedure just became legible! Thanks a ton!

Here's an idea for the waitflag procedure. What if you added a distance between the player dot and the flag, and when the player is close enough it exits, so that it looks less bot like.

The flag disappears well before the character stops walking, but that's an easy thing to implement.

Swag Bag
07-09-2015, 01:34 AM
How accurate is this? I just wrote a few procedures based on yours during a 10 hour car trip. But we don't have SPS so...

The Mayor
07-09-2015, 06:24 AM
The flag disappears well before the character stops walking, but that's an easy thing to implement.

You could literally use the SPS walkpath code but substitute the TPA for your array of offset points (+ a few small mods).

Swag Bag
07-09-2015, 02:54 PM
You could literally use the SPS walkpath code but substitute the TPA for your array of offset points (+ a few small mods).

I just spend a 13 hour car ride improving and randomizing these procedures and now I hear this? -____-
26356

Clarity
07-09-2015, 02:58 PM
Some walking procedures are in the works for ogLib, where you supply a TPA just like in SPS. No map needed obviously, since ogLib is based on your local position. Until then, Ross' are great.

The Mayor
07-09-2015, 05:43 PM
I just spend a 13 hour car ride improving and randomizing these procedures and now I hear this? -____-
26356

That's some serious coding :biggrin:

The Livid Farmer
07-12-2015, 10:31 PM
As a new coder, thank you all. I am learning a lot from this thread.

Swag Bag
07-13-2015, 06:31 PM
Thanks Clarity;. Does anyone know if this is accurate over long distances? I rewrote this a little bit and I'll be able to test it when I get home later on.

Clarity
07-13-2015, 07:08 PM
Thanks Clarity;. Does anyone know if this is accurate over long distances? I rewrote this a little bit and I'll be able to test it when I get home later on.

It's 100% accurate, as with anything in OGL interception. The TPA you supply though has to be correct. Note that the local position resets every time a new map region is loaded :)

Lama
11-01-2015, 11:06 PM
Not sure if there has been improvements made on this method of walking in ogL, but I'm getting an error in tileWalk saying that the 'click' in 'mouse.click' is an unknown declaration. Not sure how to deal with that.

EDIT: It's caused by including the SRL library.

Ross
11-02-2015, 03:09 AM
Not sure if there has been improvements made on this method of walking in ogL, but I'm getting an error in tileWalk saying that the 'click' in 'mouse.click' is an unknown declaration. Not sure how to deal with that.

EDIT: It's caused by including the SRL library.

All methods that conflict with srl-6 require the type in front
i.e. tmouse.click(), tinventory.getItems(), etc...

I wouldn't use this for walking, use SPS.

Lama
11-02-2015, 03:38 AM
All methods that conflict with srl-6 require the type in front
i.e. tmouse.click(), tinventory.getItems(), etc...

I wouldn't use this for walking, use SPS.

Yeah, I've begun going that route aha, thanks though!