Need help with chicken killer

Discussion in 'Scar/Simba Help' started by 71runemaker, Jun 18, 2007.

Need help with chicken killer
  1. Unread #1 - Jun 18, 2007 at 10:34 AM
  2. 71runemaker
    Referrals:
    0

    71runemaker Guest

    Need help with chicken killer

    Here's the script...

    Code:
    {.Script Info:
    # ScriptName  = Falador_Chicken_Killer
    # Author      = TOB
    # Description = Kills chickens then collects feathers.
    # Version     = .6
    # Date        = 2006, December 3.
    # Comments    = I made this for SRL Member application
    /Script Info}
    program Falador_Chicken_Killer;
    
    {.include srl\srl.scar}
    {.include srl\srl\skill\Fighting.scar}
    //You will need to replace SRL\SRL\core\Login.scar with
      //http://sofakingpro.com/SCAR/Login.scar
    
    const
      chickenColor1 =1056410 ; //RECOMMENDED COLOR: Red part of chicken's head
      chickenColor2 =1063500 ; //RECOMMENDED COLOR: Dark brown on chicken's tail
      chickenColor3 =3627896 ; //RECOMMENDED COLOR: Light brown on chicken's back
      bareHandFightMode =2 ; // 1 = Attack; 2 = Strength; 3 = Defence;
      featherColor =9472 ; //Brown/black on feather
      findFeatherInterval = 30000;
    
    var
      bmpWater, CommonTime, featherTime: Integer;
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Loc := 'Chickens';
      Players[0].Active := True;
    
      Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := '';
      Players[1].Loc := 'Chickens';
      Players[1].Active := True;
    
      Players[2].Name := '';
      Players[2].Pass := '';
      Players[2].Nick := '';
      Players[2].Loc := 'Chickens';
      Players[2].Active := True;
    end;
    
    {*******************************************************************************
    procedure FTWait2(Time: Integer);
    By: TOB
    Description: Performs Wait and FindTalk. Time is multiple of 250 msec, so FTWait(4)
    waits approx 1 sec and performs 4 FindTalks;
    *******************************************************************************}
    procedure FTWait2(Time: Integer);
    var
      t, r: Integer;
    begin
      repeat
        r:= 200 + Random(50);
        Wait(r);
        t:= t + r;
        FindTalk;
      until(t >= time);
    end;
    
    procedure FindAllFeathers;
    begin
      if(not(InFight)) then
      begin
        ClickMMColor(WaterColor);
        repeat
          Mouse(x, y, 5, 5, True);
          FTWait(250);
        until(not(FindObj(x, y, 'Feather', featherColor, 5)))
      end;
      MarkTime(featherTime);
    end;
    
    {*******************************************************************************
    function SymbolExists(Name: String): Boolean;
    By: TOB
    Description: Finds if minimap symbol exists by name.
    *******************************************************************************}
    function SymbolExists(Name: string): Boolean;
    var
      necessaryx, necessaryy: Integer;
    begin
      if (GetSymbolColor(necessaryx, necessaryy, Lowercase(Name)) > 0) then
        Result := True;
    end;
    
    {*****************************************************************************
    procedure UnequipItem(itemPos: Integer);
    By: TOB
    Description: Unequips item in slot itemPos
    *****************************************************************************}
    procedure UnequipItem(itemPos: Integer);
    var
      equipmentXY: TPoint;
    begin
      if (WearingItem(itemPos)) then
      begin
        equipmentXY := EquipmentCoords(itemPos);
        Mouse(equipmentXY.x, equipmentXY.y, 5, 5, True);
      end;
    end;
    
    {*****************************************************************************
    function CheckBareHandFightMode: String;
    By: TOB
    Description: Unequips item in weapon and shield spot then sets fight mode to fightMode
    *****************************************************************************}
    function CheckBareHandFightMode: Integer;
    begin
      UnequipItem(5);
      UnequipItem(7);
      GameTab(1);
      if(GetColor(593, 273) = 2106253) then
        Result:= 1
      else if(GetColor(669, 265) = 2106253) then
        Result:= 2
      else if(GetColor(589, 326) = 2106253) then
        Result:= 3;
    end;
    
    {*****************************************************************************
    procedure SetBareHandFightMode(fightMode: Integer);
    By: TOB
    Description: If fightMode != CheckBareHandFightMode
    *****************************************************************************}
    procedure SetBareHandFightMode(fightMode: Integer);
    var
    curFightMode: Integer;
    curFightModeStr: string;
    begin
      curFightMode:= CheckBareHandFightMode;
      if(curFightMode = 1) then
        curFightModeStr:= 'Attack'
      else if(curFightMode = 2) then
        curFightModeStr:= 'Strength'
      else if(curFightMode = 3) then
        curFightModeStr:= 'Defence';
      if(fightMode = 1) and (not(curFightMode = fightMode)) then
      begin
        Mouse(593, 271, 20, 20, True);
        WriteLn(TheTime + ' Fight mode changed from ' + curFightModeStr + ' to Attack.');
      end else if(fightMode = 2) and (not(curFightMode = fightMode)) then
      begin
        Mouse(699, 275, 20, 20, True);
        WriteLn(TheTime + ' Fight mode changed from ' + curFightModeStr + ' to Strength.');
      end else if(fightMode = 3) and (not(curFightMode = fightMode)) then
      begin
        Mouse(589, 326, 20, 20, True);
        WriteLn(TheTime + ' Fight mode changed from ' + curFightModeStr + ' to Defense.');
      end;
    end;
    
    {*****************************************************************************
    function KAttackMonster2(Color1, Color2, Color3, Tolerance: Integer; MonsterName, objName: string; objColor: Integer): Boolean;
    By: XxKanexX modified by TOB
    Description: If monster is found based of it's given colors, name and tolerance level,
    will result true then click the monster and wait until out of the fight. objColor is the color
    of item to pick up after killing of monster, objName is the name of the item. Checks if monster
    or you are in a fight.
    *****************************************************************************}
    function KAttackMonster2(Color1, Color2, Color3, Tolerance: Integer;
      MonsterName, objName: string; objColor: Integer): Boolean;
    var
      i, x, y, objX, objY: Integer;
    begin
      if (not(InFight)) then
      begin
        Flag;
        for i:= 1 to 5 do
        begin
          repeat
            if (FindColorTolerance(x, y, Color1, MSX1, MSY1, MSX2, MSY2, Tolerance +
              i)) and
              (FindColorTolerance(x, y, Color2, x - 10, y - 10, x + 10, y + 10,
                Tolerance + i)) and
              (FindColorTolerance(x, y, Color3, x - 10, y - 10, x + 10, y + 10,
                Tolerance + i)) then
            begin
              MMouse(x, y, 3, 3);
              FTWait2(250);
              if (IsUpText('Attack ' + MonsterName)) then
              begin
                result := true;
                GetMousePos(x, y);
                Mouse(x, y, 0, 0, true);
                Wait(40 + random(20));
                Flag;
                OutFight;
                if(not(InFight)) then
                begin
                  if (FindObj(objX, objY, objName, objColor, 5)) then
                    Mouse(objX, objY, 5, 5, True);
                end;
                exit;
              end;
            end;
          until (not (IsFightAt(x, y)))
        end;
      end;
    end;
    
    {*****************************************************************************
    function FindMonster2(Color1, Color2, Color3, Tolerance: Integer; MonsterName, objName: string; objColor: Integer): Boolean;
    By: XxKanexX edited by TOB(To use KAttackMonster2)
    Description: Rotates compass in all 4 directions and searches for monster. If monster
    is found will Attack the monster using "KAttackMonster2" function.
    *****************************************************************************}
    function FindMonster2(Color1, Color2, Color3, Tolerance: Integer; MonsterName,
      objName: string; objColor: Integer): Boolean;
    var
      i: integer;
      dir: string;
    begin
      case random(4) + 1 of
        1: dir := 'nswe';
        2: dir := 'wens';
        3: dir := 'sewn';
        4: dir := 'ewns';
      end;
      for i := 1 to 4 do
        if (not (KAttackMonster2(Color1, Color2, Color3, Tolerance + i, monsterName,
          objName, objColor))) then
          if (not (InFight)) then
            MakeCompass(strget(dir, i))
          else
          begin
            result := true;
            exit;
          end;
    end;
    
    {*****************************************************************************
    procedure CheckLost;
    By: TOB
    Description: Checks for significant things on MM near chicken pen.
    *****************************************************************************}
    procedure CheckLost;
    var
      WaterX, WaterY: Integer;
    begin
      if(not(SymbolExists('water')) or not(SymbolExists('churn'))) then
      begin
        if(FindDeformed(WaterX, WaterY, bmpWater, MMX1, MMY1, MMX2, MMY2)) and
          (not (SymbolExists('tree'))) then
        begin
          SetRun(True);
          WaterColor := GetColor(WaterX + 5, WaterY + 3);
          Writeln(TheTime + ' WaterColor picked(' + IntToStr(WaterX + 5) +
            ', ' + IntToStr(WaterY + 3) + '): ' + IntToStr(WaterColor));
          Mouse(WaterX + 10, WaterY - 4, 3, 3, True);
          Writeln(TheTime + ' Lost, attempting to find chicken pen.')
          FTWait2(8000 + Random(2000));
          if (not(SymbolExists('water')) and not(SymbolExists('churn'))) then
          begin
            Writeln(TheTime + ' Lost, chicken pen not found. :(');
            Players[CurrentPlayer].loc:= 'Lost';
            Logout;
          end else
            Writeln(TheTime + ' At chicken pen, YAY we found it!!');
        end else
        begin
          WriteLn(TheTime + ' Totally lost.');
          Players[CurrentPlayer].loc:= 'Lost';
          Logout;
        end;
      end else
        WriteLn(TheTime + ' At chicken pen, we were already here. :)');
    end;
    
    //------------------------------------------------------------------------------
    procedure Common;
    begin
      AllPlayersInactive;
      ChatsOff;
      PerfectNorth;
      CheckLost;
      FindNormalRandoms;
      RandomMovement;
      if(TimeFromMark(ST) > Minutes(120)) then
        NextPlayer(True);
      if(not(Players[CurrentPlayer].loc = 'Chickens') or not(LoggedIn)) then
        NextPlayer(False);
      FindTalk;
      SRLRandomsReport;
      MarkTime(CommonTime);
    end;
    
    procedure SetupScript;
    begin
      ClearDebug;
      SetupSRL;
      DeclarePlayers;
      AllPlayersInactive;
      ActivateClient;
      PerfectNorth;
      SetBareHandFightMode(bareHandFightMode);
      bmpWater:= BitmapFromString(11, 5, 'z78DA3377B63470B230278B3400037' +
        '38A4D20CF1C03BC8012BDE40100B74D45BE');
      Common;
      FindAllFeathers;
    end;
    
    begin
      SetupScript;
      repeat
        if(TimeFromMark(CommonTime) > Minutes(5)) then
          Common;
        FindMonster2(chickenColor1, chickenColor2, chickenColor3, 10, 'Chicken',
          'Feather', featherColor);
        if(not(LoggedIn)) then
          NextPlayer(False);
        FTWait2(1000 + Random(750));
        if(TimeFromMark(featherTime) > findFeatherInterval) then
          FindAllFeathers;
        AllPlayersInactive;
      until(false)
    end.

    I'm using SCAR 2.03.
    The error is,
    Line 282: [Error] (18355:1): Unknown identifier 'AllPlayersInactive' in script C:\Documents and Settings\Owner\My Documents\SCAR\Falador_Chicken_Killer_By_TOB.scar


    Will someone help? :(
     
  3. Unread #2 - Jun 18, 2007 at 1:19 PM
  4. SmAcKmE
    Joined:
    May 18, 2007
    Posts:
    105
    Referrals:
    0
    Sythe Gold:
    0

    SmAcKmE Active Member

    Need help with chicken killer

    how can we help you with it if you don't evenm post probloms things you would like added and such
     
  5. Unread #3 - Jun 18, 2007 at 1:58 PM
  6. 71runemaker
    Referrals:
    0

    71runemaker Guest

    Need help with chicken killer

    dude did u even SEE the error at the end?
     
  7. Unread #4 - Jun 18, 2007 at 5:01 PM
  8. SmAcKmE
    Joined:
    May 18, 2007
    Posts:
    105
    Referrals:
    0
    Sythe Gold:
    0

    SmAcKmE Active Member

    Need help with chicken killer

    srry btw allplayersinactive seems to have to purpose in the script... so maybye just remove everything that says that?
     
  9. Unread #5 - Jun 18, 2007 at 5:36 PM
  10. Town
    Joined:
    Jan 21, 2007
    Posts:
    3,776
    Referrals:
    3
    Sythe Gold:
    5

    Town Grand Master
    Scar Programmers

    Need help with chicken killer

    Get a new script.
     
< Big problems with scar....... | Need help with chickenfighter script >

Users viewing this thread
1 guest


 
 
Adblock breaks this site