Results 1 to 2 of 2

Thread: Autfighting problem

  1. #1
    Join Date
    Sep 2007
    Posts
    415
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Autfighting problem

    i am working on a fally cow killer..actually i've already released it, which is probably a bad idea because it's a total POS..

    i basically need to rework my whole killing procedure, her's my script

    SCAR Code:
    program FallyCowCruncher;
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}

    var
    x,y,a,i,CowsKilled,HidesPicked: integer;
    CowColor: array [0..3] of Integer;

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

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Integers[1] :=0; //desired attack
      Players[0].Integers[2] :=50; //desired strength
      Players[0].Integers[3] :=0; //desired defense
      Players[1].Integers[4] :=1; //How many loads before logging
      Players[0].Active := true;

      Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := '';
      Players[1].Integers[1] :=20; //desired attack
      Players[1].Integers[2] :=20; //desired strength
      Players[1].Integers[3] :=0; //desired defense
      Players[1].Integers[4] :=1;
      Players[1].Active := true;


      Players[2].Name := '';
      Players[2].Pass := '';
      Players[2].Nick := '';
      Players[2].Integers[1] :=0; //desired attack
      Players[2].Integers[2] :=0; //desired strength
      Players[2].Integers[3] :=0; //desired defense
      Players[2].Integers[4] :=1;
      Players[2].Active := False;

      Players[3].Name := '';
      Players[3].Pass := '';
      Players[3].Nick := '';
      Players[3].Integers[1] :=0; //desired attack
      Players[3].Integers[2] :=0; //desired strength
      Players[3].Integers[3] :=0; //desired defense
      Players[3].Integers[4] :=1;
      Players[3].Active := False;
    end;

    function AttackMode:boolean;
    var
      i,att,str,def:integer;
    begin
      if not(loggedIn) then exit;
      result:=true;
      if (timefrommark(a)>30000)or(players[currentplayer].skill='') then
      begin
        Mouse(575,183,10,10,true);
        wait(200);
        att:=getskillinfo('attack',false);
        str:=getskillinfo('strength',false);
        def:=getskillinfo('defence',false);
        writeln(inttostr(att)+' attack');
        writeln(inttostr(str)+' strength');
        writeln(inttostr(def)+' defence');
        marktime(a);
        if (lowercasE(players[currentplayer].skill)='attack') then
          if (att<players[currentplayer].integers[1]) then exit else players[currentplayer].skill:='';
        if (lowercasE(players[currentplayer].skill)='strength') then
          if (str<players[currentplayer].integers[2]) then exit else players[currentplayer].skill:='';
        if (lowercasE(players[currentplayer].skill)='defence') then
          if (def<players[currentplayer].integers[3]) then exit else players[currentplayer].skill:='';
        for i:=0 to 0 do
        begin
          if (players[currentplayer].skill='') then
          begin
            if (att<players[currentplayer].integers[1]) then
              if not(players[currentplayer].integers[1]=99) then
              begin
                players[currentplayer].skill:='attack';
                break;
              end;
            if (str<players[currentplayer].integers[2]) then
              if not(players[currentplayer].integers[2]=99) then
              begin
                players[currentplayer].skill:='strength';
                break;
              end;
            if (def<players[currentplayer].integers[3]) then
              if not(players[currentplayer].integers[3]=99) then
              begin
                players[currentplayer].skill:='defence';
                break;
              end;
            if (players[currentplayer].integers[1]=99) then players[currentplayer].skill:='attack';
            if (players[currentplayer].integers[2]=99) then players[currentplayer].skill:='strength';
            if (players[currentplayer].integers[3]=99) then players[currentplayer].skill:='defence';
          end;
        end;
        Mouse(542,183,10,10,true);
        case lowercase(players[currentplayer].skill) of
          'attack': setfightmode(1);
          'strength': setfightmode(2);
          'defence','defense': setfightmode(4);
          else result:=false;
        end;
      end;
    end;

    Procedure Proggy;
    begin
      ClearDebug;
      Writeln('=====================================================================');
      Writeln('FallyCowCruncher has been running for ' + Timerunning);
      Writeln('---------------------------------------');
      Writeln('Your Players have killed ' + inttostr(CowsKilled) + ' Cows');
      Writeln('and Picked up ' + inttostr(hidespicked) + ' CowHides');
      Writeln('');
      for i := 0 to (HowManyPlayers - 1) do
      begin
        if Players[i].Active = true then
        begin
          if players[i].integers[5] > 0 then
          begin
            Writeln(Players[i].name + ' has killed ' + inttostr(players[i].integers[5]) + ' Cows');
          end;
          if players[i].integers[6] > 0 then
          begin
            Writeln('and has picked ' + inttostr(players[i].integers[6]) + ' Hides');
          end;
          Writeln('');
        end;
      end;
      Writeln('====================FallyCowCruncher===================');
    end;

    procedure SetRetaliate(ret:boolean);
    var
     i:integer;
    begin
      if not(loggedIn) then exit;
      gametab(1);
      for i:=1 to 5 do
      begin
        case getColor(600,390) of
          4540745: if ret=true then mouse(600+random(100),370+random(20),0,0,true) else exit;
          1711220: if ret=false then mouse(600+random(100),370+random(20),0,0,true) else exit;
        end;
        wait(200);
      end;
    end;

    Procedure AntiBan;
    begin
      case random(8) of
      3: HoverSkill(players[currentplayer].skill,false);
      5: PickupMouse;
      7: BoredHuman;
      1: findnormalrandoms;
      end;
    end;

    Procedure FightSetup;
    begin
      If not(loggedin) then Exit;
      MakeCompass('s');

      SetRun(true);
      AttackMode;
      SetAngle(True);
      SetRetaliate(true);
      Mouse(643,183,10,10,true);
    end;

    procedure LogIn;
    begin
      if not(loggedin) then LoginPlayer;
      Wait(500);
      FindNormalRandoms;
      MakeCompass('n');
      Mouse(672,482,5,5,true);
      SetRun(false);
      SetBar('Brightness',4);
    end;

      //taken off men_tal's cow killing script
    procedure CollectHide;

    var
      j: integer;
      Hide:Array [0..1] of integer;

    begin
      Hide[0] := 11842750;
      Hide[1] := 13093070;

      for j := 0 to 1 do
      begin
        if FindColorSpiralTolerance(x,y,Hide[j],MSX1,MSY1,MSX2,MSY2,2) then
        begin
          Mouse(x, y, 3, 3, false);
          if ChooseOption('ide') = true then
          begin
            Flag;
            FindNormalRandoms;
            HidesPicked := HidesPicked + 1;
          end;
        end;
      end
    end;


    procedure KillDaCow;
    begin
      Writeln('now to own some cows');
      CowColor[0] := 6119781;
      CowColor[1] := 5863838;
      CowColor[2] := 9936291;
      CowColor[3] := 5397096;
      FightSetup;
      repeat
      FindNormalRandoms;
      if FindColorSpiralTolerance(x,y,Cowcolor[Random(3)],0,0,518,339,3) then
      begin
        MMouse(x,y,10,10);
        Wait(100);
        if IsUpText('Cow')=true then
        begin
          Mouse(x,y,5,5,False);
          if ChooseOption('ttack') = true then
          begin
            Flag;
            Antiban;
            if (infight = true) then
            begin
              repeat
              wait(100);
              until(infight = false);
            end;
            CowsKilled := CowsKilled + 1;
            Players[currentplayer].integers[5] := Players[currentplayer].integers[5] + 1;
            Collecthide;
            Wait(500);
          end;
        end;
      end;
      until(InvFull);
    end;

    procedure BankStuff;
    begin
      GameTab(4);
      if (FindBank('feb') = true) then
      begin
        MMouse(x,y,10,10);
        Wait(1000);
        DepositAll;
        Wait(1000);
        CloseBank;
        FindNormalRandoms;
      end;
    end;


    procedure ToPen;
    var
    z,p,u,TheRoadColor:integer;
    begin
      login;
      Z:=0;
      BankStuff;
      Makecompass('n');
      TheRoadColor := findfallyroadColor;
      Wait(500);
      if radialwalk(TheRoadColor,180,270,40,1,1) then
      begin
        wait(500);
      end else Exit;
      repeat
        radialroadwalk(TheRoadColor,165,200,50,1,1);
        AntiBan;
        wait(200);
      until(findsymbolin(x,y,'tree',628,8,704,165));
      mouse(x + 10,y,10,5,true);
      flag;
      if findcolortolerance(p,u,236,628,8,705,117,10) then
      begin
        mouse(p,u - 5,5,5,true);
        flag;
        Antiban;
      end;
      Setangle(false);
      if findcolortolerance(p,u,236,628,8,705,117,10) then
      begin
        mouse(p,u + 15,10,10,true);
        Z:= Z + 1;
      end;
    end;

    procedure ToBank;
    var
      LoadsDone,TheRoadColor: Integer;
    begin
      LoadsDone := 0;
      LogIn;
      if findcolortolerance(x,y,236,628,8,705,117,10) then
        begin
          Mouse(x,y - 6,5,5,true);
          wait(1000);
          mouse(x - 3,y - 5,5,5,true);
          flag;
          wait2(2000,true);
        end;
      if findsymbolin(x,y,'tree',548,9,627,165) then
      begin
        mouse(x - 5,y - 5,5,5,true);
        flag;
        wait(1000);
        AntiBan;
      end;
      TheRoadColor := FindFallyRoadColor
      RadialWalk(TheRoadColor,-50,0,65,2,2)
      Wait(1000);
      repeat
      FindNormalRandoms;
      RadialWalk(TheRoadColor,0,40,50,2,2);
      until(findsymbol(x,y,'bank') = true);
      BankStuff;
      LoadsDone := LoadsDone + 1;
      if players[currentplayer].integers[4] <= LoadsDone then
      begin
        Proggy;
        NextPlayer(true);
      end
    end;



    begin
      SetupSRL;
      ActivateClient;
      DeclarePlayers;
      CowsKilled := 0;
      HidesPicked := 0;
      for I:= 0 to (HowManyPlayers - 1) do
      begin
        Players[I].integers[5] := 0;
        Players[I].integers[6] := 0;
      end;
      repeat
      ToPen;
      KillDaCow;
      ToBank;
      until(False);
    end.

    a big problem is that infight is not working well at all, and i need it to find if its already being attacked, and if i one hit it..i've been looking at other scripts for ideas, but none of them have worked for me. if anyone knows how i could do it, please help me, or you could implement it yourself, just please tell me what you did so i'll accually learn the method, in case i need it ever again
    Quote Originally Posted by That guy that wrote forefeathers
    <munklez>haha im too lazy, girls annoy me
    <munklez> they always wanna like, do stuff
    <munklez> and i just wanna program
    <munklez> and they always take all my money

  2. #2
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I didn't want to change to much. Try this:
    I added notes next to the line //

    SCAR Code:
    procedure KillDaCow;
    var
      i:integer; //Added var of i
    begin
      Writeln('now to own some cows');
      CowColor[0] := 6119781;
      CowColor[1] := 5863838;
      CowColor[2] := 9936291;
      CowColor[3] := 5397096;
      FightSetup;
      repeat
      FindNormalRandoms;
      for i := 0 to 3 do //added line
      if FindColorSpiralTolerance(x,y,Cowcolor[i],0,0,518,339,3) then //removed random() for cowcolor changed to i
      begin
        MMouse(x,y,5,5);//set randomness to 5,5 from 10,10
        Wait(100);
        if IsUpText('Cow') then //removed =true
        begin
          Mouse(x,y,5,5,False);
          if ChooseOption('ttack') then//removed =true
          begin
            Flag;
            Antiban;
            FTWait(1);//added FTWait [200-250ms wait with findtalk]
            if (infight) then//removed =true
            begin
              repeat
                wait(100);
                if not loggedin then exit; //added whole line
              until(not (infight));//removed =false added not
            end;
            CowsKilled := CowsKilled + 1;
            Players[currentplayer].integers[5] := Players[currentplayer].integers[5] + 1;
            Collecthide;
            Wait(500);
          end;
        end;
      end;
      until(InvFull);
    end;
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. problem...
    By Blumblebee in forum OSR Help
    Replies: 4
    Last Post: 12-28-2008, 07:22 AM
  2. help big problem
    By goblanca in forum OSR Help
    Replies: 3
    Last Post: 05-19-2007, 10:41 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
  •