Results 1 to 3 of 3

Thread: Some walking stuff...

  1. #1
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Some walking stuff...

    Pretty basic, but eh, it's somewhat useful for getting rid of repetitive coding and such...

    The Boolean result on function WalkTo is resulted true if a flag is found at any point during the function.

    SCAR Code:
    {*******************************************************************************
    function DFFlag(Distance: Integer): Boolean;
    By: IceFire908.
    Description: Same as FFlag but waits until flag is present before waiting.
    *******************************************************************************}


    function DFFlag(Distance: Integer): Boolean;
    var
      T: LongInt;
    begin
      MarkTime(T);
      while (not ((FlagPresent) or ((TimeFromMark(T)) >= (RandomRange(5000, 7000))))) do
        Wait(RandomRange(100, 200));
      Result := FFlag(Distance);
    end;

    {*******************************************************************************
    function OnMM(Point: TPoint): Boolean;
    By: IceFire908.
    Description: Checks if a point is on the mini-map.
    *******************************************************************************}


    function OnMM(Point: TPoint): Boolean;
    begin
      Result := InCircle(Point.X, Point.Y, MMCX, MMCY, 73);
    end;

    {*******************************************************************************
    function OnMS(Point: TPoint): Boolean;
    By: IceFire908.
    Description: Checks if a point is on the main-screen.
    *******************************************************************************}


    function OnMS(Point: TPoint): Boolean;
    begin
      Result := PointInBox(Point, IntToBox(MSX1, MSY1, MSX2, MSY2));
    end;

    {*******************************************************************************
    function WalkTo(Point: TPoint): Boolean;
    By: IceFire908.
    Description: All purpose walking.
    *******************************************************************************}


    function WalkTo(Point: TPoint): Boolean;
    begin
      if ((OnMS(Point)) or (OnMM(Point))) then
      begin
        if (OnMM(Point)) then
          Mouse(Point.X, Point.Y, 0, 0, True)
        else
        begin
          Mouse(Point.X, Point.Y, 4, 4, False);
          Wait(RandomRange(500, 800));
          ChooseOption('alk');
        end;
        Result := DFFlag(RandomRange(5, 15));
      end
      else
        WriteLn('That point is not on the mini-map or main-screen!');
    end;

  2. #2
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    OnMM - rs_OnMiniMap

    SCAR Code:
    function DFFlag(Distance: Integer): Boolean;
    var
      T: LongInt;
    begin
      MarkTime(T);
      while (not ((FlagPresent) or ((TimeFromMark(T)) >= (RandomRange(5000, 7000))))) do
        Wait(RandomRange(100, 200));
      Result := FFlag(Distance);
    end;

    RandomRange? It doesn't work that way I am afraid, it will very rarely reach the 7000. You do a RandomRange every time you go to the loop.
    Get the int once, then use it for the statement in the while.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  3. #3
    Join Date
    Dec 2006
    Location
    Houston, TX USA
    Posts
    4,791
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    OnMM - rs_OnMiniMap

    SCAR Code:
    function DFFlag(Distance: Integer): Boolean;
    var
      T: LongInt;
    begin
      MarkTime(T);
      while (not ((FlagPresent) or ((TimeFromMark(T)) >= (RandomRange(5000, 7000))))) do
        Wait(RandomRange(100, 200));
      Result := FFlag(Distance);
    end;

    RandomRange? It doesn't work that way I am afraid, it will very rarely reach the 7000. You do a RandomRange every time you go to the loop.
    Get the int once, then use it for the statement in the while.
    Yea I know the result of the function changes every loop but I thought about doing that but then I realized how much It doesn't really matter exactly how long it takes as long as it is somewhat random, I guess if you wanted to:

    SCAR Code:
    function DFFlag(Distance: Integer): Boolean;
    var
      T, MaxWait: LongInt;
    begin
      MaxWait := RandomRange(5000, 7000);
      MarkTime(T);
      while (not ((FlagPresent) or ((TimeFromMark(T)) >= MaxWait))) do
        Wait(RandomRange(100, 200));
      Result := FFlag(Distance);
    end;

    I didn't feel the need for the extra code though since I already got what I wanted for the most part.

    The main purpose of those functions is to support an all purpose standard Walking procedure aka WalkTo.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hex Stuff
    By A G E N T in forum Research & Development Lounge
    Replies: 2
    Last Post: 12-08-2008, 06:40 PM
  2. Help With Radial Walking & Other Stuff
    By tigerskall in forum OSR Help
    Replies: 4
    Last Post: 11-10-2007, 12:49 AM
  3. DTM stuff.
    By CatastrophicDesire in forum OSR Help
    Replies: 8
    Last Post: 07-30-2007, 09:23 AM

Posting Permissions

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