Page 2 of 17 FirstFirst 123412 ... LastLast
Results 26 to 50 of 418

Thread: Ratinator

  1. #26
    Join Date
    Sep 2008
    Posts
    40
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Progress Report:
    [=========================================================]
    [ Ratinator 1.35                                          ]
    [                      by Bobzilla69                      ]
    [=========================================================]
    [ TimeRunning         : 3 Hours, 9 Minutes And 11 Seconds ]
    [ Active Players      : 3                                 ]
    [ Total Rats Attacked : 737                               ]
    [ Total DeathWalks    : 46                                ]
    [=========================================================]
    [                     Ratinator 1.35                      ]
    [=========================================================]
    [========================================================]
    [ Nick | Active | Rand | Rats Attacked | Deathwalk Count ]
    [========================================================]
    [ aurn | True   |      | 289           | 12              ]
    [ ass  | False  |      | 59            | 2               ]
    [ rer  | True   |      | 190           | 16              ]
    [ ber  | True   |      | 199           | 16              ]
    [========================================================]
    Status: /~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
    Status: |     SRL Randoms Report       |
    Status: |       www.villavu.com        |
    Status: |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
    Status: | SRL Logs          :       17 |
    Status: | Mods Found        :        3 |
    Status: \~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/


    thats with the reflection only fix that you sent.
    might go back to the original script, see if you can stop it from clicking onto another rat while fighting
    Thanks

  2. #27
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yes sure i will try and work on a fix for it once i get some time.

    but happy to see its working well for you

  3. #28
    Join Date
    May 2007
    Location
    Tasmania, Aus
    Posts
    898
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    his this been committed to the SRL stats? I suggested kills as a variable so hopefully this sciprt can be fully functional on there soon! will update post with a proggy soon!!

  4. #29
    Join Date
    Dec 2010
    Location
    New York
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Little suggestion: Have the script stop if certain stats are reached, like the lumbridge fighter.
    SCRAPE - My Blog! All about the music!

  5. #30
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    amazing script. getting from 3 to 13 str right now still going.

    but i was wondering, maybe add a bronze hatchet and timberbox to cut tree, light logs, and cook rat meat. then eat so it dies less, while slowly leveling other skills. just a thought

  6. #31
    Join Date
    May 2007
    Location
    Tasmania, Aus
    Posts
    898
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    that would just make this script too complex probably and hard to maintain for one person :S just make sure your only fighting with three objects in my case a pl8 body, str ammy and rune scimmy.

  7. #32
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bolshak25 View Post
    amazing script. getting from 3 to 13 str right now still going.

    but i was wondering, maybe add a bronze hatchet and timberbox to cut tree, light logs, and cook rat meat. then eat so it dies less, while slowly leveling other skills. just a thought
    the reason i dont do this is because it would cause you to earn less exp per hour but stopping to cut a tree to make fire and cook meat, its more effective to just die, its not a long walk so its fine.

    it also means you are less likely to get random's (my first proggy in front page)

    Quote Originally Posted by sgt soul View Post
    his this been committed to the SRL stats? I suggested kills as a variable so hopefully this sciprt can be fully functional on there soon! will update post with a proggy soon!!
    yes i have added the script and updated part of it only need to add monsters killed and deathwalk then it will be ready once i get the new stats added

    Quote Originally Posted by sgt soul View Post
    that would just make this script too complex probably and hard to maintain for one person :S just make sure your only fighting with three objects in my case a pl8 body, str ammy and rune scimmy.
    its not that complicated to maintain its just not needed, like i said its to damaging to the exp per hour to make it of any use to the script

  8. #33
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    Caught my eye. Instead of clicking on a rat, you might consider doing by quick colorfind followed a rightclick and a menu click -ChooseOption- "Attack Rat". At least back in the old days thats how I grabbed quickly moving objects. I even butchered a player to hunt 86 all on kebbits, which are considered on of the fastest moving objects.

    Find Rat Color
    Check for Yellow Uptext, or "at", or any other smallest solid hint you can find. (For the Masterfarmerthiever i looked just for a yellow "f")
    if uptext or yellow color, Rightclick and ChooseOption.
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  9. #34
    Join Date
    May 2007
    Location
    Tasmania, Aus
    Posts
    898
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    PHP Code:
    [==========================================================]
    Ratinator 1.35                                           ]
    [                      
    by Bobzilla69                       ]
    [==========================================================]
    TimeRunning         7 Hours12 Minutes And 57 Seconds ]
    Active Players      0                                  ]
    Total Rats Attacked 2311                               ]
    Total DeathWalks    3                                  ]
    [==========================================================]
    [                      
    Ratinator 1.35                      ]
    [==========================================================] 
    worked pretty good, it counted kills when it miss clicked the rat though :/

  10. #35
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by sgt soul View Post
    Progress Report:
    [==========================================================]
    [ Ratinator 1.35                                           ]
    [                      by Bobzilla69                       ]
    [==========================================================]
    [ TimeRunning         : 7 Hours, 12 Minutes And 57 Seconds ]
    [ Active Players      : 0                                  ]
    [ Total Rats Attacked : 2311                               ]
    [ Total DeathWalks    : 3                                  ]
    [==========================================================]
    [                      Ratinator 1.35                      ]
    [==========================================================]


    worked pretty good, it counted kills when it miss clicked the rat though :/
    yes i know about this, will see if i can solve this, also use the [.REPORT][/REPORT] tags (remove the . in first tag) it works better for script reports



    Quote Originally Posted by WT-Fakawi View Post
    Caught my eye. Instead of clicking on a rat, you might consider doing by quick colorfind followed a rightclick and a menu click -ChooseOption- "Attack Rat". At least back in the old days thats how I grabbed quickly moving objects. I even butchered a player to hunt 86 all on kebbits, which are considered on of the fastest moving objects.

    Find Rat Color
    Check for Yellow Uptext, or "at", or any other smallest solid hint you can find. (For the Masterfarmerthiever i looked just for a yellow "f")
    if uptext or yellow color, Rightclick and ChooseOption.
    i all ready do that

    thats the first thing i implemented as i saw it miss clicking alot, it still will do a bit but its alot less

    here is the procedure
    Simba Code:
    Procedure RFAttack;             //idea's and help from other reflection fighters like bbri06's Lumbridge Fighter
    var
    Char : TNPCArray;
    P: TPoint;
    i, x, y:integer;
    begin
      if (not (LoggedIn)) then Exit;
      Char := (SortNPCS(GetNPCS));
      if(Length(Char) = 0)then
        Exit;
      for i := 0 to High(Char) do
      begin                                   //get rat location adn checks its not allready fighting
        if((Char[i].Name = 'Giant rat') and (TileOnMS(Char[i].Tile, 0)) and (not(Char[i].Fighting)))then
          begin
            P := TileToMS(Char[i].Tile, 5);
            if FindColorSpiralTolerance(x, y, MyFindColor('rat', false), P.x - 20, P.y - 20, P.x + 20, P.y +20, 15)then  //Checks rat color here
            begin
              MMouse( x, y , 2, 2);
              If WaitUpTextMulti(['Giant rat', 'iant ra'], 400)then  //not needed but added failsafe   swaped to color version as reflection caused error randomly
              begin
                case Random(10) of
                  0..5:begin                 //simply click rat
                         Mouse( x, y, 2, 2, True);
                         Write('Attacking Rat');
                       end;

                  6..10:begin   //max is 9? no harm having 10   right click choose option attack
                         Mouse( x, y, 2, 2, False);
                         WaitOptionMulti(['ack Gia', 'ack Giant', 'Attack Giant'], 500);
                         Write('Attacking Rat');
                       end;
                end;
                R_Flag;
                Wait(1500+random(800));
                Inc(Players[CurrentPlayer].Integers[0]);  //hold how many rats got killed (can miss click and count as attack)
                Inc(Stats_CustomVars[1]);
                Exit;
              end;
            end;
          end;
      end;
      if RandomCheck then
        if not loggedin then exit;
    end;
    Last edited by Bobzilla69; 01-02-2011 at 12:01 PM.

  11. #36
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    Progress Report:
    [==========================================================]
    [ Ratinator 1.35                                           ]
    [                      by Bobzilla69                       ]
    [==========================================================]
    [ TimeRunning         : 13 Hours, 39 Minutes And 0 Seconds ]
    [ Active Players      : 1                                  ]
    [ Total Rats Attacked : 2508                               ]
    [ Total DeathWalks    : 126                                ]
    [==========================================================]
    [                      Ratinator 1.35                      ]
    [==========================================================]
    [========================================================]
    [ Nick | Active | Rand | Rats Attacked | Deathwalk Count ]
    [========================================================]
    [ min  | True   |      | 2508          | 126             ]
    [========================================================]


    E: 1 to 41 str with this. thats why it dies alot

  12. #37
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bolshak25 View Post
    Progress Report:
    [==========================================================]
    [ Ratinator 1.35                                           ]
    [                      by Bobzilla69                       ]
    [==========================================================]
    [ TimeRunning         : 13 Hours, 39 Minutes And 0 Seconds ]
    [ Active Players      : 1                                  ]
    [ Total Rats Attacked : 2508                               ]
    [ Total DeathWalks    : 126                                ]
    [==========================================================]
    [                      Ratinator 1.35                      ]
    [==========================================================]
    [========================================================]
    [ Nick | Active | Rand | Rats Attacked | Deathwalk Count ]
    [========================================================]
    [ min  | True   |      | 2508          | 126             ]
    [========================================================]


    E: 1 to 41 str with this. thats why it dies alot

    nice progress report.

    this is the best way it works, perfect for low level training and dieing seems to be a good way to avoid randoms

  13. #38
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    im not sure what the timer does though, because i have it set at 200, but its well over that limit in minutes?

  14. #39
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bolshak25 View Post
    im not sure what the timer does though, because i have it set at 200, but its well over that limit in minutes?
    you mean the number in
    Simba Code:
    Integers[2] := 10;       //how long to work for in minutes

    that is the amount of time in minutes for each player to run for. once its finished running for that indicated amount of time it will log the player out and switch to the next.

    it will just keep repeating and not stop till manually stopped, its the way i designed the script

  15. #40
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    ok. thanks. so how long does it stay logged out for? if its short maybe you could add a break time for solo people.

  16. #41
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    it would simply log you out and back in again. i am working on a break system for it which should be out soon.

  17. #42
    Join Date
    Jul 2010
    Posts
    1,115
    Mentioned
    1 Post(s)
    Quoted
    10 Post(s)

    Default

    Progress Report:
    [===========================================================]
    [ Ratinator 1.35                                            ]
    [                       by Bobzilla69                       ]
    [===========================================================]
    [ TimeRunning         : 15 Hours, 47 Minutes And 59 Seconds ]
    [ Active Players      : 1                                   ]
    [ Total Rats Attacked : 2925                                ]
    [ Total DeathWalks    : 136                                 ]
    [===========================================================]
    [                      Ratinator 1.35                       ]
    [===========================================================]
    [========================================================]
    [ Nick | Active | Rand | Rats Attacked | Deathwalk Count ]
    [========================================================]
    [ min  | True   |      | 2925          | 136             ]
    [========================================================]


    failed in leo.
    Exception in Script: Failed to create new thread, code:8

  18. #43
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bolshak25 View Post
    Progress Report:
    [===========================================================]
    [ Ratinator 1.35                                            ]
    [                       by Bobzilla69                       ]
    [===========================================================]
    [ TimeRunning         : 15 Hours, 47 Minutes And 59 Seconds ]
    [ Active Players      : 1                                   ]
    [ Total Rats Attacked : 2925                                ]
    [ Total DeathWalks    : 136                                 ]
    [===========================================================]
    [                      Ratinator 1.35                       ]
    [===========================================================]
    [========================================================]
    [ Nick | Active | Rand | Rats Attacked | Deathwalk Count ]
    [========================================================]
    [ min  | True   |      | 2925          | 136             ]
    [========================================================]


    failed in leo.
    Exception in Script: Failed to create new thread, code:8
    sounds like a problem with the anti randoms.

    Version 1.40 is now available.

    • Added breaking support, script will not break for a set amount of time plus a random amount 0-3 more than told to.
    • Added fast fighting option, can cause it to attack another rat while fighting (work in progress)
    • Working on fixing the amount attacked counter (not fixed yet)

  19. #44
    Join Date
    Dec 2010
    Location
    Hawaii
    Posts
    612
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Does it support Slinger?

  20. #45
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Huthaifah View Post
    Does it support Slinger?
    if its can be equipped, not need ammo, and simply work by clicking on the monster then yes it can

  21. #46
    Join Date
    Dec 2010
    Location
    Hawaii
    Posts
    612
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Okay, thanks.

  22. #47
    Join Date
    Dec 2010
    Location
    Leuven
    Posts
    57
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm trying this with Slinger right now, but it doesn't seem to recognize it when I'm fighting. It keeps clicking other rats.
    And Fast Fighting is set to false. But this is probably not due to the script, but due to reflection?
    Last edited by Furyan; 01-04-2011 at 03:43 PM.

  23. #48
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Good script.. Changed a few things:

    Simba Code:
    program Ratinator;

    {$DEFINE SMART}
    {$i SRL\SRL.scar}
    {$i Reflection\Reflection.simba}
    {$i SRL\SRL\Misc\Debug.simba}
    {$i SRL\SRL\Misc\Reports.simba}
    {$i SRL\SRL\Misc\stats.simba}

    {=========================================================================]
    [                                                                         ]
    [                                                                         ]
    [           NAME        : Ratinator                                       ]
    [           WRITER      : Bobzilla69                                      ]
    [           CATEGORY    : Fighting                                        ]
    [           DESCRIPTION : Fights rats west of Lumbridge and deathwalks    ]
    [           USAGE       : Start in lumbridge courtyard,                   ]
    [                         with weapon and/or armour three items max       ]
    [           NOTES       : I have noticed that the re equiping of items    ]
    [                         can not work correctly for certain items        ]
    [           CONTACT     : PM me on SRL-Forums or post in thread           ]
    [           THANKS      : I would like to Thank the SRL Team for making   ]
    [                         this great system to be utilized by us          ]
    [                         Thanks to bbri06 for letting me use some of     ]
    [                         the functions from Lumbridge Fighter            ]
    [=========================================================================]
    [                              Instructions                               ]
    [=========================================================================]
    [ 1. Have character in Lumbridge castle court with items equiped          ]
    [ 2. Have talked to the Grim Reaper twice (respawning and gravestone)     ]
    [ 3. Fill out DeclarePlayers.                                             ]
    [ (For further instructions on how to fill it out, visit this thread:     ]
    [   [url]http://www.villavu.com/forum/showthread.php?t=5410[/url])        ]
    [ 4. Designed to be used with SMART and Simba                             ]
    [ 5. Start script and enjoy, dont forget to post a proggy!                ]
    [=========================================================================}






    const
      World = 169;         //world to auto on   ( 0 will load random)
      Signed = True;      //signed client(true) or unsigned (false)
      SRLStats_UserID = ''; // Your SRL Stats ID
      SRLStats_Password = ''; // Your SRL Stats Password

      SmartDebugReport = True;  // will paint report on smart (4 players for this to work best)


    var
      DebugTheTPA, Deathwalk:Boolean;
      Time, Report, RunTime, BreakFor:Integer;

    procedure DeclarePlayers;
    var
      I: integer;
    begin
      HowManyPlayers := 5;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 1;

      DebugTheTPA := False; //True if you want to see TPA debug (color only)

     

      for I := 0 to HowManyPlayers - 1 do
        with Players[I] do
        begin
          BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
        end;
    end;

    procedure Write(WhatsHappening:string);
    begin
      Writeln(WhatsHappening);
    end;

    procedure LogoutWhy(Why:string);
    begin
      Write(Why);
      Players[CurrentPlayer].Active := False;
      Logout;
    end;

    //all credit to BobboHobbo for making original version
    procedure PrintSmartReport();
    var
     mx, my, I, B, H, TPH, Numb: Integer;
     yInc: Integer;
     Shadow, Colour: Integer;
     TotalRat, TotalDeathWalk: Integer;
     TTP: TPointArray;
     Canvas: TCanvas;
     TitleBMP, PlayerBMP, TotalBMP: TMufasaBitmap;
     TitleStrings: TStringArray;
     pString: String;
    begin
      SmartSetDebug(True);
      GetClientDimensions(mx,my);
      Colour := clTeal;
      Shadow := $1; // black w/ 1 red.

      {
        Load players.
      }

      PlayerBMP := TMufasaBitmap.create;
      PlayerBMP.SetSize(mx,my);
      PlayerBMP.FastDrawClear(clBlack);
      yInc := 130;
      for I := 0 to HowManyPlayers-1 do
      begin
        TotalRat:= TotalRat + Players[I].Integers[0]; //rats attacked
        TotalDeathWalk:= TotalDeathWalk + Players[I].Integers[1]; //deathwalks

        pString := Players[I].Nick + PadL(inttostr(Players[I].Integers[0]), 22) +
            PadL(inttostr(Players[I].Integers[1]), 22);
        TTP := LoadTextTPA(pString, UpChars, H);
        yInc := yInc + 30;
        Writeln(Length(TTP));
        for B := High(TTP) downto 0 do
        begin
          Numb := ((I + 1) * 13);
          PlayerBMP.FastSetPixel(TTP[b].x + 1, TTP[b].y + Numb + 1 + yInc, Shadow);
          PlayerBMP.FastSetPixel(TTP[b].x, TTP[b].y + Numb + yInc, Colour);
        end;
      end;

      DrawBitmapDebugImg(PlayerBMP.Index);

      {
        Set titles.
      }

      TitleStrings := [
          'Ratinator Version 1.40',
          '',
          'Running Time : '+MsToTime(TimeFromMark(RunTime), Time_Short),
          '', 'Total Rats Attacked : '+Inttostr(TotalRat),
          '',
          'Total Deathwalks : '+Inttostr(TotalDeathWalk),
          '',
          'Players         Rats     DeathWalk'];
      TitleBMP := TMufasaBitmap.create;
      TitleBMP.SetSize(mx,my);
      TitleBMP.FastDrawClear(clBlack);
      TPH := High(TitleStrings);
      for I := 0 to TPH do
      begin
        TTP := LoadTextTPA(TitleStrings[i], UpChars, H);
        for B := High(TTP) downto 0 do
        begin
          Numb := ((I + 1) * 13);
          TitleBMP.FastSetPixel(TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
          TitleBMP.FastSetPixel(TTP[b].x, TTP[b].y + Numb, Colour);
        end;
      end;

      Canvas := TCANVAS.Create;
      Canvas.Handle := SmartGetDebugDC;
      TotalBMP := TMufasaBitmap.create;
      TotalBMP.SetSize(mx,my);

      // draw the bitmaps. Both onto the total, then only one visible draw.
      TitleBMP.SetTransparentColor(clBlack);
      PlayerBMP.SetTransparentColor(clBlack);
      TitleBMP.FastDrawTransparent(MIX1+5, MIY1, TotalBMP);
      PlayerBMP.FastDrawTransparent(MIX1+5, MIY1+130, TotalBMP);
      TotalBMP.DrawToCanvas(0, 0, Canvas);

      // clean up.
      TitleBMP.Free;
      PlayerBMP.Free;
      TotalBMP.Free;
    end;

    procedure ProgressReport;
    var
    I, TotalRat, TotalDeathWalk:Integer;
    begin
      Writeln('');
      TotalRat:= 0;       //initilise them as clean variables
      TotalDeathWalk:= 0;
      for I := 0 to HowManyPlayers - 1 do
      begin
        TotalRat:= TotalRat + Players[I].Integers[0]; //rats attacked
        TotalDeathWalk:= TotalDeathWalk + Players[I].Integers[1]; //deathwalks
      end;
      SRLProgressReport(ResultDebugBox, 'Ratinator', 'Bobzilla69', '1.40',
                        ['TimeRunning', 'Active Players', 'Total Rats Attacked', 'Total DeathWalks'],
                        [MsToTime(TimeFromMark(RunTime), Time_Formal), PlayersActive , TotalRat, TotalDeathWalk]);
      SRLPlayerReport( ResultDebugBox, 0, false, [False, False, False, False, False, True], ['Rats Attacked', 'Deathwalk Count'], [], [0, 1], [], [] );
      SRLRandomsReport;
      Writeln('');
      Writeln('Please post bugs and report at [url]http://villavu.com/forum/showthread.php?t=60296');[/url]
      Writeln('');
      Stats_Commit;
      SendSRLReport;
    end;

    function MyFindColor(What:string; Where:boolean):integer;   //on minimap(true) or main screen (false)   might not need where clause
    var
      I, J, TheColor, Red, Green, Blue, color,
      bL, bH, gL, gH, rL, rH, colTol: integer;
      colorArray: TPointArray;
    begin
      case lowercase(What) of
        'floor': begin
                  color := 8883341;
                  bL := 130;
                  bH := 139;
                  gL := 135;
                  gH := 144;
                  rL := 137;
                  rH := 144;
                  colTol:= 7;
                end;
        'tree': begin
                  color := 1388355;
                  bL := 16;
                  bH := 25;
                  gL := 43;
                  gH := 50;
                  rL := 63;
                  rH := 71;
                  colTol:= 6;
                end;
        'rat': begin
                 color := 4605769;
                 bL := 67;
                 bH := 72;
                 gL := 69;
                 gH := 73;
                 rL := 71;
                 rH := 75;
                 colTol:= 3;
               end;
      end;
      Result := 0;

      if Where then
        FindColorsSpiralTolerance(MMCX, MMCY, colorArray, color, MMX1, MMY1, MMX2, MMY2, colTol) //search from center outwards
      else
        FindColorsSpiralTolerance(MSCX, MSCY, colorArray, color, MSX1, MSY1, MSX2, MSY2, colTol);

      J := High(colorArray);
      for I := 0 to J do
        if ((rs_OnMinimap(colorArray[I].x, colorArray[I].y)) or (not (Where))) then
        begin
          TheColor := GetColor(colorArray[i].x, colorArray[i].y);
          ColorToRGB(TheColor, Red, Green, Blue);
          if (InRange(Blue, bL, bH) and InRange(Green, gL, gH) and InRange(Red, rL, rH)) then
          begin
            Result := TheColor;
            //WriteLn(What + ' Colour Found: ' + IntToStr(TheColor));   //not really needed
            Exit;
          end;
        end;
    end;

    function FindRandoms: Boolean; //copied findnormalrandoms from antirandoms include and edited out FindDead so i can do deathwalking.
    var
      I: Byte;
      Cont : boolean;
    begin
      if (SRL_OnFindRandomCall <> nil) then
      begin;
        Result := SRL_OnFindRandomCall(cont);
        if not Cont then
          exit;
      end;
      for I := 1 to 7 do
      begin
        case I of
          1: Result := SolveTeleportRandoms;
          2: Respond;
          3: Result := FindLamp(LampSkill);
          4: Result :=  RC;
          5: Result := FindMod;
          6: if (SRL_Procs[srl_OnRandomCall] <> nil) then
               SRL_Procs[srl_OnRandomCall]();
          7: Result := UseRewardBox;
        end;
        if (Result) then
        begin
          if (SRL_Procs[srl_OnFindRandom] <> nil) then
            SRL_Procs[srl_OnFindRandom]();
          Break;
        end;
      end;
    end;

    function RandomCheck : Boolean;    //thanks mormonman for giveing me this idea and help
    var I : Integer;
    begin
      for I := 0 to 1 do
      begin
        case I of
          0: begin
               if Players[CurrentPlayer].Booleans[0] then Result := R_FindRandoms;
             end;
          1: Result := FindRandoms;
        end;
        if Result then Exit;
      end;
    end;

    procedure AntiBan;
    var
      MousePos: TPoint;
    begin
      if RandomCheck then
        if not loggedin then exit;
      GetMousePos(MousePos.x, MousePos.y);

      case random(100) of
        0..4: PickupMouse;
        20..24: HoverSkill('random', False);
        40..44: GameTab(RandomRange(tab_Combat, tab_Notes));
        60..64: Wait(500 + Random(1500));
        80..84: RandomAngle(1);
      end;

      GameTab(Tab_Inv);
      MMouse(MousePos.x, MousePos.y, 2, 2);
    end;

    Function Dead:Boolean;  //basicly finddead from antirandoms except it wont log you out
    var                        //also added reflection check tile distance  using DistanceFrom(Tiles[High(Tiles)]) < 6) from WalkPath
    x, y:Integer;
    begin
      Result:=False;
      If Players[CurrentPlayer].Booleans[0] then
      begin
        if (DistanceFrom(Tile(3195, 3210)) > 15)then
        begin
          Write('Player died, Starting deathwalk');
          DeathWalk:=True;
          Result:=True;
        end;
      end else
      if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dear', SmallChars, Nothing) then
        if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dead', SmallChars, Nothing) then
        begin
          Write('Might be dead Double checking');
          if FindSymbol(x, y, 'axe shop') or FindSymbol(x, y, 'rest') or (CountColor(1179390, 579, 57, 673, 135)<= 10) then
          begin
            Write('Player died, Starting deathwalk');
            DeathWalk:=True;
            Result:=True;
          end;
        end;
    end;

    procedure RFWalk;
    var
    Tiles:TTileArray;
    begin
      if (not (LoggedIn)) then Exit;
      Write('Walking to rats');
      Tiles := [Tile(3216, 3207), Tile(3202, 3215), Tile (3195, 3206)];
      WalkPath(Tiles);
      Write('Walking complete');
    end;

    Procedure RFAttack;             //idea's and help from other reflection fighters like bbri06's Lumbridge Fighter
    var
    Char : TNPCArray;
    P: TPoint;
    i, x, y:integer;
    begin
      if (not (LoggedIn)) then Exit;
      Char := (SortNPCS(GetNPCS));
      if(Length(Char) = 0)then
        Exit;
      for i := 0 to High(Char) do
      begin                                   //get rat location adn checks its not allready fighting
        if((Char[i].Name = 'Giant rat') and (TileOnMS(Char[i].Tile, 0)) and (not(Char[i].Fighting)))then
          begin
            P := TileToMS(Char[i].Tile, 5);
            if FindColorSpiralTolerance(x, y, MyFindColor('rat', false), P.x - 20, P.y - 20, P.x + 20, P.y +20, 15)then
            begin
              MMouse( x, y , 2, 2);
              If WaitUpTextMulti(['Giant rat', 'iant ra'], 400)then  //not needed but added failsafe   swaped to color version as reflection caused error randomly
              begin
                case Random(10) of
                  0..5:begin                 //simply click rat
                         Mouse( x, y, 2, 2, True);
                         Write('Attacking Rat');
                       end;

                  6..10:begin   //max is 9? no harm having 10   right click choose option attack
                         Mouse( x, y, 2, 2, False);
                         WaitOptionMulti(['ack Gia', 'ack Giant', 'Attack Giant'], 500);
                         Write('Attacking Rat');
                       end;
                end;
                R_Flag;
                Wait(1200+random(800));
                Inc(Players[CurrentPlayer].Integers[0]);  //hold how many rats got killed (can miss click and count as attack)
                stats_IncVariable('Giant Rats Killed', 1);
                Exit;
              end;
            end;
          end;
      end;
      if RandomCheck then
        if not loggedin then exit;
    end;

    Procedure ColorAttack;
    var
      x, y, i, ii: Integer;
      RatTPA: TPointArray;
      RatATPA: T2dPointArray;
    begin
      if (not (LoggedIn)) then Exit; //if not logged in exit
      Write('Attempting to Find Rat');
      FindColorsSpiralTolerance(MSCX, MSCY, RatTPA, MyFindColor('rat', False), MSX1, MSY1, MSX2, MSY2, 5);
      RatATPA := SplitTPAEx(RatTPA, 10, 10);    //TPAtoATPAex( 20, 20)
      if Length(RatATPA) = 0 then Exit;   //if the split returns nothing TreeATPA will be empty so
      SortATPAFromFirstPoint(RatATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point
      if DebugTheTPA then
      begin
        DebugATPA(RatATPA, '');
      end;
      ii := High(RatATPA);
      for i := 0 to ii do  //from 0 first entry in array to ii highest entry
      begin
        MiddleTPAEx(RatATPA[i], x, y);//find middle of array entry
        MMouse(x, y, 3, 3);
        Wait(100);
        if WaitUpTextMulti(['Giant rat', 'iant ra'], 400) then
        begin
          case Random(10) of
            0..5:begin                 //simply click rat
                   Mouse( x, y, 2, 2, True);
                   Write('Attacking Rat');
                 end;

            6..10:begin   //max is 9? no harm having 10   right click choose option attack
                    Mouse( x, y, 2, 2, False);
                    WaitOptionMulti(['ack Gia', 'ack Giant', 'Attack Giant'], 500);
                    Write('Attacking Rat');
                  end;
          end;
          Flag;
          Wait(1500 + Random(800));
          Inc(Players[CurrentPlayer].Integers[0]); //hold how many rats got killed (can miss click and count as attack)
          stats_IncVariable('Giant Rats Killed', 1);
          Exit;
        end;
      end;
      if RandomCheck then
        if not loggedin then exit;
    end;

    Function FastFighting:Boolean;
    var
    i:integer;
    begin
    write('Checking for Fight')
      if Players[CurrentPlayer].Booleans[0] then
      begin
        if(GetAnimation > -1)then
          Result := True
        else
          for i := 0 to 160 do
          begin
            Wait(11);
            if(GetAnimation > -1)then
            begin
              Result := True;
              wait(200 + random(200));
              Exit;
            end;
          end;
      end else
            Result := False;   //as we use this and srl_InFight when reflection is broken we auto make it true
    end;

    Function Fighting:Boolean;   //from bbri06's Lumbridge Fighter changed slightly
    var
    i:integer;
    begin
    write('Checking for Fight')
      if Players[CurrentPlayer].Booleans[0] then
      begin
        if(GetAnimation > -1)then
          Result := True
        else
          for i := 0 to 40 do
          begin
            Wait(5);
            if(GetAnimation > -1)then
            begin
              Result := True;
              Exit;
            end;
          end;
      end else
            Result := False;   //as we use this and srl_InFight when reflection is broken we auto make it true
    end;

    Procedure Attack;
    begin
      if (not (LoggedIn)) then Exit;
      if Players[CurrentPlayer].Booleans[0] then   //checks if we are using reflection
      begin
        RFAttack;
      end else
            ColorAttack;
      repeat
        if Players[CurrentPlayer].Booleans[1] then break; //fast fighting
        Wait(1000+Random(1000));
        if Dead then Exit;
        AntiBan;
      until((not Fighting) or (not(srl_InFight)))
      if Players[CurrentPlayer].Booleans[1] then
      begin
        write('Attempting to Fast Fight');
        repeat
          if Dead then Exit;
          Wait(800 +Random(800));
        until(not FastFighting)
      end;
      if SmartDebugReport then
        printSmartReport();

      if (TimeFromMark(Report)>=(300000))then       //does progress report every 5 minutes
      begin
        MarkTime(Report);
        ProgressReport;
      end;
      if RandomCheck then
        if not loggedin then exit;
    end;

    Function ClickCheck(x, y, xH, xL, yH, yL:integer):Boolean; //checks expected area is clicked.
    begin
      if (not (LoggedIn)) then Exit;
      if ((InRange( x, xL, xH))and(InRange( y, yL, yH)))then   //checks it falls in a expected area
      begin
        Mouse(x, y, 2, 2, True);
        Flag;
        Wait(800+Random(800));
        Result:= True;
      end else
            Result:= False;
    end;

    Function Walking(Location:integer):boolean;     //make a case of where to walk
    var
    MiddleOfTPA: TPoint;
    TPA : TPointArray;

    begin
      if (not (LoggedIn)) then Exit;
      Result:=False;

      case (Location) of
        1: begin
             Write('Starting to walk to Rats');
             if FindColorsPie(TPA, MyFindColor('floor', true), 15, 200, 250, 50, 70, mmx1, mmy1, mmcx, mmy2, mmcx, mmcy) then     //dungeon symbol color
             begin
               MiddleOfTPA:= MiddleTPA(TPA);
               if (DebugTheTPA) then
                 DebugTPA(TPA, '');
               if ClickCheck(MiddleOfTPA.x + 5, MiddleOfTPA.y + 18, 598, 578, 144, 130) then
               begin
                 Result:= True;
                 Write('Walking Step '+IntToStr(Location)+' Complete');
               end else
                     LogoutWhy('Walking failed step '+IntToStr(Location)+', Logging Out');
             end;
           end;
        2: begin
             if FindColorsPie(TPA, MyFindColor('floor', true), 15, 270, 330, 50, 70, mmx1, mmy1, mmcx, mmy2, mmcx, mmcy) then     //dungeon symbol color
             begin
               MiddleOfTPA:= MiddleTPA(TPA);
               if (DebugTheTPA) then
                 DebugTPA(TPA, '');
               if ClickCheck(MiddleOfTPA.x + 2, MiddleOfTPA.y + 2, 598, 570, 50, 30) then
               begin
                 Result:= True;
                 Write('Walking Step '+IntToStr(Location)+' Complete');
               end else
                     LogoutWhy('Walking failed step '+IntToStr(Location)+', Logging Out');
             end;
           end;
        3: begin
             if FindColorsPie(TPA, MyFindColor('tree', true), 15, 180, 200, 5, 45, mmx1, mmy1, mmcx, mmy2, mmcx, mmcy) then     //dungeon symbol color
             begin
               MiddleOfTPA:= MiddleTPA(TPA);
               if (DebugTheTPA) then
                 DebugTPA(TPA, '');
               if ClickCheck(MiddleOfTPA.x - 12, MiddleOfTPA.y + 18, 620, 585, 140, 90) then
               begin
                 Result:= True;
                 Write('Walking Step '+IntToStr(Location)+' Complete');
               end else
                     LogoutWhy('Walking failed step '+IntToStr(Location)+', Logging Out');
             end;
           end;
      end;    //case end
    end;

    procedure EquipItems;    //needs work will blindly click items atm
    var
    i,x,y:integer;
    Item:TBox;
    begin
      if (not (LoggedIn)) then Exit;
      Write('Searching for Items to wear');
      for i:= 1 to 4 do
      begin
        if ExistsItem(i)then
        begin
          Item:= InvBox(i);
          MouseBox(Item.x1, Item.y1, Item.x2, Item.y2, 3);
          if WaitUpTextMulti(['Wield', 'Wear'], 400) then
          begin
            GetMousePos(x,y);
            mouse(x,y,2,2,true);
          end;
          Wait(800+random(800));
        end;
      end;
    end;

    procedure CheckLogged;
    var
    Break:Integer;
    begin
      if (TimeFromMark(Time)>=(Players[CurrentPlayer].Integers[2]*60000))then
      begin
        Write('Script has working for the indicated amount of time, swiching player');
        ProgressReport;
        if (PlayersActive > 0) then  //will perform a break after each player completes there loop
        begin
          BreakFor:= (Players[CurrentPlayer].Integers[4] + Random(3));
          Write('Performing a break for : '+MsToTime((BreakFor*60000), Time_Formal));
          Wait(10000); //waits ten seconds needed to insure it loggs out
          Logout;
          MarkTime(Break);
          repeat
            Wait(30000)   //half a second then writes remaining time
            Write('Waiting For Another : '+MsToTime((BreakFor*60000)-TimeFromMark(Break), Time_Formal));
          until(TimeFromMark(Break) > BreakFor*60000)
          Write('Break Finished');
        end;
        NextPlayer(True);
        MarkTime(Time); //resets timer so new player can work for set amount of time
      end;
      if (not (LoggedIn)) then
      begin
        Write('Player not logged in Switching to next');
        Write('Choosing Next Player');
        Players[CurrentPlayer].Active := False;
        Logout;  //set current player to false
      end;
    end;

    procedure SetFight(i:integer);    //will add check to not click if allready clicked.
    begin
      GameTab(tab_Combat);
      case i of
        1:begin
            if (CountColor(1711219, 307, 299, 338, 315) >= 10)then    //to get rid of auto setup screen at login
            begin
              MouseBox(578, 258, 631, 288, 1);
              Wait(500+Random(800));
            end;
          end;
        2:begin
            if (CountColor(1711219, 307, 299, 338, 315) >= 10)then    //to get rid of auto setup screen at login
            begin
              MouseBox(658, 258, 713, 288, 1);
              Wait(500+Random(800));
            end;
          end;
        3:begin
            if (CountColor(1711219, 307, 299, 338, 315) >= 10)then    //to get rid of auto setup screen at login
            begin
              MouseBox(577, 313, 629, 339, 1);
              Wait(500+Random(800));
            end;
          end;
      end;
      GameTab(tab_Inv);
    end;

    procedure Main;
    var
    i:integer;
    begin
      repeat
        Loginplayer;
        Wait(800+random(500));
        SetAngle(True);
        //SetFight(Players[CurrentPlayer].Integers[3]);
        SetFightMode(Players[CurrentPlayer].Integers[3]);
        RunEnergy(20);
        MarkTime(Report); //counter to allow regular reporting

        if Players[CurrentPlayer].Booleans[0] then
        begin
          RFWalk;
        end else
        begin
          for i:=1 to 3 do
          begin
            Walking(i);
          end;
          Write('Walking Complete');
        end;
        repeat
          Attack;
          if (not (LoggedIn)) then Break;  //checks if logged in and if not breaks out of loop
        until((Dead)or(TimeFromMark(Time)>=(Players[CurrentPlayer].Integers[2]*60000)));
        CheckLogged;    //checks if loggedin and if not set current player to false and logs new player
        if (DeathWalk) then
        begin
          DeathWalk:= False;
          SetAngle(True);
          EquipItems;
          Inc(Players[CurrentPlayer].Integers[1]); //deathwalk
          //Inc(Stats_CustomVars[2]);
          ProgressReport;
          Main;
        end;
      until(AllPlayersInactive)
    end;



    procedure Setup;
    begin
      SetupSRLStats(7, SRLStats_UserID, SRLStats_Password);
      Smart_Server := World;
      Smart_Signed := Signed;
      SetupSRL;
      DeclarePlayers;
      if Players[CurrentPlayer].Booleans[0] then //checks reflection is usable
      begin
        if (not (SmartGetFieldInt(0, hook_static_LoginIndex) = -1)) then
        begin
          Write('Reflection is usable');
        end else
        begin
          Players[CurrentPlayer].Booleans[0]:= False;
          Write('Reflection not working, using color');
        end;
      end;
    end;

    Procedure ScriptTerminate;
    Begin
      ProgressReport;
      Write('All Players Inactive Ending Script');
      TerminateScript;
    End;

    begin
      Setup;
      MarkTime(RunTime);  //total running time
      MarkTime(Time); //starts timing script so players get timed and can switch.
      Main;
      if AllPlayersInactive then ScriptTerminate;   //allows a final progress report before ending.
    end.

    I suggest doing a diff and checking them out.

    The fighting is slightly buggy.. it misses a lot. Also, it does not realise its in fight. I will post up a proggy later on.

    I fixed your blind clicking for equipping, by the way
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  24. #49
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Nava2 View Post
    Good script.. Changed a few things:

    Simba Code:
    program Ratinator;

    {$DEFINE SMART}
    {$i SRL\SRL.scar}
    {$i Reflection\Reflection.simba}
    {$i SRL\SRL\Misc\Debug.simba}
    {$i SRL\SRL\Misc\Reports.simba}
    {$i SRL\SRL\Misc\stats.simba}

    {=========================================================================]
    [                                                                         ]
    [                                                                         ]
    [           NAME        : Ratinator                                       ]
    [           WRITER      : Bobzilla69                                      ]
    [           CATEGORY    : Fighting                                        ]
    [           DESCRIPTION : Fights rats west of Lumbridge and deathwalks    ]
    [           USAGE       : Start in lumbridge courtyard,                   ]
    [                         with weapon and/or armour three items max       ]
    [           NOTES       : I have noticed that the re equiping of items    ]
    [                         can not work correctly for certain items        ]
    [           CONTACT     : PM me on SRL-Forums or post in thread           ]
    [           THANKS      : I would like to Thank the SRL Team for making   ]
    [                         this great system to be utilized by us          ]
    [                         Thanks to bbri06 for letting me use some of     ]
    [                         the functions from Lumbridge Fighter            ]
    [=========================================================================]
    [                              Instructions                               ]
    [=========================================================================]
    [ 1. Have character in Lumbridge castle court with items equiped          ]
    [ 2. Have talked to the Grim Reaper twice (respawning and gravestone)     ]
    [ 3. Fill out DeclarePlayers.                                             ]
    [ (For further instructions on how to fill it out, visit this thread:     ]
    [   [url]http://www.villavu.com/forum/showthread.php?t=5410[/url])        ]
    [ 4. Designed to be used with SMART and Simba                             ]
    [ 5. Start script and enjoy, dont forget to post a proggy!                ]
    [=========================================================================}






    const
      World = 169;         //world to auto on   ( 0 will load random)
      Signed = True;      //signed client(true) or unsigned (false)
      SRLStats_UserID = ''; // Your SRL Stats ID
      SRLStats_Password = ''; // Your SRL Stats Password

      SmartDebugReport = True;  // will paint report on smart (4 players for this to work best)


    var
      DebugTheTPA, Deathwalk:Boolean;
      Time, Report, RunTime, BreakFor:Integer;

    procedure DeclarePlayers;
    var
      I: integer;
    begin
      HowManyPlayers := 5;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 1;

      DebugTheTPA := False; //True if you want to see TPA debug (color only)

     

      for I := 0 to HowManyPlayers - 1 do
        with Players[I] do
        begin
          BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
        end;
    end;

    procedure Write(WhatsHappening:string);
    begin
      Writeln(WhatsHappening);
    end;

    procedure LogoutWhy(Why:string);
    begin
      Write(Why);
      Players[CurrentPlayer].Active := False;
      Logout;
    end;

    //all credit to BobboHobbo for making original version
    procedure PrintSmartReport();
    var
     mx, my, I, B, H, TPH, Numb: Integer;
     yInc: Integer;
     Shadow, Colour: Integer;
     TotalRat, TotalDeathWalk: Integer;
     TTP: TPointArray;
     Canvas: TCanvas;
     TitleBMP, PlayerBMP, TotalBMP: TMufasaBitmap;
     TitleStrings: TStringArray;
     pString: String;
    begin
      SmartSetDebug(True);
      GetClientDimensions(mx,my);
      Colour := clTeal;
      Shadow := $1; // black w/ 1 red.

      {
        Load players.
      }

      PlayerBMP := TMufasaBitmap.create;
      PlayerBMP.SetSize(mx,my);
      PlayerBMP.FastDrawClear(clBlack);
      yInc := 130;
      for I := 0 to HowManyPlayers-1 do
      begin
        TotalRat:= TotalRat + Players[I].Integers[0]; //rats attacked
        TotalDeathWalk:= TotalDeathWalk + Players[I].Integers[1]; //deathwalks

        pString := Players[I].Nick + PadL(inttostr(Players[I].Integers[0]), 22) +
            PadL(inttostr(Players[I].Integers[1]), 22);
        TTP := LoadTextTPA(pString, UpChars, H);
        yInc := yInc + 30;
        Writeln(Length(TTP));
        for B := High(TTP) downto 0 do
        begin
          Numb := ((I + 1) * 13);
          PlayerBMP.FastSetPixel(TTP[b].x + 1, TTP[b].y + Numb + 1 + yInc, Shadow);
          PlayerBMP.FastSetPixel(TTP[b].x, TTP[b].y + Numb + yInc, Colour);
        end;
      end;

      DrawBitmapDebugImg(PlayerBMP.Index);

      {
        Set titles.
      }

      TitleStrings := [
          'Ratinator Version 1.40',
          '',
          'Running Time : '+MsToTime(TimeFromMark(RunTime), Time_Short),
          '', 'Total Rats Attacked : '+Inttostr(TotalRat),
          '',
          'Total Deathwalks : '+Inttostr(TotalDeathWalk),
          '',
          'Players         Rats     DeathWalk'];
      TitleBMP := TMufasaBitmap.create;
      TitleBMP.SetSize(mx,my);
      TitleBMP.FastDrawClear(clBlack);
      TPH := High(TitleStrings);
      for I := 0 to TPH do
      begin
        TTP := LoadTextTPA(TitleStrings[i], UpChars, H);
        for B := High(TTP) downto 0 do
        begin
          Numb := ((I + 1) * 13);
          TitleBMP.FastSetPixel(TTP[b].x + 1, TTP[b].y + Numb + 1, Shadow);
          TitleBMP.FastSetPixel(TTP[b].x, TTP[b].y + Numb, Colour);
        end;
      end;

      Canvas := TCANVAS.Create;
      Canvas.Handle := SmartGetDebugDC;
      TotalBMP := TMufasaBitmap.create;
      TotalBMP.SetSize(mx,my);

      // draw the bitmaps. Both onto the total, then only one visible draw.
      TitleBMP.SetTransparentColor(clBlack);
      PlayerBMP.SetTransparentColor(clBlack);
      TitleBMP.FastDrawTransparent(MIX1+5, MIY1, TotalBMP);
      PlayerBMP.FastDrawTransparent(MIX1+5, MIY1+130, TotalBMP);
      TotalBMP.DrawToCanvas(0, 0, Canvas);

      // clean up.
      TitleBMP.Free;
      PlayerBMP.Free;
      TotalBMP.Free;
    end;

    procedure ProgressReport;
    var
    I, TotalRat, TotalDeathWalk:Integer;
    begin
      Writeln('');
      TotalRat:= 0;       //initilise them as clean variables
      TotalDeathWalk:= 0;
      for I := 0 to HowManyPlayers - 1 do
      begin
        TotalRat:= TotalRat + Players[I].Integers[0]; //rats attacked
        TotalDeathWalk:= TotalDeathWalk + Players[I].Integers[1]; //deathwalks
      end;
      SRLProgressReport(ResultDebugBox, 'Ratinator', 'Bobzilla69', '1.40',
                        ['TimeRunning', 'Active Players', 'Total Rats Attacked', 'Total DeathWalks'],
                        [MsToTime(TimeFromMark(RunTime), Time_Formal), PlayersActive , TotalRat, TotalDeathWalk]);
      SRLPlayerReport( ResultDebugBox, 0, false, [False, False, False, False, False, True], ['Rats Attacked', 'Deathwalk Count'], [], [0, 1], [], [] );
      SRLRandomsReport;
      Writeln('');
      Writeln('Please post bugs and report at [url]http://villavu.com/forum/showthread.php?t=60296');[/url]
      Writeln('');
      Stats_Commit;
      SendSRLReport;
    end;

    function MyFindColor(What:string; Where:boolean):integer;   //on minimap(true) or main screen (false)   might not need where clause
    var
      I, J, TheColor, Red, Green, Blue, color,
      bL, bH, gL, gH, rL, rH, colTol: integer;
      colorArray: TPointArray;
    begin
      case lowercase(What) of
        'floor': begin
                  color := 8883341;
                  bL := 130;
                  bH := 139;
                  gL := 135;
                  gH := 144;
                  rL := 137;
                  rH := 144;
                  colTol:= 7;
                end;
        'tree': begin
                  color := 1388355;
                  bL := 16;
                  bH := 25;
                  gL := 43;
                  gH := 50;
                  rL := 63;
                  rH := 71;
                  colTol:= 6;
                end;
        'rat': begin
                 color := 4605769;
                 bL := 67;
                 bH := 72;
                 gL := 69;
                 gH := 73;
                 rL := 71;
                 rH := 75;
                 colTol:= 3;
               end;
      end;
      Result := 0;

      if Where then
        FindColorsSpiralTolerance(MMCX, MMCY, colorArray, color, MMX1, MMY1, MMX2, MMY2, colTol) //search from center outwards
      else
        FindColorsSpiralTolerance(MSCX, MSCY, colorArray, color, MSX1, MSY1, MSX2, MSY2, colTol);

      J := High(colorArray);
      for I := 0 to J do
        if ((rs_OnMinimap(colorArray[I].x, colorArray[I].y)) or (not (Where))) then
        begin
          TheColor := GetColor(colorArray[i].x, colorArray[i].y);
          ColorToRGB(TheColor, Red, Green, Blue);
          if (InRange(Blue, bL, bH) and InRange(Green, gL, gH) and InRange(Red, rL, rH)) then
          begin
            Result := TheColor;
            //WriteLn(What + ' Colour Found: ' + IntToStr(TheColor));   //not really needed
            Exit;
          end;
        end;
    end;

    function FindRandoms: Boolean; //copied findnormalrandoms from antirandoms include and edited out FindDead so i can do deathwalking.
    var
      I: Byte;
      Cont : boolean;
    begin
      if (SRL_OnFindRandomCall <> nil) then
      begin;
        Result := SRL_OnFindRandomCall(cont);
        if not Cont then
          exit;
      end;
      for I := 1 to 7 do
      begin
        case I of
          1: Result := SolveTeleportRandoms;
          2: Respond;
          3: Result := FindLamp(LampSkill);
          4: Result :=  RC;
          5: Result := FindMod;
          6: if (SRL_Procs[srl_OnRandomCall] <> nil) then
               SRL_Procs[srl_OnRandomCall]();
          7: Result := UseRewardBox;
        end;
        if (Result) then
        begin
          if (SRL_Procs[srl_OnFindRandom] <> nil) then
            SRL_Procs[srl_OnFindRandom]();
          Break;
        end;
      end;
    end;

    function RandomCheck : Boolean;    //thanks mormonman for giveing me this idea and help
    var I : Integer;
    begin
      for I := 0 to 1 do
      begin
        case I of
          0: begin
               if Players[CurrentPlayer].Booleans[0] then Result := R_FindRandoms;
             end;
          1: Result := FindRandoms;
        end;
        if Result then Exit;
      end;
    end;

    procedure AntiBan;
    var
      MousePos: TPoint;
    begin
      if RandomCheck then
        if not loggedin then exit;
      GetMousePos(MousePos.x, MousePos.y);

      case random(100) of
        0..4: PickupMouse;
        20..24: HoverSkill('random', False);
        40..44: GameTab(RandomRange(tab_Combat, tab_Notes));
        60..64: Wait(500 + Random(1500));
        80..84: RandomAngle(1);
      end;

      GameTab(Tab_Inv);
      MMouse(MousePos.x, MousePos.y, 2, 2);
    end;

    Function Dead:Boolean;  //basicly finddead from antirandoms except it wont log you out
    var                        //also added reflection check tile distance  using DistanceFrom(Tiles[High(Tiles)]) < 6) from WalkPath
    x, y:Integer;
    begin
      Result:=False;
      If Players[CurrentPlayer].Booleans[0] then
      begin
        if (DistanceFrom(Tile(3195, 3210)) > 15)then
        begin
          Write('Player died, Starting deathwalk');
          DeathWalk:=True;
          Result:=True;
        end;
      end else
      if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dear', SmallChars, Nothing) then
        if FindTextTPA(0, 0, MCX1, MCY1, MCX2, MCY2, 'dead', SmallChars, Nothing) then
        begin
          Write('Might be dead Double checking');
          if FindSymbol(x, y, 'axe shop') or FindSymbol(x, y, 'rest') or (CountColor(1179390, 579, 57, 673, 135)<= 10) then
          begin
            Write('Player died, Starting deathwalk');
            DeathWalk:=True;
            Result:=True;
          end;
        end;
    end;

    procedure RFWalk;
    var
    Tiles:TTileArray;
    begin
      if (not (LoggedIn)) then Exit;
      Write('Walking to rats');
      Tiles := [Tile(3216, 3207), Tile(3202, 3215), Tile (3195, 3206)];
      WalkPath(Tiles);
      Write('Walking complete');
    end;

    Procedure RFAttack;             //idea's and help from other reflection fighters like bbri06's Lumbridge Fighter
    var
    Char : TNPCArray;
    P: TPoint;
    i, x, y:integer;
    begin
      if (not (LoggedIn)) then Exit;
      Char := (SortNPCS(GetNPCS));
      if(Length(Char) = 0)then
        Exit;
      for i := 0 to High(Char) do
      begin                                   //get rat location adn checks its not allready fighting
        if((Char[i].Name = 'Giant rat') and (TileOnMS(Char[i].Tile, 0)) and (not(Char[i].Fighting)))then
          begin
            P := TileToMS(Char[i].Tile, 5);
            if FindColorSpiralTolerance(x, y, MyFindColor('rat', false), P.x - 20, P.y - 20, P.x + 20, P.y +20, 15)then
            begin
              MMouse( x, y , 2, 2);
              If WaitUpTextMulti(['Giant rat', 'iant ra'], 400)then  //not needed but added failsafe   swaped to color version as reflection caused error randomly
              begin
                case Random(10) of
                  0..5:begin                 //simply click rat
                         Mouse( x, y, 2, 2, True);
                         Write('Attacking Rat');
                       end;

                  6..10:begin   //max is 9? no harm having 10   right click choose option attack
                         Mouse( x, y, 2, 2, False);
                         WaitOptionMulti(['ack Gia', 'ack Giant', 'Attack Giant'], 500);
                         Write('Attacking Rat');
                       end;
                end;
                R_Flag;
                Wait(1200+random(800));
                Inc(Players[CurrentPlayer].Integers[0]);  //hold how many rats got killed (can miss click and count as attack)
                stats_IncVariable('Giant Rats Killed', 1);
                Exit;
              end;
            end;
          end;
      end;
      if RandomCheck then
        if not loggedin then exit;
    end;

    Procedure ColorAttack;
    var
      x, y, i, ii: Integer;
      RatTPA: TPointArray;
      RatATPA: T2dPointArray;
    begin
      if (not (LoggedIn)) then Exit; //if not logged in exit
      Write('Attempting to Find Rat');
      FindColorsSpiralTolerance(MSCX, MSCY, RatTPA, MyFindColor('rat', False), MSX1, MSY1, MSX2, MSY2, 5);
      RatATPA := SplitTPAEx(RatTPA, 10, 10);    //TPAtoATPAex( 20, 20)
      if Length(RatATPA) = 0 then Exit;   //if the split returns nothing TreeATPA will be empty so
      SortATPAFromFirstPoint(RatATPA, Point(MSCX, MSCY)); //sort TPA acording to main screen center point
      if DebugTheTPA then
      begin
        DebugATPA(RatATPA, '');
      end;
      ii := High(RatATPA);
      for i := 0 to ii do  //from 0 first entry in array to ii highest entry
      begin
        MiddleTPAEx(RatATPA[i], x, y);//find middle of array entry
        MMouse(x, y, 3, 3);
        Wait(100);
        if WaitUpTextMulti(['Giant rat', 'iant ra'], 400) then
        begin
          case Random(10) of
            0..5:begin                 //simply click rat
                   Mouse( x, y, 2, 2, True);
                   Write('Attacking Rat');
                 end;

            6..10:begin   //max is 9? no harm having 10   right click choose option attack
                    Mouse( x, y, 2, 2, False);
                    WaitOptionMulti(['ack Gia', 'ack Giant', 'Attack Giant'], 500);
                    Write('Attacking Rat');
                  end;
          end;
          Flag;
          Wait(1500 + Random(800));
          Inc(Players[CurrentPlayer].Integers[0]); //hold how many rats got killed (can miss click and count as attack)
          stats_IncVariable('Giant Rats Killed', 1);
          Exit;
        end;
      end;
      if RandomCheck then
        if not loggedin then exit;
    end;

    Function FastFighting:Boolean;
    var
    i:integer;
    begin
    write('Checking for Fight')
      if Players[CurrentPlayer].Booleans[0] then
      begin
        if(GetAnimation > -1)then
          Result := True
        else
          for i := 0 to 160 do
          begin
            Wait(11);
            if(GetAnimation > -1)then
            begin
              Result := True;
              wait(200 + random(200));
              Exit;
            end;
          end;
      end else
            Result := False;   //as we use this and srl_InFight when reflection is broken we auto make it true
    end;

    Function Fighting:Boolean;   //from bbri06's Lumbridge Fighter changed slightly
    var
    i:integer;
    begin
    write('Checking for Fight')
      if Players[CurrentPlayer].Booleans[0] then
      begin
        if(GetAnimation > -1)then
          Result := True
        else
          for i := 0 to 40 do
          begin
            Wait(5);
            if(GetAnimation > -1)then
            begin
              Result := True;
              Exit;
            end;
          end;
      end else
            Result := False;   //as we use this and srl_InFight when reflection is broken we auto make it true
    end;

    Procedure Attack;
    begin
      if (not (LoggedIn)) then Exit;
      if Players[CurrentPlayer].Booleans[0] then   //checks if we are using reflection
      begin
        RFAttack;
      end else
            ColorAttack;
      repeat
        if Players[CurrentPlayer].Booleans[1] then break; //fast fighting
        Wait(1000+Random(1000));
        if Dead then Exit;
        AntiBan;
      until((not Fighting) or (not(srl_InFight)))
      if Players[CurrentPlayer].Booleans[1] then
      begin
        write('Attempting to Fast Fight');
        repeat
          if Dead then Exit;
          Wait(800 +Random(800));
        until(not FastFighting)
      end;
      if SmartDebugReport then
        printSmartReport();

      if (TimeFromMark(Report)>=(300000))then       //does progress report every 5 minutes
      begin
        MarkTime(Report);
        ProgressReport;
      end;
      if RandomCheck then
        if not loggedin then exit;
    end;

    Function ClickCheck(x, y, xH, xL, yH, yL:integer):Boolean; //checks expected area is clicked.
    begin
      if (not (LoggedIn)) then Exit;
      if ((InRange( x, xL, xH))and(InRange( y, yL, yH)))then   //checks it falls in a expected area
      begin
        Mouse(x, y, 2, 2, True);
        Flag;
        Wait(800+Random(800));
        Result:= True;
      end else
            Result:= False;
    end;

    Function Walking(Location:integer):boolean;     //make a case of where to walk
    var
    MiddleOfTPA: TPoint;
    TPA : TPointArray;

    begin
      if (not (LoggedIn)) then Exit;
      Result:=False;

      case (Location) of
        1: begin
             Write('Starting to walk to Rats');
             if FindColorsPie(TPA, MyFindColor('floor', true), 15, 200, 250, 50, 70, mmx1, mmy1, mmcx, mmy2, mmcx, mmcy) then     //dungeon symbol color
             begin
               MiddleOfTPA:= MiddleTPA(TPA);
               if (DebugTheTPA) then
                 DebugTPA(TPA, '');
               if ClickCheck(MiddleOfTPA.x + 5, MiddleOfTPA.y + 18, 598, 578, 144, 130) then
               begin
                 Result:= True;
                 Write('Walking Step '+IntToStr(Location)+' Complete');
               end else
                     LogoutWhy('Walking failed step '+IntToStr(Location)+', Logging Out');
             end;
           end;
        2: begin
             if FindColorsPie(TPA, MyFindColor('floor', true), 15, 270, 330, 50, 70, mmx1, mmy1, mmcx, mmy2, mmcx, mmcy) then     //dungeon symbol color
             begin
               MiddleOfTPA:= MiddleTPA(TPA);
               if (DebugTheTPA) then
                 DebugTPA(TPA, '');
               if ClickCheck(MiddleOfTPA.x + 2, MiddleOfTPA.y + 2, 598, 570, 50, 30) then
               begin
                 Result:= True;
                 Write('Walking Step '+IntToStr(Location)+' Complete');
               end else
                     LogoutWhy('Walking failed step '+IntToStr(Location)+', Logging Out');
             end;
           end;
        3: begin
             if FindColorsPie(TPA, MyFindColor('tree', true), 15, 180, 200, 5, 45, mmx1, mmy1, mmcx, mmy2, mmcx, mmcy) then     //dungeon symbol color
             begin
               MiddleOfTPA:= MiddleTPA(TPA);
               if (DebugTheTPA) then
                 DebugTPA(TPA, '');
               if ClickCheck(MiddleOfTPA.x - 12, MiddleOfTPA.y + 18, 620, 585, 140, 90) then
               begin
                 Result:= True;
                 Write('Walking Step '+IntToStr(Location)+' Complete');
               end else
                     LogoutWhy('Walking failed step '+IntToStr(Location)+', Logging Out');
             end;
           end;
      end;    //case end
    end;

    procedure EquipItems;    //needs work will blindly click items atm
    var
    i,x,y:integer;
    Item:TBox;
    begin
      if (not (LoggedIn)) then Exit;
      Write('Searching for Items to wear');
      for i:= 1 to 4 do
      begin
        if ExistsItem(i)then
        begin
          Item:= InvBox(i);
          MouseBox(Item.x1, Item.y1, Item.x2, Item.y2, 3);
          if WaitUpTextMulti(['Wield', 'Wear'], 400) then
          begin
            GetMousePos(x,y);
            mouse(x,y,2,2,true);
          end;
          Wait(800+random(800));
        end;
      end;
    end;

    procedure CheckLogged;
    var
    Break:Integer;
    begin
      if (TimeFromMark(Time)>=(Players[CurrentPlayer].Integers[2]*60000))then
      begin
        Write('Script has working for the indicated amount of time, swiching player');
        ProgressReport;
        if (PlayersActive > 0) then  //will perform a break after each player completes there loop
        begin
          BreakFor:= (Players[CurrentPlayer].Integers[4] + Random(3));
          Write('Performing a break for : '+MsToTime((BreakFor*60000), Time_Formal));
          Wait(10000); //waits ten seconds needed to insure it loggs out
          Logout;
          MarkTime(Break);
          repeat
            Wait(30000)   //half a second then writes remaining time
            Write('Waiting For Another : '+MsToTime((BreakFor*60000)-TimeFromMark(Break), Time_Formal));
          until(TimeFromMark(Break) > BreakFor*60000)
          Write('Break Finished');
        end;
        NextPlayer(True);
        MarkTime(Time); //resets timer so new player can work for set amount of time
      end;
      if (not (LoggedIn)) then
      begin
        Write('Player not logged in Switching to next');
        Write('Choosing Next Player');
        Players[CurrentPlayer].Active := False;
        Logout;  //set current player to false
      end;
    end;

    procedure SetFight(i:integer);    //will add check to not click if allready clicked.
    begin
      GameTab(tab_Combat);
      case i of
        1:begin
            if (CountColor(1711219, 307, 299, 338, 315) >= 10)then    //to get rid of auto setup screen at login
            begin
              MouseBox(578, 258, 631, 288, 1);
              Wait(500+Random(800));
            end;
          end;
        2:begin
            if (CountColor(1711219, 307, 299, 338, 315) >= 10)then    //to get rid of auto setup screen at login
            begin
              MouseBox(658, 258, 713, 288, 1);
              Wait(500+Random(800));
            end;
          end;
        3:begin
            if (CountColor(1711219, 307, 299, 338, 315) >= 10)then    //to get rid of auto setup screen at login
            begin
              MouseBox(577, 313, 629, 339, 1);
              Wait(500+Random(800));
            end;
          end;
      end;
      GameTab(tab_Inv);
    end;

    procedure Main;
    var
    i:integer;
    begin
      repeat
        Loginplayer;
        Wait(800+random(500));
        SetAngle(True);
        //SetFight(Players[CurrentPlayer].Integers[3]);
        SetFightMode(Players[CurrentPlayer].Integers[3]);
        RunEnergy(20);
        MarkTime(Report); //counter to allow regular reporting

        if Players[CurrentPlayer].Booleans[0] then
        begin
          RFWalk;
        end else
        begin
          for i:=1 to 3 do
          begin
            Walking(i);
          end;
          Write('Walking Complete');
        end;
        repeat
          Attack;
          if (not (LoggedIn)) then Break;  //checks if logged in and if not breaks out of loop
        until((Dead)or(TimeFromMark(Time)>=(Players[CurrentPlayer].Integers[2]*60000)));
        CheckLogged;    //checks if loggedin and if not set current player to false and logs new player
        if (DeathWalk) then
        begin
          DeathWalk:= False;
          SetAngle(True);
          EquipItems;
          Inc(Players[CurrentPlayer].Integers[1]); //deathwalk
          //Inc(Stats_CustomVars[2]);
          ProgressReport;
          Main;
        end;
      until(AllPlayersInactive)
    end;



    procedure Setup;
    begin
      SetupSRLStats(7, SRLStats_UserID, SRLStats_Password);
      Smart_Server := World;
      Smart_Signed := Signed;
      SetupSRL;
      DeclarePlayers;
      if Players[CurrentPlayer].Booleans[0] then //checks reflection is usable
      begin
        if (not (SmartGetFieldInt(0, hook_static_LoginIndex) = -1)) then
        begin
          Write('Reflection is usable');
        end else
        begin
          Players[CurrentPlayer].Booleans[0]:= False;
          Write('Reflection not working, using color');
        end;
      end;
    end;

    Procedure ScriptTerminate;
    Begin
      ProgressReport;
      Write('All Players Inactive Ending Script');
      TerminateScript;
    End;

    begin
      Setup;
      MarkTime(RunTime);  //total running time
      MarkTime(Time); //starts timing script so players get timed and can switch.
      Main;
      if AllPlayersInactive then ScriptTerminate;   //allows a final progress report before ending.
    end.

    I suggest doing a diff and checking them out.

    The fighting is slightly buggy.. it misses a lot. Also, it does not realise its in fight. I will post up a proggy later on.

    I fixed your blind clicking for equipping, by the way
    Cheers for this, i see what you have done, i havent had much time so its much appreciated that you looked over this.

    I really should have done the paint function like you did,...... dont know why i didnt... also the same for the equipping items. guess i just needed a fresh pair of eye's to look at it thanks a lot for that.

    did you use fast fighting at all? that might be why it misses alot, but i will look at it again to make sure.

    will post an updated script with your changes and some of mine later.

    Edit:

    Simba Code:
    Writeln('Please post bugs and report at [url]http://villavu.com/forum/showthread.php?t=60296');[/url]

    wont compile because of this, the [/url] has to be withing the ' ' of the writeln, is there another way to have it a clickable url?
    Last edited by Bobzilla69; 01-07-2011 at 11:27 AM.

  25. #50
    Join Date
    Apr 2007
    Location
    Colchester, UK
    Posts
    1,220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Version 1.45 is now available

    • Applied changes provided by Nava2 (Thanks for this)
    • Change the way Rat Attacked is detected (needs testing to make sure 1 hitting is counted)
    • Fixed a silly mistake that will automatically set you to fast attacking is reflection is used
    • Changed way fast attacking works (its better now but still got problems)
    • Added New Stats (not functional yet but ready to be activated)

Page 2 of 17 FirstFirst 123412 ... LastLast

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
  •