blink
2012-04-15 17:56:22
I am looking for a way to make my bot go back to a default location if it wonders off, any ideas on how to do that?
2012-04-15 17:56:22
2012-04-15 18:24:44
// *****Credit to Sir Eska Eau for crafting most of this function
// * PositionTolerance : Returns true if you are within the tolerance of the
// * point you send in parameter. Usefull if you want to
// * know if you are relatively close to a point.
// *
function PositionTolerance(posX, posY, tolx, toly: Integer): Boolean;
var
Position:TPoint;
begin
Position:= SPS_GetMyPos;
Result:= ((Position.x > (posX - tolx)) and (Position.x < (posX + tolx)) and (Position.y < (posY + toly))
and (Position.y > (posY - toly)));
end;if (not(PositionTolerance({the center of the area you want to be in}, {x-tolerance for this position}, {y-tolerance for this position}) ) then
SPS_WalkToPos(Point({the center of the area you want to be in});2012-04-15 18:25:27
{*
##################################################################################################################
Makes sure your in the right Location Before Calling Fight or Banking Procedures.
##################################################################################################################
*}
Procedure LocationManager;
Var
i, posx, posy:integer;
MyPos:tpoint;
NotInZone:boolean;
begin
if(Banking=False)then
begin
if(Tries>=3)then
begin
Tries:=0;
MyPos := SPS_GetMyPos();
posx:=MyPos.x; posy:=MyPos.y;
if(Debug=True)then
writeln('My Position is ' + inttostr(posx) + ', ' + inttostr(posy));
if(not(Monster='Cow'))then
begin
if(not((Mypos.x>Bounds[0].x) and (Mypos.y>Bounds[0].y) and (Mypos.x<Bounds[1].x) and (Mypos.y<Bounds[1].y)))then
NotInZone:=true; //Zone1
end;
if(NotInZone)then
begin
writeln('Not in zone');
notinzone:=false;
SPS_WalkPath(Monsterpath); //Middle point if out of bounds
LocationManager;
end else
2012-04-15 18:25:43