Results 1 to 6 of 6

Thread: Attacking problem

  1. #1
    Join Date
    Dec 2006
    Location
    Australia
    Posts
    698
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default Attacking problem

    Here is my soon to be released fally cow killer, but for some reason the fighting has gone wack?? can some help me out? what have i done wrong?

    Also some criticism on the script would be nice

    SCAR Code:
    program Skinner;
    {
          #####   ##    ##                                      ###
       ######  /#### #####                                       ###
      /#   /  /  ##### #####                        #             ##
     /    /  /   # ##  # ##                        ##             ##
         /  /    #     #                           ##             ##
        ## ##    #     #      /##  ###  /###     ######## /###    ##       /###
        ## ##    #     #     / ###  ###/ #### / ######## / ###  / ##      / #### /
        ## ##    #     #    /   ###  ##   ###/     ##   /   ###/  ##     ##  ###/
        ## ##    #     #   ##    ### ##    ##      ##  ##    ##   ##    ####
        ## ##    #     ##  ########  ##    ##      ##  ##    ##   ##      ###
        #  ##    #     ##  #######   ##    ##      ##  ##    ##   ##        ###
           /     #      ## ##        ##    ##      ##  ##    ##   ##          ###
       /##/      #      ## ####    / ##    ##      ##  ##    /#   ##     /###  ##
      /  #####           ## ######/  ###   ###     ##   ####/ ##  ### / / #### /
     / #   ##                #####    ###   ###     ##   ###   ##  ##/     ###/
     #  #
      ##    #######      /
          /       ###  #/         #
         /         ##  ##        ###
         ##        #   ##         #
          ###          ##
         ## ###        ##  /##  ###   ###  /###   ###  /###     /##  ###  /###
          ### ###      ## / ###  ###   ###/ #### / ###/ #### / / ###  ###/ #### /
            ### ###    ##/   /    ##    ##   ###/   ##   ###/ /   ###  ##   ###/
              ### /##  ##   /     ##    ##    ##    ##    ## ##    ### ##
                #/ /## ##  /      ##    ##    ##    ##    ## ########  ##
                 #/ ## ## ##      ##    ##    ##    ##    ## #######   ##
                  # /  ######     ##    ##    ##    ##    ## ##        ##
        /##        /   ##  ###    ##    ##    ##    ##    ## ####    / ##
       /  ########/    ##   ### / ### / ###   ###   ###   ### ######/  ###
      / #    #####       ##   ##/   ##/   ###   ###   ###   ### #####    ###
      #  #
      #  #
       ##

    Thanks for downloading Me_ntal's skinner, Please email me your progress reports
    [email]thyess@gmail.com[/email] or post them on the thread. Update planned to improve the walking
    and slaughtering of cows. Thanks to pentti, JAD, WT-fawki and anyone at the SRL
    forums.

    To run:
    1. Either start in the bank or the cow field.
    2. Make sure your player is weilding a weapon. (hand combat coming)
    3. Focus and press play.
    4. Post your progress reports and tell me how to improve

                                    ~Mental~
    }


    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Fighting.scar}

    var {counters}
      toll, logd, bankd, xet, killd, KillingAttempts, hidecolor, CColors: integer;
    var {Colors}
      CowColor: array[1..4] of integer;
    var
      HideDTM : integer;

    const cowpatience           = 20000;
    const MissedColor           = 16728128;
    const HitColor              = 192;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := ''; {3-4 letters of your name}
      Players[0].Skill := ''; {Fight Mode, attack, deffence, strength and even}
      Players[0].Active := True; {Use player?}
      Players[0].integer2 := 10; {how many cows?}
    end;

    {======================================================================
                                 Colors
    =======================================================================}


    procedure CowColors;
    begin
      CowColor[1] := 3620687;
      CowColor[2] := 6975347;
      CowColor[3] := 1843500;
      CowColor[4] := 4941444;
      hidecolor := 11185588;
      HideDTM := DTMFromString('78DA63E4676060E06240019B572C67F80FA41' +
           '981F83F10308A021922A86AF66DD902A619A17C460E20218AAAE6' +
           'F2D9B3A86AD881040FAA9A23BB77A1AAE103126CA86A56CE9B8BA' +
           'A460C4870A3AA59B360018A1A0035FE124D');
    end;

    {======================================================================
                                 Randoms
    =======================================================================}

    function FindFastRandoms: Boolean; {By Wt-Fakawi}
    var
      i: Integer;
    begin
      for i := 1 to 8 do
      begin
        case I of
          1: if FindDead then
              Result := True;
          2: if FindMod then
              Result := True;
          3: if FindMime then
              Result := True;
          4: if FindMaze then
              Result := True;
          5: if FindQuiz then
              Result := True;
          6: if FindDemon then
              Result := True;
          7: begin
              if NoGameTab then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'No GameTab';
                Logout;
                Exit;
              end;
            end;
          7: begin
              if InBlack then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'InBlack';
                Logout;
                Exit;
              end;
            end;
          8: RC;
        end;
        wait(1);
      end;
    end;

    procedure RunRandoms;
    begin
      FindFastRandoms;
      FindNormalRandoms;
    end;


    {======================================================================
                                 Anti-Ban
    =======================================================================}


    procedure WereHuman;
    begin
      if not (LoggedIn) then Exit;
        begin
         case Random(31) of
          0: HoverSkill('attack', false);
          5: AlmostLogout;
          10:  begin
              GameTab(1 + Random(12));
              Wait(1500 + Random(500));
              GameTab(4);
              end;
          15: HoverSkill('random', false);
          20: begin
             case random(16) of
               0: TypeSend('Attack lvls?');
               3: TypeSend('Strength levels');
               5: TypeSend('defence lvls');
               7: TypeSend('prayer levels');
               9: TypeSend('hp?');
               11: TypeSend('only a few more');
               13: TypeSend('mooooo');
               15: TypeSend('And to think its' + TheTime);
             end;
           end;
          25: begin
              GameTab(5);
              Wait(1500 + Random(500));
              GameTab(4);
             end;
          30: begin
              GameTab(1);
              Wait(1500 + Random(500));
              GameTab(4);
            end;
        end;
      end
    end;

    {======================================================================
                        Checks If were infight
    =======================================================================}


    Function InFightAt(x, y: Integer):Boolean;
    var
      dx, dy: Integer;
    begin
     if ( FindColor(dx, dy, GreenStatusColor, x - 20, y - 10, x + 20, y + 10) or
          FindColor(dx, dy, RedStatusColor, x - 20, y - 10, x + 20, y + 10)   or
          FindColor(dx, dy, MissedColor, x - 20, y - 10, x + 20, y + 10)   or
          FindColor(dx, dy, HitColor, x - 20, y - 10, x + 20, y + 10) ) then
           Result:=True;
    end;

    {======================================================================
                                Checks Hp Level
    =======================================================================}


    function DangerRange: boolean;
    begin
      if (GetHp <= (4 + Random(3))) then
        Result := True
    end;

    {======================================================================
                                   Get Combat Level
    =======================================================================}


    function getcombatlevelb: integer;
    var
      Curtab, i: integer;
      Cmblvl: string;
    begin
      CurTab := getcurrenttab;
      gametab(1);
      Cmblvl := GetTextAtEx(671, 230, 100, StatChars, False, True, 0, 5, -1, 2, True, tr_Digits);
      if (Trim(Cmblvl) = '') then
        for i := 1 to 5 do
        begin
          Cmblvl := GetTextAtEx(671 + i, 230, 100, StatChars, False, True, 0, 5, -1, 2, True, tr_Digits);
          if (Trim(Cmblvl) <> '') then Exit;
        end;
      if (not (Trim(Cmblvl) = '')) then
        result := StrToInt(Trim(Cmblvl));
      wait(500 + random(200));
      gametab(Curtab);
    end;

    {======================================================================
                                   Player Report
    =======================================================================}


    procedure PlayerReport;
    var i: integer;
    begin
      for I := 0 to HowManyPlayers - 1 do
      begin
        WriteLn(Players[i].Name + ' = ' + booltostr(Players[i].Active));
        WriteLn('Att ' + inttostr(Players[i].level[1]) + ', Str ' + inttostr(Players[i].level[2]) + ', Def ' + inttostr(Players[i].level[3]));
        WriteLn('Cmb ' + inttostr(Players[i].integer1) + ', Hps ' + inttostr(Players[i].level[8]) + ', Pry ' + inttostr(Players[i].level[5]));
        WriteLn('Worked For: ' + IntToStr(Players[i].Worked) + ' min, Killed : ' + IntToStr(Players[i].Killed) + ', Loc: ' + Players[i].loc);
        WriteLn('Banked: ' + IntToStr(Players[i].Banked) + ' loads');
        WriteLn('');
        Writeln('================================================================');
      end
    end;

    {======================================================================
                                   Progress Report
    =======================================================================}


    procedure ProgressReport;
    begin
      writeln('');
      WriteLn('================================================================');
      WriteLn('|                        Me_ntals Skinner                       |');
      Writeln('================================================================');
      Writeln('  Worked For ' + TimeRunning);
      Writeln('  Logged In ' + InttoStr(logd));
      Writeln('  Banked ' + InttoStr(bankd));
      writeln('  Kills  ' + InttoStr(killd));
      Writeln('================================================================');
    end;

    {======================================================================
                                   Introduction
    =======================================================================}


    procedure Introd;
    begin
     repeat
      wait(250);
      cleardebug;
      xet:= xet -1;
      writeln('               Me_ntals Skinner');
      writeln('');
      writeln('             Loading please wait');
      writeln('                      '+inttostr(xet));
     until(xet = 0)
     cleardebug;
     if (xet = 0) then
     writeln('                    Here We ago');
     writeln('                 ~Mentals Skinner~');
    end;

    {======================================================================
                                Even Combat
    =======================================================================}

    procedure evenlevels;
    begin
     GetAllLevels;
     if (Players[CurrentPlayer].level[1] < Players[CurrentPlayer].level[2]) and
        (Players[CurrentPlayer].level[1] < Players[CurrentPlayer].level[3]) then
        begin
        SetFightMode(1);
        exit;
        end;
     if (Players[CurrentPlayer].level[2] < Players[CurrentPlayer].level[1]) and
        (Players[CurrentPlayer].level[2] < Players[CurrentPlayer].level[3]) then
        begin
        SetFightMode(2);
        exit;
        end;
     if (Players[CurrentPlayer].level[3] < Players[CurrentPlayer].level[1]) and
        (Players[CurrentPlayer].level[3] < Players[CurrentPlayer].level[2]) then
        begin
        SetFightMode(3);
        exit;
        end;
    end;

    {======================================================================
                                   Set Combat
    =======================================================================}


    procedure Combattype;
    begin
      if Players[CurrentPlayer].Skill = 'attack' then SetFightMode(1);
      if Players[CurrentPlayer].Skill = 'strength' then SetFightMode(2);
      if Players[CurrentPlayer].Skill = 'defence' then SetFightMode(4);
      if Players[CurrentPlayer].Skill = 'auto' then evenlevels;
    end;

    {======================================================================
                                 Attack Cows
    =======================================================================}


    function SlaughterCow: boolean;
    begin
     KillingAttempts := KillingAttempts +1
     for CColors := 1 to 4 do
      begin
       if FindColorSpiralTolerance(x, y, CowColor[CColors] , MSX1, MSY1, MSX2, MSY2, 10)then
        begin
          mmouse(x, y, 3, 3);
          wait(100+Random(100));
          if IsUpTextMulti('tta','ow','ck C') and
          not(InFightAt(x, y)) then
           begin
            mouse(x, y, 0, 0, true);
            if (InChatMulti('alr', 'und ',' att')) then
              begin
                 Result:=True;
                 Exit;
              end;
              if (InChatMulti('ome', 'one ',' ing')) then
              begin
                 Result:=False;
                 Exit;
              end else
              begin
                Result := True;
                KillingAttempts := 0;
                killd := killd + 1;
                toll := toll + 1;
              end;
              if (KillingAttempts >= 100) then
                begin
                 WriteLn('Too Busy World');
                 terminatescript;
                end;
          end;
        end;
      end;
    end;

    {======================================================================
                          Waits While Attacking Cows
    =======================================================================}


    Procedure patience;
    var cowwait : integer;
    begin
     marktime(cowwait);
     repeat
      WereHuman;
      wait(1000+random(1000));
      if (((TimeFromMark(cowwait) > ((cowpatience/2)+random((cowpatience/2))))) or (DangerRange = True)) then exit;
     until (not(InFight));
    end;

    {======================================================================
                                Collects Hide
    =======================================================================}


    procedure CollectHide;
    begin
     if (FindDTM(HideDTM, x, y,  msx1, msy1, msx2, msy2)) then
      begin
       mmouse(x, y, 3, 3)
       if(isuptext('ick up')) then
        begin
          mouse(x, y, 0, 0, false);
          ChooseOption(x, y, 'ide');
        end;
      end;
    end;

    {======================================================================
                                Walks To bank
    =======================================================================}


    procedure ToBank;
    begin
      if (RadialWalkEx(x, y, MMCX, MMCY, 1732439, 10, 0, 360, 40)) then Mouse(x, y, 5, 5, true);
      flag;
      if (RadialWalkEx(x, y, MMCX, MMCY, 234, 10, 355, 5, 25)) then Mouse(x, y, 5, 5, true);
      flag;
      if (RadialWalkEx(x, y, MMCX, MMCY, 624656, 10, 300, 260, 60)) then Mouse(x, y, 5, 5, true);
      flag;
      if (RadialWalkEx(x, y, MMCX, MMCY, 6776686, 10, 290, 260, 50)) then Mouse(x, y, 5, 5, true);
      flag;
      RadialRoadWalk(findfallyRoadColor, 370, 345, 70, 1, 1);
      flag;
      RadialRoadWalk(findfallyRoadColor, 345, 380, 50, 1, 1);
      flag;
      if (FindSymbol(x, y, 'bank')) then Mouse(x, y, 5, 5, true);
      else
      if (RadialWalkEx(x, y, MMCX, MMCY, 9679545, 10, 345, 380, 50,)) then Mouse(x, y, 5, 5, true);
      flag;
    end;

    {======================================================================
                                Banks Hide
    =======================================================================}


    procedure BankHides;
    var bx, by: integer;
    begin
      if (FindColorTolerance(bx, by, hidecolor, MIX1, MIY1, MIX2, MIY2, 10)) then
      begin
        Mouse(x, y, 1, 1, false);
        Wait(100 + Random(100));
        ChooseOption(x, y, 'All');
        bankd := bankd + 1;
        CloseBank;
      end;
    end;

    {======================================================================
                           Finds and Opens the Bank
    =======================================================================}


    procedure OpenAccount;
    var BBooth, BBooth2, tolran: Integer;
    begin
      BBooth := BitmapFromString(116, 1, 'z78DAADCD310E84301003C02F' +
        '11B2D8DE3224D9FF3FE940A01388205D712EA6B2EC883D2C4CC05' +
        '50F773756667060A3415765144A31AFBE68A1631D48AEA803C58A' +
        '76B33310374313A7A79E34330D9C95399F4260BEC9EDD9066AFB5' +
        'F06BAFC6B57255EE4C050A39E96A4A08B508EBF59506DDF9DCCD8' +
        '01D39B47676043B7F9D411D65F059AD59F3C961364E55F7E00CCD' +
        'E9B3F');
      BBooth2 := BitmapFromString(13, 1, 'z78DA3335333132B2302582347' +
        '204626CA4AB9133108249007EAC107C');
      repeat
        if (findbitmaptolerancein(BBooth, x, y, msx1, msy1, msx2, msy2, tolran)) or
          (findbitmaptolerancein(BBooth2, x, y, msx1, msy1, msx2, msy2, tolran)) then
        begin
          MMouse(x, y, 3, 3)
            Wait(100 + Random(100));
          tolran := tolran + 3;
          if (isuptextmulti('ooth', 'ank', 'nk bo')) then
          begin
            mouse(x, y, 4, 4, false)
              wait(100 + Random(100));
            clickoption('uick', 1);
            freebitmap(BBooth);
            freebitmap(BBooth2);
            wait(100 + Random(100));
            BankHides;
          end;
        end;
      until ((tolran >= 150) or (not (loggedin)))
        if (tolran >= 150) then
      begin
        Players[currentplayer].loc := 'Bank Problem'
          toll := players[currentplayer].integer2
      end;
    end;

    {======================================================================
                              Walks to Field
    =======================================================================}


    procedure ToField;
    begin
      RadialRoadWalk(findfallyRoadColor, 230, 195, 60, 1, 1);
      flag;
      RadialRoadWalk(findfallyRoadColor, 195, 170, 50, 1, 1);
      flag;
      RadialRoadWalk(findfallyRoadColor, 190, 170, 60, 1, 1);
      flag;
      if (FindSymbol(x, y, 'tree')) then Mouse(x, y, 5, 5, true);
      flag;
      {if (RadialWalkEx(x, y, MMCX, MMCY, 624656, 10, 0, 180, 60)) then Mouse(x, y, 5, 5, true);
      flag;}

      if (RadialWalkEx(x, y, MMCX, MMCY, 234, 10, 115, 90, 60)) then Mouse(x, y, 5, 5, true);
      flag;
    end;

    {======================================================================
                             Determines Where we are
    =======================================================================}


    function WereAtBank: Boolean;
    begin
      if FindSymbol(x, y, 'bank') then
      begin
        mouse(x, y, 0, 0, true);
        flag;
        Players[currentplayer].loc := 'bank';
        result := true
      end;
    end;

    function WereAtCows: Boolean;
    begin
      if findcolortolerance(x, y, 1732439, mmx1, mmy1, mmx2, mmy2, 50) then
      begin
        Players[currentplayer].loc := 'field';
        result := true
        WriteLn('were at cows')
      end;
    end;


    {======================================================================
                                   Setup's
    =======================================================================}


    procedure SetupScript;
    begin
      DeclarePlayers;
      CowColors;
      ClearDebug;
      ClearReport;
      CColors := 0;
      toll := 0;
      bankd := 0;
      killd := 0;
      logd := 0;
      Introd;
      wait(1000);
        ActivateClient;
    end;

    procedure SetupPlayer;
    begin
      logd := logd + 1;
      HighestAngle;
      CombatType;
      SetChat('on', 1);
      SetChat('friends', 2);
      SetChat('off', 3);
      MakeCompass('N');
    end;

    {======================================================================
                                   Main Loop
    =======================================================================}


    begin
      SetupSRL;
      xet:=10;
      SetupScript;
      loginplayer;
      repeat
        if (not (LoggedIn)) then loginplayer;
        SetupPlayer
          repeat
          if (WereAtBank = true) then Tofield;
          if (WereAtCows = true) then
          begin
            repeat
              if (SlaughterCow) then
               begin
                patience;
                CollectHide;
                RunRandoms;
                if (DangerRange = True) then break;
               end;
            until ((InvFull))
          end;
          ToBank;
          RunRandoms;
          OpenAccount;
          RunRandoms
          ToField;
          evenlevels;
        until (toll >= Players[CurrentPlayer].integer2)
          if (toll >= Players[CurrentPlayer].integer2) then
        begin
          GetAllLevels;
          Players[currentplayer].integer1 := getcombatlevelb;
          ProgressReport;
          PlayerReport;
          SRLRandomsReport;
          LogOut;
          NextPlayer(True);
          toll := 0;
          SetupPlayer;
        end;
      until False;
    end.

  2. #2
    Join Date
    Apr 2007
    Location
    Finland
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function SlaughterCow: boolean;
    begin
     KillingAttempts := KillingAttempts +1
     for CColors := 1 to 4 do
      begin
       if FindObj(x, y, 'ow' ,CowColor[CColors], 10)then
        begin
          mouse(x, y, 3, 3, true);
          wait(1000+Random(100));
          not(InFightAt(x, y)) then
           begin
            mouse(x, y, 0, 0, true);
            if (InChatMulti('alr', 'und ',' att')) then
              begin
                 Result:=True;
                 Exit;
              end;
              if (InChatMulti('ome', 'one ',' ing')) then
              begin
                 Result:=False;
                 Exit;
              end else
              begin
                Result := True;
                KillingAttempts := 0;
                killd := killd + 1;
                toll := toll + 1;
              end;
              if (KillingAttempts >= 100) then
                begin
                 WriteLn('Too Busy World');
                 terminatescript;
                end;
          end;
        end;
      end;
    end;

    Try to use the FindObj, sry don't have time to check more I'll try to come back if i remember

  3. #3
    Join Date
    Dec 2006
    Location
    Australia
    Posts
    698
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Thanks for the reply, but i soon discovered it was a problem with the loop that finds the cowhides. It still has a bit of work to be done on it. And way on improving it?

  4. #4
    Join Date
    Apr 2007
    Location
    Finland
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    I found the prob:

    procedure CollectHide;
    begin
     if (FindDTM(HideDTM, x, y,  msx1, msy1, msx2, msy2)) then
      begin
       mmouse(x, y, 3, 3)
       if(isuptext('ick up')) then
        begin
          mouse(x, y, 0, 0, false);   // IF STOPS HERE ";"
          ChooseOption(x, y, 'ide');
        end;
      end;
    end;

    And put waits and stuff there, like this:

    SCAR Code:
    procedure CollectHide;
    begin
     Wait(150+random(50));
     if (FindDTM(HideDTM, x, y,  msx1, msy1, msx2, msy2)) then
      begin
       Wait(100+random(50))
       mmouse(x, y, 3, 3)
       Wait(250+random(100))         //If this doesn't work make the time to 500+150
       if(IsUpText('ick')) then
        begin
          Wait(100+random(50))
          mouse(x, y, 0, 0, false)
          Wait(100+random(25))
          ChooseOption(x, y, 'ide')
          Wait(100+random(75))
        end
      end;
    end;

    If this doesn't work just add my MSN (in my sig, and I'll help u. I'm online most of the time.)

    Edit: If this works Id always love to get +rep (I'm not campaining rep, people just forget to give it (h) )

  5. #5
    Join Date
    Sep 2007
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hi,

    i have downloaded a cowhider and now i have to typ a tree color.
    where can i find that color?

    greatz me!

  6. #6
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    A tree color?
    thats most of the time that black pixel in the top of the tree. (on the mini map).
    look on the top of the tree, there ill find a dark pixel that one

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Non rs problem
    By C4rd1n4lCh405 in forum OSR Help
    Replies: 1
    Last Post: 08-24-2008, 03:12 AM
  2. attacking only with two mouse buttons
    By t4q in forum OSR Help
    Replies: 4
    Last Post: 05-20-2008, 01:54 PM
  3. The numbers are attacking me =S
    By Floor66 in forum OSR Help
    Replies: 7
    Last Post: 04-12-2008, 10:43 AM
  4. Attacking??
    By blahum in forum RS3 Outdated / Broken Scripts
    Replies: 3
    Last Post: 09-09-2007, 05:21 PM

Posting Permissions

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