Results 1 to 4 of 4

Thread: Help expand my knowledge

  1. #1
    Join Date
    Dec 2008
    Location
    Ontario, Canada
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help expand my knowledge

    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?

  2. #2
    Join Date
    Jan 2012
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    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

  3. #3
    Join Date
    Jul 2008
    Location
    NSW, Australia
    Posts
    881
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    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

  4. #4
    Join Date
    Feb 2012
    Location
    SRL Jail
    Posts
    1,319
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You could you use time...
    like
    getsystem time < (T)
    if (T) = 99999 then
    setupSRL;
    // you walkpath here
    pickonion; // your procedure here

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •