PDA

View Full Version : OGL icon walk issues



Justin69
12-16-2015, 10:46 PM
Hi, I've been working on some scripts over the last few months and after updating OGL yesterday I've been having nightmares trying to get things up and running again.

I've fixed quite a few errors so far but am stuck on one with this IconWalk function.

Is there an easy fix I'm missing or should I update all my walking to use inDirection/TileWalk (or something else)?

Thanks a lot.


Error: Can't assign "record [0]Int32; [4]Int32; [8]Int32; [12]Int32; [16]Int32; [20]record [0]Int32; [4]Int32; [8]Int32; [12]Int32; end; end" to "record [0]Int32; [4]Int32; end" at line 526



function iconWalk(randomization: integer; icon: glTextureArray; offSetTiles: TPoint; maxWait : Integer = 15000): boolean;
var
rx, ry :integer;
closestIcon, pPoint : TPoint;
begin
rx := randomrange(-(randomization), randomization);
ry := randomrange(-(randomization), randomization);
if icon.isEmpty() then
result:=false
else
begin
pPoint := minimap.getScreenPosition(minimap.getLocalPosition ());
closestIcon := icon.closestTo(pPoint)[0];

mouse.click(minimap.getScreenPosition(minimap.getL ocalPosition(closestIcon).adjustposition(offsetTil es.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(maxWait);
exit(true);
end;
exit(false);
end;

Obscurity
12-16-2015, 10:59 PM
closestIcon is a tPoint.
glTextureArray.closestTo(tPoint) returns a sorted glTextureArray.

minimap.getScreenPosition(minimap.getLocalPosition ()) can be replaced by minimap.getPlayer().

Keep in mind, minimap icons are anchored by their bottom-center coord. Therefore walking to the center of the icon, if the map is rotated, will not be accurate. Also, remember you can use Minimap.clickLocalPosition() and just supply the coords.


Great function idea, though!

Justin69
12-17-2015, 04:59 PM
Hi Obscurity,

Thanks for the quick response.

What I'm not understanding is this 'should' return the closest point in the array (and always has before updating ogl), what changed?

closestIcon := icon.closestTo(pPoint)[0];

How do you usually go about walking in your scripts?

Thanks

Obscurity
12-17-2015, 08:25 PM
It used to return a tPointArray. It no longer does. It returns a glTextureArray sorted by distance from the said point.

Depends on the distance of the walk. For example, when botting WC on DarkScape, you spawn directly west or north of the trees when killed. So, I'll used a minimap.clickDirection('east') or minimap.clickDirection('south') until I see a bank icon which I can relate my position to.

Other times, I monitor my localPosition while walking. if it changes by too much, a new map was loaded and I should offset my positions. That's what I did here (volume warning):
https://www.youtube.com/watch?v=eYfH5fJmgEA
Where I told it to walk to the bank, then to the furnace, then to the GE.

Or, as you suggested, icon walk.

Justin69
12-17-2015, 09:55 PM
Awesome, thanks for your help.