Results 1 to 8 of 8

Thread: CowHider version 1 Errors...

  1. #1
    Join Date
    Apr 2007
    Posts
    379
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default CowHider version 1 Errors...

    Hello!

    I am working on this script that kills cows, collects hides and bones, burries the bones and, soon, hopefully, banks the hides. BTW I did use Seroko's Chicken Kicker as a base, I will put him in credits so if you see anything that says "Chicken" please tell me!


    I have spent maybe oh lets say about 4 hours today working on my script reading tutorials all that jazz and i've come to a BIG Problem. My script works, logs on, targets cows, but doesnt attack, and doesn't pick up bones or cow hides like I would like it to.


    SCAR Code:
    { ---------------------------------------------------------------------------- ]
    [                             ..::CowHider::..                                 ]
    [ ---------------------------------------------------------------------------- ]
    [                         ..::   DESCRIPTION   ::..                            ]
    [                                                                              ]
    [                  Kills cows and gathers hides, eventually banks 'em          ]
    [ ---------------------------------------------------------------------------- ]
    [                       ..::   SUPPORTED SKILLS   ::..                         ]
    [                                                                              ]
    [                               o  Strength                                    ]
    [                               o  Attack                                      ]
    [                               o  Defense                                     ]
    [                               o  Balance                                     ]
    [ ---------------------------------------------------------------------------- ]
    [                      ..::   SETUP INSTRUCTIONS   ::..                        ]
    [                                                                              ]
    [    o  Log out at Lumbridge Cows, across from chicken pen.                    ]
    [    o  Fill in lines 41 through 46                                            ]
    [    o  Set up characters on lines 62 through 84                               ]
    [    o  Do not Change Anything in the Script Itself. Hit the Run Button Now!   ]
    [ ---------------------------------------------------------------------------- ]
    [        Scripted by Tails111:  Credit to Many people, will specify on release ]
    [ ---------------------------------------------------------------------------- }


    Program CowHider;
    {.include SRL\SRL.Scar}
    {.include SRL\SRL\Skill\Fighting.Scar}

    var
      Chicken : array[0..2] of Integer;
      Chickens, CowHideDTM, MMWater, CIndex, Exp, Bone, Display : Integer;
      SwitchMark, IntTime, TakeCount, CaMark : Integer;
    Const
      VerNumber = '1.0'; // Version Number
      StartPlayer = 0; // Player to start
      BuryBones = False; // Do you want to bury bones? Not Recomended
      GambleBox = False; // Set this to true if your computer is experiencing lag
      BanSafety = 10; // Lower for more ban prevention
      Extensive = True; // Detailed player information
      iPlay = 10; // Minutes until switch player
     
      HitColor = 192;
      MissedColor = 16728128;
      FightTimeOut = 10000;
      CalTime = 60000;
     
    { ---------------------------------------------------------------------------- ]
    [ Procedure DeclarePlayers - Declares Players.                                 ]
    [ ---------------------------------------------------------------------------- }


    Procedure DeclarePlayers;
    Begin
      HowManyPlayers:= 4;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name     :='Username';
      Players[0].Pass     :='Password';
      Players[0].Nick     :='Nickname';
      Players[0].Integer1 := 1; //1 - 4 fightmode.
      Players[0].Active   := True;

      Players[1].Name     :='';
      Players[1].Pass     :='';
      Players[1].Nick     :='';
      Players[1].Integer1 := 1; //1 - 4 fightmode.
      Players[1].Active   := True;

      Players[2].Name     :='';
      Players[2].Pass     :='';
      Players[2].Nick     :='';
      Players[2].Integer1 := 1; //1 - 4 fightmode.
      Players[2].Active   := True;

      Players[3].Name     :='';
      Players[3].Pass     :='';
      Players[3].Nick     :='';
      Players[3].Integer1 := 1; //1 - 4 fightmode.
      Players[3].Active   := True;
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure Intro - Name, version number.                                      ]
    [ ---------------------------------------------------------------------------- }


    Procedure Intro;
    Begin
      ClearDebug;
      Status('Script Created by Tails111');
      Writeln('             Ver '+VerNumber+'  Cow Hider  ');
      ReportVars[0] := ReportVars[0] + 1;
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure LoadAll - Loads chicken, feather, and water.  By: WhiteShadow      ]
    [ ---------------------------------------------------------------------------- }


    Procedure LoadAll ;
    Begin

      Cow[0]:= 3949132;
      Cow[1]:= 11975616;
      Cow[2]:= 9541532;

      CowHideDTM := DTMFromString('78DA637463666060616240063BD6AE01D38C5' +
           '03EA30350CD77460654C088AAC61CD31C0C35CE40350204D4F802' +
           'D5F01350130854C34A84393F09B8D90AA8E62F7E35000C8C078C');

      MMWater := BitmapFromString(2, 2, '6277A56277A56277A56277A5');

      Bone  :=  BitmapFromString(4, 4, '000001000001000001D2CCCC9B9' +
           '090A19595CEC7C79B909089807FDED9D9CAC3C29A8E8E000001C7' +
           'BFBFA99D9D000001');
    end;

    { ---------------------------------------------------------------------------- ]
    [ Function AttackType - Sets attack type.                                      ]
    [ ---------------------------------------------------------------------------- }


    Function AttackType : String;
    Begin
      case Players[CurrentPlayer].Integer1 of
        1 : Result:= 'attack';
        2 : Result:= 'strength';
        3 : Result:= 'hitpoints';
        4 : Result:= 'defence';
      end;
    end;

    { ---------------------------------------------------------------------------- ]
    [ Function InFight - Determines if your still fighting.      By: WT-Fakawi     ]
    [ ---------------------------------------------------------------------------- }


    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;

    { ---------------------------------------------------------------------------- ]
    [ Function FindCow - Finds Cow and attacks.   By: WT-Fakawi EDITED by Tails111 ]
    [ ---------------------------------------------------------------------------- }


    Function FindCow : Boolean;
    var  CBx,CBy: Integer;
    Begin
    For CIndex:=0 to 2 do
    Begin
        if FindColorSpiralTolerance(CBx, CBy, Chicken[CIndex], MSX1, MSY1, MSX2, MSY2, 15) then
          Begin
            MMouse(CBx, CBy, 0, 0);
            if IsUpTextMulti('Co','ow','w') then
              Begin
                Mouse(CBx, CBy, 0, 0, True);
                Flag;
                wait(5000+random(4000));
                if (InChatMulti('alr', 'und ',' att')) then
                  Begin
                    Result:=True;
                    Exit;
                  end;
                if (InChatMulti('ome', 'one ',' ing')) then
                  Begin
                    Result:=False;
                          Exit;
                  end;
                end;
            end;
        end;
    end;
    { ---------------------------------------------------------------------------- ]
    [ Procedure FightWait - Waits for the fight.       By: WT-Fakawi               ]
    [ ---------------------------------------------------------------------------- }


    Procedure FightWait;
    var Mark5, WGC:Integer;
    begin
      MarkTime(Mark5);
      repeat
         if(not(LoggedIn))then Exit;
         for WGC := 1 to 3 do
         begin
           wait(1000 + Random(100));
           if (TimeFromMark(Mark5) > FightTimeOut + Random ( FightTimeOut / 2 )) then Exit;
         end;
      until not InFight;
      Cows := Cows + 1;
      ReportVars[0] := ReportVars[0] + 1;;
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure AntiBan - Ban safety. By: FT-Fawaki                                ]
    [ ---------------------------------------------------------------------------- }


    Procedure AntiBann;
    var
    AntBan : Integer;
    Begin
      if (not(LoggedIn)) then Exit;
        case AntBan of
         1:  RandomRClickEvery(2 + Random(13));
         2:  hoverskill('random', false);
         3:  RotateEvery(20 + Random(10));
         4:  LeaveScreenEvery(5 + Random(5));
         5:  HoverEvery(15 + Random(5),'random');
         6:  PickUpMouse;
         7:  BoredEvery(9 + Random(24));
         8: if ExistsItem ( 1 ) then
               DragItem(1, 1+Random(18));
         9: GameTab(1 + Random(12));
         10: DoEmote(1 + Random(20));
       end;
    end;


    { ---------------------------------------------------------------------------- ]
    [ Function FindRandoms - Deals with all Randoms, Thanks SRL                    ]
    [ ---------------------------------------------------------------------------- }


    function FindRandoms : Boolean;
    var
      i: Integer;
    begin
      for i := 1 to 17 do
      begin
        case I of
          1: CloseWindow;
          2: if FindTalk then
              Result := True;
          3: if FindDead then
              Result := True;
          4: if FindMod then
              Result := True;
          5: if FindMime then
              Result := True;
          6: if FindMaze then
              Result := True;
          7: if FindQuiz then
              Result := True;
          8: if FindDemon then
              Result := True;
          9: if FindScapeRune then
              Result := True;
          10: if FindTalk then // Call it twice
              Result := True;
          11: if FindLamp(LampSkill) then // Maybe we missed it?
              Result := True;
          12: if (FindNewBox) then
              begin
                Result := True;
                if(GambleBox = True)then
                begin
                  if(not(GambleNewBox))then
                    LogOut;
                end else
                  SolveBox;
              end;
          13: if FindTrade then
              Result := True;
          14: begin
                if NoGameTab then
                begin
                  if ( SolveFrog ) then Exit;
                  Result := True;
                  Players[CurrentPlayer].loc := 'No GameTab';
                  Logout;
                  Exit;
                end;
              end;
          15: SaveToChatLog;
          16: if SolvePinball then
              Result := True;
          17: AntiBann;
        end;
        wait(1);
      end;
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure FindWaits - By: WhiteShadow                                        ]
    [ ---------------------------------------------------------------------------- }


    procedure FindWait(Ms, R : Integer);//Wait with randoms.
    var
      WaitTime, DivTime, i : Integer;
    begin
      WaitTime:= Ms + random(r);
      DivTime:= Trunc(WaitTime div 3);
      repeat
        Wait(DivTime - round(r div 4));
        FindRandoms;
        if(random(24) = 2)then
          SendArrowSilentWait(random(3), 300 + random(200));//Humans tilt alot?
        i:= i + 1;
      until(i >= 3);
    end;


    { ---------------------------------------------------------------------------- ]
    [ Procedure Bury - Bury bones                                                  ]
    [ ---------------------------------------------------------------------------- }


    Procedure Bury;
    begin
      ClickAllItemsBmpTolWait('ury', Bone, 50, 250);
    end;

    {==============================================================================]
    [         Function Bank - Banks cow hides + all other items in inventory       ]
    [==============================================================================}



    { ---------------------------------------------------------------------------- ]
    [ Function CollectItems - Collects Cowhides / Bones.     By: WhiteShadow       ]
    [ ---------------------------------------------------------------------------- }


    function CollectItems : Boolean;
    var
      a : TPoint;
      c : Integer;
    begin
      repeat
        c:= c + 1;
        if(not(LoggedIn))then Exit;
        FindRandoms;
        if(FindColorTolerance(a.x, a.y, 7632531, Msx1, Msy1, Msx2, Msy2, 10))or
          (FindColorTolerance(a.x, a.y,  10240, Msx1, Msy1, Msx2, Msy2, 10))then
        begin
          MMouse(a.x, a.y, 0, 0);
          if(IsUpText('ake'))then
          begin
            Result:= True;
            Mouse(a.x, a.y, 2, 2, false);
            If(InvCount < 28)Then
              if(ClickOption('owhid', 1))then
                 TakeCount:= TakeCount + 1;
            Flag;
            if(InvCount < 28)then
              if (ClickOption('one', 1)) then
                TakeCount:= TakeCount + 1;
            Flag;
            If(InvCount = 28)then
             begin
             if(BuryBones = True)then
             bury;
             end
          end;
        end;
      until(InvFull) or (c > 2)
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure xPosition - Anti-Lost.  Credits to WhiteShadow                     ]
    [ ---------------------------------------------------------------------------- }


    procedure xPosition;
    begin
      if(TimeFromMark(CaMark) > CalTime)then
      begin
        MarkTime(CaMark);
        MakeCompass('N');
        if(random(2) = 0)then
        begin
          SymbolAccuracy:= 0.4;
          if(FindSymbol(x, y, 'fish'))then
            MouseFlag(x + 25, y + 5, 5, 5);
        end else
        begin
          if(FindBitmapToleranceIn(MMWater, x, y, Mmx1, Mmy1, Mmx2, Mmy2, 50))then
            MouseFlag(x + 25, y - 23, 2, 2);
        end;
      end;
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure PlayerStats - Detailed Player Stats    By: WhiteShadow             ]
    [ ---------------------------------------------------------------------------- }


    procedure PlayerStats;
    var
      PSActive : String;
      i : Integer;
    begin
      for i := 0 to HowManyPlayers-1 do
      begin
        if(Players[i].Active = True)then
          PSActive:='True'
        else
          PSActive:='False';
          Writeln('#'+IntToStr(i)+' : '+Players[i].name+ ', Active = '+PSActive+', Hides = '+IntToStr(Players[i].Banked));
       end
       writeln('<|----------------------------------------------|>');
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure ProgReport - Simple Progress Report.                               ]
    [ ---------------------------------------------------------------------------- }


    Procedure Report;
    Begin
      ClearDebug;
      Intro;
      Exp:= (Chickens*3)*4;
      Writeln('<|----------------------------------------------|>');
      Writeln(' CowHider ver '+VerNumber+' by Tails111 ');
      Writeln(' Worked for: '+ScriptTime2(2));
      Writeln(' Killed: '+IntToStr(Cows)+' Cows');
      Writeln(' Estimated Exp: '+intToStr(Exp));
      Writeln('<|----------------------------------------------|>');
        if(Extensive = True)then
        PlayerStats;
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure MSC - Adjusts Mouse.  Credit to WhiteShadow                        ]
    [ ---------------------------------------------------------------------------- }


    procedure MSC;
    begin
      Writeln('Mouse adjust');
      if(random(2) = 0)then
        MouseSpeed:= 8 + random(3)
      else
      MouseSpeed:= 6 + random(4);
      BenMouse:= True;
      SetTimeOut(60, 'MSC');
      Status('');
    end;

    { ---------------------------------------------------------------------------- ]
    [ Procedure LoadScript - By: WhiteShadow                                       ]
    [ ---------------------------------------------------------------------------- }


    Procedure LoadScript;
    Begin
      ClearDebug;
      Intro;
      SetUpSRL;
      LoadAll;
      DeclarePlayers;
      CurrentPlayer:= StartPlayer;
      BenMouse:= True;
      MouseSpeed:= 7;
      if(not(LoggedIn)) then
        LoginPlayer;
      MSC;
    End;

    { ---------------------------------------------------------------------------- ]
    [ The main loop - Self explanitory.           Credits to WhiteShadow           ]
    [ ---------------------------------------------------------------------------- }


    Begin
      LoadScript;
      SetChat('On', 1)
      SetChat('Off', 2)
      SetChat('Off', 3)
      NickNameBMP:= CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
        if(LoggedIn)then
        begin
          SetFightMode(Players[CurrentPlayer].Integer1);
          SetRun(True);
          GameTab(4);
          HighestAngle;
          IntTime:= (iPlay * 60000) + random(5 * 60000);
          Display:= Round(IntTime / 60000);
          Writeln(Players[CurrentPlayer].Name+' will play '+IntToStr(DisPlay)+' minutes');
          MarkTime(SwitchMark);
          end;
        MarkTime(CaMark);
        repeat
          FindCow;
          Wait(50 + random(50));
          FightWait;
          Wait(50 + random(50));
          CollectItems;
          CountInvSlot(Players[CurrentPlayer].Banked, 1, 1);
          if(not(LoggedIn))then
            Break;
          xPosition;
          CollectItems;
          Report;
          SRLRandomsReport;
        until(TimeFromMark(SwitchMark) > IntTime)

        if(LoggedIn)then
          NextPlayer(True);

        if(not(LoggedIn))then
          NextPlayer(False);

    End.

  2. #2
    Join Date
    Feb 2007
    Location
    USA
    Posts
    667
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Well you have a chicken array. dunno if you want that.

    For debugging, why don't you add a line like this to see if your 'if' statements are being satisfied.
    (e.g.)
    Code:
    if IsUpTextMulti('Co','ow','w') then
              Begin
               writeln('[debug] mouse is over a cow');//now you will know if this if stament is satisfied

  3. #3
    Join Date
    Apr 2007
    Posts
    379
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Heh yeah I saw the chicken array, I dont have a clue what it is. but I will put the debug thing in there... Does it go in the main loop?

    Is the chicken array neccisary?

    This is for later but I used the radical walking aid thing and could not understand it but I made a path from the cow pen gate and it heads towards the bank in many many clicks off the road, here are the numbers i got.

    267, 627, 70
    269, 629, 72
    258, 617, 49
    171, 531, 61
    139, 499, 51
    164, 524, 55
    264, 624, 61
    262, 622, 17
    179, 539, 22
    257, 617, 36
    7, 367, 39

  4. #4
    Join Date
    Jun 2006
    Location
    New Zealand
    Posts
    285
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    http://www.villavu.com/forum/showthread.php?t=?t=7677
    Tutorial on using Radial Walking Aid and Radial Walk.
    Huehuehuehuehue

  5. #5
    Join Date
    Apr 2007
    Posts
    379
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I followed all that but those are looking like short distance walking, I am going to tinker with it later but the tutorials dont really, show anything about having a gate in the way or a door and how to open them and continue radically walking. If anyone has a script that has walking to the bank in lumbrdige from anywhere please tell!

  6. #6
    Join Date
    Jun 2006
    Location
    New Zealand
    Posts
    285
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think Boreas is making something that makes opening doors etc. in Lumbridge a whole lot easier http://www.srl-forums.com/forum/showthread.php?t=5744

    EDIT:
    Well the nice thing about this is that can evolve, while I am busy with other things. These are things I may add:

    Walk to bank from respawn point
    Do above, deposit all, get armor, walk back
    Get noob stuff from guides and bank
    Bank to cooking spot and back
    Bank to spinning spot and back
    Those are some things I think you're wanting, I'm not sure if Boreas has done them yet but I'm sure he will be able to sooner or later
    Huehuehuehuehue

  7. #7
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Not done with the walking yet, but done with Doors

  8. #8
    Join Date
    Apr 2007
    Posts
    379
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I assume that opening gates and doors are much alike? Hmm, I think I will try to tinker around with this.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Which version do you use?
    By Peanuts in forum News and General
    Replies: 3
    Last Post: 04-01-2008, 12:36 AM
  2. SRL Version 1 is out!
    By WT-Fakawi in forum News and General
    Replies: 32
    Last Post: 04-21-2006, 03:23 AM

Posting Permissions

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