Results 1 to 2 of 2

Thread: [First Script][RSPS] Ardy Knight Picker!

  1. #1
    Join Date
    Dec 2011
    Posts
    445
    Mentioned
    26 Post(s)
    Quoted
    256 Post(s)

    Default [First Script][RSPS] Ardy Knight Picker!

    I've been working on this the past day or so, and Have had allot of help from Sjoe and Officer Barbrady. Thanks again Guys



    This is for an RSPS which i'm not releasing it's name, this is more a of show-off thread and feedback thread I guess.

    I mainly did this just for practice, which i've actually learned allot the past two days about scripting. I actually tried to make a script for OSRS Mining Iron, but didn't have much luck since I wasn't familiar with the 07 include. I ended up giving up on it sadly. The RSPS is a 714 and has graphics almost the same as EoC. It even supports the graphic modes (Safe mode, Software mode, ETC...) so I decided to try and make a script for it, which ended up being quite successful.


    The script will find the Ardy Knight in Ardy (Duh), right click him and pickpocket him. Pretty simple. This script will ALSO eat food (Only supports Rocktails ATM) when it reaches a certain percentage of HP. I made an include JUST for this RSPS. It finds the rocktails using a DTM, and determines the HP using GetMMLevels which I edited it and included it in my include. The only thing I edited really was the Coords, since the client is a slight off versus EoC. Thanks again to Sjoe for helping me with that
    It's pretty stable too, just got a 30 minute proggie (Had to stop it to make this thread :P) with over 500 pick's

    ***************PROGRESS REPORT*************************************
    * Script has run for : 32 Minutes and 32 Seconds
    * You have picpocketed 523 times!
    ************************************************** *****************

    I have one question as well, How can I make the bot / script rotate the camera until it finds the knight if it doesn't?

    My questions are: How can I make this script better? (Don't ask add banking support, I probably will eventually)

    Simba Code:
    Program KnighPP;
    {$I SRL/SRL.Simba}
    {$I RLInclude.Simba}

    Const
     MaxHP = 990;  //Your Total HP
     StartEating         = 24; // This will start eating food at 24% of your total HP
     StopEating          = 90; // This will sttop eating food at 90% of your total HP

    // Figuring out HP Percentages \\
     {
      The HP Orb by the Minimap will start blinking red when you get 20-25%
      below your Health. This should be the same at all levels.

      HP Orb turns yellow at around 50-60% below health
      HP Orb turns green around 80-90% below health

      If you wish to figure out what percentage to use on your own,
      visit [url]http://www.csgnetwork.com/csgpercent.html[/url] and use the
      Calculate The Value Of A Percentage Of A Value Section.
     }

     Var
     PickPockets, RockTail:Integer;

    // ACA for Knight \\
    function KnightColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.19, 0.78);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 11542895, MSX1, MSY1, MSX2, MSY2, 21);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find Knight, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 2.75) and (X <= 26.73) and (Y >= 1.72) and (Y <= 15.51) and (Z >= 7.95) and (Z <= 84.02) then
        begin
          Result := arC[i];
          //Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('Failed to find the Knight');
    end;

    // Find and PickPocket Knight \\
    procedure FindKnight;
      var
      X, Y:Integer;
    begin
     if FindColorTolerance(X, Y, KnightColor, 5, 3, 511, 329, 10) then
      begin
          WriteLn('Found Knight');
          MMouse(x, y, 0, 0);
          ClickMouse2(False);
          wait(2000);
          ChooseOption('Pickpocket Knight');
          wait(250);
          WriteLn('Picked Knight');
          inc(PickPockets);
       end;
    end;

    // Eat Rockatils when low HP \\
    procedure EatFood;
      var
      X, Y, HPLevel, StartEatHP, StopEatHP:Integer;
      ColourString:String;
    begin

      HPLevel := RL_GetMMLevels('hp', ColourString);

        StartEatHP := Round(MaxHP / 100 * StartEating);
        StopEatHP := Round(MaxHP / 100 * StopEating);
      if (HPLevel <= StartEatHP) then   // if the value we get is lower than 20% start eating.
        begin
        Repeat
          if FindDTM(RockTail, X, Y, MIX1, MIY1,MIX2, MIY2) then
          begin
            MMouse(x, y, 0, 0);
            ClickMouse2(True);
            wait(1500);
            WriteLn('Eating Rocktail...');

            HPLevel := RL_GetMMLevels('hp', ColourString);  //Call this again, to get new value
          end else Exit; //Exits the procedure if we CANNOT find food , failsafe.
        Until(HPLevel >= StopEatHP)  // until we get the value of 80%
      end;
    end;

    // Progress Report \\
    procedure ProgressReport;
    begin
    wait(500);
    ClearDebug;
        WriteLn('***************PROGRESS REPORT*************************************');
        WriteLn('* Script has run for : '+ TimeRunning +'');
        WriteLn('* You have picpocketed '+ IntToStr(PickPockets) +' times!');
        WriteLn('*******************************************************************');



    end;

    // Main Loop \\
    begin
    SetupSRL;
    ClearDebug;
    RockTail := DTMFromString('mWAAAAHicY2FgYDjKxMBwEogPA/ERIOZlZGBgB2JBIOYE4vyERIaO0jKGvYuXMDQXFjKgA0Y0DAIADxEJZA==');
      Repeat
        EatFood;
        FindKnight;
        ProgressReport;
      Until (False)
    end.

  2. #2
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    To rotate te camera until it finds the knight, make the knight finding procedure into a function that returns a boolean (true or false) it should return true if it finds it and false if it doesn't. Then you can tell it to rotate the camera until it sees it using a loop. Here's some samples code to give you the idea:
    Simba Code:
    repeat
      RotateLeft //can't remember what the actual procedure for this is or if there is one, you can probably use PressKey or something like that though.
    until(FindKnight);// you should probably have a time out of a few seconds if you don't find it after that just to make sure you don't rotate your camera for an hour :p

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
  •