Results 1 to 6 of 6

Thread: [R] spinDo 0.1 - Write entire botting scripts in just a few lines! Your Welcome!

  1. #1
    Join Date
    Nov 2014
    Posts
    1
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default [R] spinDo 0.1 - Write entire botting scripts in just a few lines! Your Welcome!

    I'm new and thought I'd contribute.

    spinDo is a single function that does pretty much everything you'd want from a script in a single function.

    The script makes sure your character has stayed within the pre-defined area (and walks there if not), finds whatever object you're looking for, and performs an action.

    MAKE SURE TO SET CAMERA TO HIGHEST ANGLE

    Simba Code:
    {*******************************************************************************
    Function R_spinDo(objectName, objectAction: String; centerOfRovingArea: TPoint;
                radiusOfRovingArea, searchDistance, howLongToSearch: Integer;)
    By: A Proud American
    Description: Basically an AIO function to reliably search an area for an object
      and perform an action on it. Works best if object isn't moving (non-NPC).
    *******************************************************************************}

    Function R_spinDo(objectName, objectAction: String; centerOfRovingArea: TPoint; radiusOfRovingArea, searchDistance, howLongToSearch: Integer): Boolean;
    var
    Timer: Integer;
    hereWeAre, hereWeAreLooking: TPoint;
    begin
          //Make sure we are within (radiusOfRovingArea) of (centerOfRovingArea)
          if not (R_NearTile(centerOfRovingArea,radiusOfRovingArea)) then
                  begin
                    R_BlindWalk(centerOfRovingArea[ATTACH]24445[/ATTACH]);
                  end;
          //Begin Spinning
          KeyDown(VK_RIGHT);
          //Mark the time we started Spinning
          markTime(Timer);
          //Start Main search Cycle
          repeat
            //Log out current tile
            hereWeAre := R_GetTileGlobal();
            //Move the Mouse to a a random tile within (searchDistance)
            hereWeAreLooking := Point((hereWeAre.x + RandomRange(1, searchDistance)), hereWeAre.y);
            hereWeAreLooking := R_TileToMs(hereWeAreLooking);
            MMouse(hereWeAreLooking.x,hereWeAreLooking.y,10,10);
            Wait(RandomRange(1111, 2222)+RandomRange(1, 555));
          //Continue Spinning until we find the object or we timeout
          until((R_IsUpText(objectName) = true) or (timeFromMark(Timer)>howLongToSearch))
            //Stop Spinning
            KeyUp(VK_RIGHT);
            KeyUp(VK_LEFT);
              //Confirm that object and action are under the mouse
              if(R_IsUpText((objectAction + ' ' + objectName)) = true) then
                begin
                ClickMouse2(Mouse_Right);
                Wait(RandomRange(11, 77)+RandomRange(1, 555));
                R_ChooseOption((objectAction + ' ' + objectName));
                Result := true;
                end else
                  begin
                  Result := false;
                  end;
    end;

    Feel free to include it in any script you want.

    Here's an example of a very stable and short power-woodcutting script that can run for hours if you add in antirandoms.

    Simba Code:
    procedure cutTrees;
    begin
    repeat
    repeat
          //objectName, objectAction, centerOfRovingArea, radiusOfRovingArea, searchDistance, howLongToSearch
          if(R_spinDo('Willow', 'Chop down', Point(2917, 3298), 15, 5, 10000) = true) then
            begin
            //If the above returned true, give the character time to start performing action
            Wait(RandomRange(3333, 5555)+RandomRange(1, 555));
              while (R_IsAnimating = true) do
                begin
                Writeln('Performing Action!');
                Wait(RandomRange(3333, 5555)+RandomRange(1, 555));
                end;
          end;
    until(R_InvCount = 28)
          Writeln('Finished Chopping, Dropping Logs!');
          DropArray([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28]);
          clearDebug;
    until(false);
    end;

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quite interesting. So basically - it moves the camera whilst walking to the object it wants to interact with?

    I can see how that'd be useful, if your desired object isn't on the screen, or is, but invisible at your current camera angle.

    Pretty nice. Thanks for the share!
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  3. #3
    Join Date
    Feb 2006
    Location
    Australia
    Posts
    628
    Mentioned
    15 Post(s)
    Quoted
    105 Post(s)

    Default

    Nice effort but some things you may want to consider:
    Code:
          KeyDown(VK_RIGHT);
    Don't always use the same direction, how about a 50/50 chance for right/left like so:
    Simba Code:
    RightPressed:= false;
    if (Random(2) = 0) then
    begin
      KeyDown(VK_RIGHT);
      RightPressed:= true;
    end else
      KeyDown(VK_LEFT);
    Notice the boolean, that is so that you can tell which KeyUp to use
    Code:
            KeyUp(VK_RIGHT);
            KeyUp(VK_LEFT);
    the correct use of KeyUp is like so:
    Simba Code:
    if (RightPressed) then
    begin
      KeyUp(VK_RIGHT);
    end else
      KeyUp(VK_LEFT);

    Looking over your function some more, I noticed you only add randomRange for the X co-ordinate:
    Code:
            hereWeAreLooking := Point((hereWeAre.x + RandomRange(1, searchDistance)), hereWeAre.y);
    You will likely want it on your Y co-ord as well, but how about making the radius (searchDistance) a box around your player and not just from the center to the east/north, here's something I prepared earlier to show you:
    Simba Code:
    hereWeAreLooking := Point((hereWeAre.x + RandomRange(-searchDistance, searchDistance)), hereWeAre.y + RandomRange(-searchDistance, searchDistance)));
    Not bad for a first attempt, but what is going on with those standards? Neaten it up please!

  4. #4
    Join Date
    Sep 2013
    Posts
    90
    Mentioned
    1 Post(s)
    Quoted
    44 Post(s)

    Default

    Would this work for old school?

  5. #5
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by Qw4rt6yu9 View Post
    Would this work for old school?
    this is only for oldschool since rs3 (simba) doesnt support reflection.

  6. #6
    Join Date
    Sep 2013
    Posts
    90
    Mentioned
    1 Post(s)
    Quoted
    44 Post(s)

    Default

    Quote Originally Posted by hoodz View Post
    this is only for oldschool since rs3 (simba) doesnt support reflection.
    Thanks, been out of the loop for a while.

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
  •