script trouble, not my script-(made By : Pwnaz0r)

Discussion in 'Scar/Simba Help' started by eladore, Sep 24, 2007.

script trouble, not my script-(made By : Pwnaz0r)
  1. Unread #1 - Sep 24, 2007 at 7:19 PM
  2. eladore
    Referrals:
    0

    eladore Guest

    script trouble, not my script-(made By : Pwnaz0r)

    Hello, i was hoping to learn how to make some scripts my self but i wanted to look at what some other people had made first.. i'm using SCAR divi 3.12 and SRL 4 (As updated as i could get it.) and i am trying to use a scrip Pwnaz0r made and posted. (I'm well aware of all the people that have posted this script before i was hoping you wouldn't mind me adding one more because i didn't want to intrude on there help.) ***error is below code***

    Code:
    {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|
    |                                                                      |
    |                   [SRL]PowerChopper Free Version                     |
    |                           By : Pwnaz0r                               |
    |                                                                      |
    |             Updates : September 09, 2007                             |
    |                         - Script Released                            |
    |                                                                      |
    |             Features : - Stable chopping and dropping                |
    |                                                                      |
    |             Instructions : Fill in player array (Line 37)            |
    |                            Locate Players near the tree types        |
    |                            Hit Run!                                  |
    |                                                                      |
    |             Credits : Hy - Asked For it ;)                           |
    |                                                                      |
    |                                                                      |
    |                                                                      |
    |                                                                      |
    |=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-}
    
    program SRL_PowerChopper;
    {.include SRL/SRL.scar}
    {.include SRL/SRL/Skill/Woodcutting.scar}
    
    Const  DebugAll          = True; //Debugs every detail
           MaxTime           = 8; //Max time to cut tree in seconds
           DropRandomItems   = True; // Drop All items from randoms?
           Version           = '1.10'; //Dont mess
           
    
    var
      TreeCols: array [0..2] of integer;
      TreeName: string;
      logs, gems, loads: integer;
      strLogs, strGems, PlayerTreeName: String;
      
    procedure ClearVars; forward;
    procedure DeclarePlayers;
    begin
    
      SRLID := '';
      SRLPassword := '';
      HowManyPlayers := 2;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name :='';
      Players[0].Pass :='';
      Players[0].Nick :='';
      Players[0].Integers[2] := 50; //Loads To Do
      Players[0].Strings[1] := 'regular'; // Regular, Oak, Willow
    
      Players[1].Name :='';
      Players[1].Pass :='';
      Players[1].Nick :='';
      Players[1].Integers[2] := 50; //Loads To Do
      Players[1].Strings[1] := 'regular'; // Regular, Oak, Willow
    
      {Players[2].Name :='';
      Players[2].Pass :='';
      Players[2].Nick :='';
      Players[2].Integers[2] := 50; //Loads To Do
      Players[2].Strings[1] := 'regular'; // Regular, Oak, Willow
    
      Players[3].Name :='';
      Players[3].Pass :='';
      Players[3].Nick :='';
      Players[3].Integers[2] := 50; //Loads To Do
      Players[3].Strings[1] := 'regular'; // Regular, Oak, Willow
    
      Players[4].Name :='';
      Players[4].Pass :='';
      Players[4].Nick :='';
      Players[4].Integers[2] := 50; //Loads To Do
      Players[4].Strings[1] := 'regular'; // Regular, Oak, Willow
        }
        
      Writeln('Player(s): '+IntToStr(HowManyPlayers)+';');
      ClearVars;
    end;
    
    var
      x,y: integer;
    
    procedure ClearVars;
    var
      I : integer;
    begin
      for I := 0 to HowManyPlayers - 1 do
       begin
        Players[I].Integers[0] := 0;
        Players[I].Integers[1] := 0;
        Players[I].Integers[6] := 0;
        Players[I].Integers[5] := 0;
        Players[I].Integers[7] := 0;
        Players[I].Active := True;
        Players[I].Loc := '';
        Players[I].Rand := '';
       end;
      if SRLid = '' then
      begin
        SRLid := '';
        SrlPassword := '';
      end;
      ScriptId := '274';
      logs:= 0;
      gems:= 0;
      loads:= 0;
      strLogs:= '0';
      strGems:= '0';
    end;
    
    procedure Debug(str: string);
    begin
      str:= '['+TheTime+']- ' + str;
      AddToReport(str);
    end;
    
    procedure PlayerDebug(str: string);
    begin
      str:= 'Player['+IntToStr(CurrentPlayer)+'] - '+Str;
      Writeln(str);
    end;
    
    Procedure ChatBoxStyle;
    begin
        If GetColor(17,484) = 1452085 then exit else Mouse(51,496,3,3,true);
        SetChat('friends',1);
    end;
    
    procedure Tab11Details;
    begin
      Gametab(11);
      if not GetColor(709,229) = 9584920 then Mouse(709,229,3,3,true);
      if not GetColor(609,265) = 10172937 then Mouse(609,265,3,3,true);
      if not GetColor(608,302) = 10172937 then Mouse(608,302,3,3,true);
      if not GetColor(607,339) = 10172937 then Mouse(607,339,3,3,true);
      SetRun(true);
    end;
    
    function FindAxeEx: boolean; forward;
    function SetUpNextPlayer(ChangePlayer, Active: boolean): boolean;
    begin
      result:= true;
      If ChangePlayer then NextPlayer(Active);
      TreeName:= 'none';
      Case LowerCase(Players[CurrentPlayer].Strings[1]) of
      'none': begin
                Writeln('Invalid Tree Name! Cutting regulars instead');
                PlayerTreename:= 'regular';
              end;
      'regular','tree','normal': PlayerTreename:= 'regular';
      'oak': playertreename:= 'oak';
      'willow': Playertreename:= 'willow';
      end;
      NickNameBMP := CreateBitMapMaskFromtext(Players[CurrentPlayer].Nick,UpChars);
      ChatBoxStyle;
      Tab11Details;
      PerfectNorth;
      SetRun(false);
      FindAxeEx;
      Loads:= 0;
    end;
    
    function AxePresent: boolean;
    var
      axemask: integer;
    begin
      axemask:= BitmapFromString(12, 6, 'z78DA3330200CDCC060F0A8A19' +
           '669C4DB854B3DA92660EA25D50400350956AD');
      result:= FindBitmapMaskTolerance(axemask,x,y,547,203,737,467,5,5);
    end;
    
    function FindAxeEx: boolean;
    var
      I: integer;
    begin
      for i:= 4 to 5 do
      begin
        GameTab(i);
        if axepresent then
        begin
          result := true;
          players[currentplayer].integers[5] := GetColor(x,y);
          case I of
          4 : Players[currentplayer].booleans[5] := false;
          5 : begin
                Mouse(x,y,0,0,true);
                Wait(1200);
                Gametab(4);
                Players[CurrentPlayer].Booleans[5] := false;
              end;
          end;
          If DebugAll then
          begin
            Debug('Axe Found');
            PlayerDebug('Axe Color('+IntToStr(players[currentplayer].integers[5])+') Axe Wielded('+BoolToStr(Players[CurrentPlayer].Booleans[5])+')');
          end;
          exit;
        end;
      end;
      If DebugAll then
          begin
            Debug('Axe NOT Found');
            PlayerDebug('No Axe!');
          end;
      Players[CurrentPlayer].Loc := 'No Axe';
      NextPlayer(false);
    end;
    
    function ControlAxe: boolean;
    var
      rndx,rndy,I: integer;
    begin
      for I:= 4 to 5 do
      begin
       Gametab(I);
       Result:= FindColorTolerance(rndx,rndy,Players[CurrentPlayer].Integers[5],547,203,737,467,1);
       if Result and (I = 5)then
         begin
           Mouse(rndx,rndy,3,3,true);
           PlayerDebug('Axe was Somehow Wielded');
         end;
      if Result then Exit;
      end;
    end;
    
    function HandleAxe: boolean;
    var
      tmptArray: array of Tpoint;
      tmpint: integer;
      tmpCST: integer;
    begin
      result:= not ControlAxe;
      if result then
      begin
        tmpCST:= GetColorToleranceSpeed;
        SetColorSpeed2Modifiers(0.3,0.3);
        ColorToleranceSpeed(2);
        FindColorsTolerance(tmptarray,Players[CurrentPlayer].Integers[5],25,25,(MSX2-25),(MSY2-25),10);
        for tmpint:= 0 to Length(tmptarray) -1 do
        begin
          MMouse(tmptarray[tmpint].x,tmptarray[tmpint].y,0,0);
          if IsUpTextMulti('ake','ead','xe')then
          begin
            GetMousePos(x,y);
            Mouse(x,y,0,0,true);
            Flag;
            Wait(800);
            ColorToleranceSpeed(tmpCST);
            Exit;
          end;
        end;
      ColorToleranceSpeed(tmpCST);
      end;
    end;
    
    function HandleRandoms(x, y: integer): Boolean;
    var
      i: Integer;
    begin
      NickNameBMP:= CreateBitmapMaskFromText(Players[Currentplayer].Nick,UpChars);
      for i:= 1 to 3 do
      begin
        case I of
         1: if FindNormalRandoms then result:= true;
         2: if HandleAxe then result:= true;
         3: if FindEnt(x,y, true) then result:= true;
        end;
        wait(1);
      end;
    end;
    
    procedure Reset(var X, Y: integer);
    begin
      try
      X := Round(MSX2/2);
      Y := Round(MSY2/2);
      except
      X := MSCX;
      Y := MSCY;
      end;
    end;
    
    procedure SetData(tree: String);
    begin
      case Lowercase(tree) of
      'regular','tree':
                begin
                  TreeName:= 'ree';
                  TreeCols[0]:= 1866347;
                  TreeCols[1]:= 4096372;
                  TreeCols[2]:= 3633766;
                end;
      'oak':    begin
                  TreeName:= 'ak';
                  TreeCols[0]:= 4089180;
                  TreeCols[1]:= 2317388;
                  TreeCols[2]:= 1853512;
                end;
      'willow': begin
                  TreeName:= 'illo';
                  TreeCols[0]:= 6125682;
                  TreeCols[1]:= 2526330;
                  TreeCols[2]:= 3043941;
                end;
      end;
    end;
    
    function ReturnArray(TPA: array of TPoint; Modifiers: integer): TPointArray; forward;
    function FindTree(x1, y1, x2, y2:integer; Move: boolean): boolean;
    var
      tmp: integer;
      tmpt: array of TPoint;
    begin
      SetColorSpeed2Modifiers(1.0,1.0);
      Reset(x,y);
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(x,y,tmpt,TreeCols[0],x1,y1,x2,y2,2);
      tmpt:= ReturnArray(tmpt,20);
      For tmp:= 0 to Length(tmpt) -1 do
      begin
        x:= tmpt[tmp].x;
        y:= tmpt[tmp].y;
        If FindColorSpiralTolerance(x,y,TreeCols[1],(x-5),(y-5),(x+5),(y+5),2)then
          If FindColorSpiralTolerance(x,y,TreeCols[2],(x-5),(y-5),(x+5),(y+5),2)then
          begin
            if Move then
            begin
              MMouse(x,y,0,0);
              result:= IsUpText(TreeName);
            end else
            begin
            result:= true;
            end;
            if result then exit;
          end;
      end;
    end;
    
    procedure ClickTree;
    begin
      GetMousePos(X,Y);
      case random(1) of
      0: Mouse(X,Y,0,0,true);
      1: begin
           Mouse(X,Y,0,0,false);
           ChooseOption('hop');
         end;
      end;
    end;
    
    function FollowTree(var x,y: integer): boolean;
    begin
      SetColorSpeed2Modifiers(1.0,1.0);
      ColorToleranceSpeed(2);
      result:= FindTree(x - 25, y - 25, x + 25, Y + 25, false);
    end;
    
    function TreeChoppedAt(x, y:integer): boolean;
    begin
      SetColorSpeed2Modifiers(1.0,1.0);
      ColorToleranceSpeed(2);
      result:= not FindTree(x - 25, y - 25, x + 25, Y + 25, false);
    end;
    
    function ReturnArray(TPA: array of TPoint; Modifiers: integer): TPointArray;
    var
      tmp, tmp1, tmp2: integer;
    begin
      SetArrayLength(TPA,10);
      for tmp:= 0 to Length(TPA) - 1 do
        begin
          for tmp1:= 0 to Length(TPA) - 1 do
            begin
              if Max(TPA[tmp].x,TPA[tmp1].x) - Min(TPA[tmp].x,TPA[tmp1].x) >= Modifiers then
              if Max(TPA[tmp].y,TPA[tmp1].y) - Min(TPA[tmp].y,TPA[tmp1].y) >= Modifiers then
                begin
                  SetArrayLength(Result,Length(result) + 1);
                  tmp2:= Length(result) - 1;
                  result[tmp2].x:= TPA[tmp].x;
                  result[tmp2].y:= TPA[tmp].y;
                end;
            end;
        end;
        Status('done');
    end;
    
    function Chop(data: string): boolean;
    var
      tmpMark: integer;
    begin
      SetData(data);
      If FindTree(0, 0, MSX2, MSY2, true) then
        begin
          GetMousePos(x, y);
          Clicktree;
          while FlagPresent do
            begin
            FollowTree(x, y);
            end;
        end;
      MarkTime(tmpMark);
      repeat
        if HandleRandoms(x, y) then
        begin
          If DebugAll then
            PlayerDebug('Random Found!');
          break;
        end;
      if TimeFromMark(tmpMark) >= (MaxTime + random(3)) * 1000 then
      begin
        if DebugAll then
          PlayerDebug('Too long to cut tree');
        break;
      end;
      until(TreeChoppedAt(x, y));
      result:= true;
    end;
    
    function GetInvSlot(x, y: integer): integer;
    var
      I: integer;
    begin
      result:= - 1;
      for I:= 1 to 28 do
        begin
          if IntInBox(x, y, invBox(I)) then
          begin
            result:= I;
            exit;
          end;
        end;
    end;
    
    function DropLogs: boolean;
    var
      LogMask, lx, ly, failsafemark, CurrentLog: Integer;
    begin
      LogMask := BitmapFromString(19, 14, 'z78DA3330A00E704302067407' +
           'F4B777D4C6A16EE3F0F09D1B5E400B9369E7F2E114D7230100008' +
           'F6836A8');
      Gametab(4);
      while FindBitMapMaskTolerance(LogMask, lx, ly, 554, 207, 727, 464, 3, 3) do
        begin
          CurrentLog:= GetInvSlot(lx, ly);
          Mouse(lx, ly, 4, 4, false);
          if ChooseOption('rop')then
            begin
              logs:= logs + 1;
              Players[Currentplayer].integers[6]:= Players[Currentplayer].integers[6] + 1;
              Reportvars[0]:= 1;
              SendSRLReport;
              strLogs:= IntToStr(logs);
              MarkTime(FailsafeMark);
              repeat
                wait(1);
                If TimeFromMark(FailSafeMark) >= 2300 then
                begin
                  Logs:= Logs - 1;
                  Players[Currentplayer].integers[6]:= Players[Currentplayer].integers[6] - 1;
                  StrLogs:= IntToStr(Logs);
                  break;
                end;
              until not ExistsItem(CurrentLog);
            end;
        end;
      result:= true;
      FreeBitmap(LogMask);
    end;
    
    procedure DropGems;
    var
      GemMask, gx, gy: integer;
    begin
      GemMask := BitmapFromString(18, 16, 'z78DA3330201FB88181015D00' +
           '3DED1ADEBE1BB56BD4AE511FE1D7452A30180503040097E74EE4');
      GameTab(4);
      While FindBitMapMaskTolerance(GemMask, gx, gy, 554, 207, 727, 464, 3, 3) do
      begin
        Players[Currentplayer].integers[7] := Players[Currentplayer].integers[7] + 1;
        Gems:= Gems + 1;
        strGems:= IntToStr(Gems);
      end;
      FreeBitmap(Gems);
    end;
    
    procedure Callibrate;
    var
      i: integer;
    begin
      If SRLId = '' then
      begin
        GetSelf.WindowState:= wsNormal;
        ChangeReportWidth(1);
        ClearDebug;
        For I:= 0 to 9 do
          Writeln('Please Register an SRL Stats ID and declare the Name and password in Declareplayers!');
        Try GetPage('http://www.stats.srl-forums.com/?action=register');
        except
          Writeln('http://www.stats.srl-forums.com/?action=register');
        end;
        Cleardebug;
        For I:= 0 to 9 do
          Writeln('Please Register an SRL Stats ID and declare the Name and password in Declareplayers!');
        Writeln('http://www.stats.srl-forums.com/?action=register');
        TerminateScript;
      end;
    end;
    
    procedure PlayerReport;
    var
      I, i2, i3: integer;
      exp, tmpstr: string;
    begin
      Writeln('  # | Nick | Logs Chopped | Gems Dropped | Exp Gained');
      for I:= 0 to length(Players) - 1 do
      begin
        i2:= Length(Players[i].Nick);
        tmpStr:= '';
        For i3 := 1 to i2 do
          tmpstr:= tmpStr+'*';
        case Lowercase(Players[i].Strings[1]) of
        'regular','tree': exp:= IntToStr(Players[I].integers[6] * Round(GetTreeExp('tree')));
        'oak': exp:= IntToStr(Players[I].integers[6] * Round(GetTreeExp('oak')));
        'willow': exp:= IntToStr(Players[I].integers[6] * Round(GetTreeExp('willow')));
        end;
        Writeln('  '+IntToStr(i)+' | '+tmpStr+' | Logs : '+IntToStr(Players[I].Integers[6])+' | Gems : '+IntToStr(Players[I].Integers[7])+' | Exp : '+Exp);
      end;
    end;
    
    procedure Report;
    var
      H, M, S: integer;
    begin
      SRLRandomsReport;
      SendSRLReport;
      ClearDebug;
      Writeln(' /=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\');
      Writeln(' |              [SRL]PowerChopper V '+Version+'                 |');
      Writeln(' |                     By : Pwnaz0r                      |');
      Writeln(' \=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=--=/');
      Writeln('');
      ConvertTime(GetTimeRunning,H,M,S);
      Writeln('  Worked For ' + InttoStr(H) + ' hours, ' + IntToStr(M) + ' minutes and '+ IntToStr(S) + ' seconds ');
      Writeln('  Chopped '+strLogs+' tree(s) total');
      Writeln('  Dropped '+strGems+' gems(s) total');
      Writeln('');
      PlayerReport;
    end;
    
    begin
     SetupSRL;
     ScriptId:= '296';
     DeclarePlayers;
     ClearDebug;
     ActivateClient;
     repeat
       SetUpNextPlayer(false, false);
       if not LoggedIn then Exit;
       repeat
         if InvFull then
           begin
             DropLogs;
               If DropRandomItems then
                 begin
                   DropGems;
                 end;
             Loads:= Loads + 1;
           end;
         Chop(PlayerTreeName);
         Report;
       until(Loads >= Players[CurrentPlayer].Integers[2]);
       SetUpNextPlayer(true, false);
     until(false);
    end.
    when ever i try to use this script i get an error saying
    Code:
    Failed when compiling
    Line 525: [Error] (15407:65): Unknown identifier 'GetTreeExp' in script C:\Program Files\SCAR 3.12\Scripts\[SRL]PowerChopper.scar
    because im new to this i really don't know what that means :( can anyone help me?
     
  3. Unread #2 - Sep 24, 2007 at 9:49 PM
  4. Zeta
    Joined:
    Jan 21, 2007
    Posts:
    1,680
    Referrals:
    3
    Sythe Gold:
    0

    Zeta Guru
    Banned

    script trouble, not my script-(made By : Pwnaz0r)

    it's most likely because alot of things were taken out in the official srl 4, just wait for him to update it..

    1.1k posts!
     
  5. Unread #3 - May 28, 2008 at 8:40 PM
  6. LotMofdruff
    Referrals:
    0

    LotMofdruff Guest

< Includes | New To Scar >

Users viewing this thread
1 guest


 
 
Adblock breaks this site