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?
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?
For positioning recently I've been using this function that Sir Eska Eau created for me in a help thread that I changed a few tidbits on for my needs:
Simba Code:// *****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;
Using an if then statement this could look something like this:
Simba Code: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});
So, this function basically creates a circle/square of sorts (with a radius based on your tolerances, more or less) around a center point for which the function will return true if the character is in the area and false if outside. So when your character is outside the area the if then statement above will be true and using SPS your character will walk back to the center of the area.
Might serve your purposes
SPS Area's for sure it's very simple Here look at a snippet from GhettoBot
Simba Code:{*
##################################################################################################################
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
"Previously known as Leetsxc''
You could you use time...
like
getsystem time < (T)
if (T) = 99999 then
setupSRL;
// you walkpath here
pickonion; // your procedure here
There are currently 1 users browsing this thread. (0 members and 1 guests)