Results 1 to 7 of 7

Thread: My First Script : SPC.

  1. #1
    Join Date
    Aug 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default My First Script : SPC.

    Can you help me please, I need help with this script (my first) :

    Code:
    {.include SRL/SRL.scar}
    {.include SRL/SRL/misc/users.scar}
    
    program SPC;
    
    var
      x,y,LogsCut,AxeDTM,LogDTM = Integer;
    Procedure Setup;
    begin
      Writeln('Starting up the script');
      AxeDTM := DTMFromString('78DA63AC606060C86140011EF6C60CFF81342' +
           '310FF0702C61220238E010D302291401A64461901350540228B80' +
           '9A7C20514E404D3D904827A0A61648C4E357030056B70BE4');
      LogDTM := DTMFromString('78DA637466626078CA8002FCAD1519FE03694' +
           '620FE0F048C2E4035B719D000231209A42D806AEE1250630254F3' +
           '84801A73A09AB704D4D803D57C20A0C607A8E60D0135814035CF8' +
           '930E7217E3500A2A81037');
      SRLPlayerForm(true,['Axe Equipped ?'],['Logs to cut ?'],[],[]);
      LoginPlayer;
      Wait(400+random(200));
      FindNormalRandoms;
      If not (Players[CurrentPlayer].Booleans[1]) then
      Begin
        If FindDTM(AxeDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
        Begin
          Writeln('Axe was found.');
        End else;
        Begin
          Writeln('Axe not found. Terminating.');
          TerminateScript;
        End;
      End;
    End;
    
    Procedure FACT;
    begin
      If not(LoggedIn) then
      Begin
        Writeln('Something is wrong, you arent logged in for the procedure : FACT');
        TerminateScript;
      End;
      If (FindObjCustom(x,y,['ree','Tree','Chop down Tree','down Tree'],[1192491,3431805,930345,1649980],10)) then
      Begin
        Writeln('Tree found');
        Begin
          If IsUpText('ree') then
          Begin
            GetMousePos(x,y);
            Mouse(x,y,0,0,true);
            Repeat
              Wait(50+random(50));
              Case Random(100) of
                0,1,2,3,4,5,6,7,8,9,10 : BoredHuman;
                11,12,13,14,15,16,17   : RandomMovement;
                18,19,20,21,22,23,24   : HoverSkill('woodcutting');
                25,26,27,28,29,30,31   : HoverSkill('random');
                32,33,34,35,36,37,38   : PickUpMouse;
              End;
            Until(FindDTM(LogDTM,x,y,MIX1,MIY1,MIX2,MIY2));
            Mouse(x,y,3,3,false);
            ChooseOption('rop');
          End;
        End;
      End else;
      Begin
        Writeln('Did not find tree...');
        TerminateScript;
      End;
      LogsCut = LogsCut+1;
    End;
        
    begin
      Setup;
      repeat
        FACT;
      until(LogsCut = Players[CurrentPlayer].Integer[1]);
    end.
    I get an error in Math.scar when I try to compile it .

    Thanks in advance.

    Edit : error is :

    Line 47: [Error] (326:11): Unknown identifier 'CreateTPAFromBMP' in script C:\Program Files\SCAR 3.21\includes\SRL\SRL\Core\Math.scar
    Failed when compiling
    Last edited by Aeon C; 08-31-2009 at 06:21 PM.

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Delete your SRL Folder, Checkout SRL again.

  3. #3
    Join Date
    Aug 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks, that fixed that error, now the error i get is :

    Failed when compiling
    Line 4: [Error] (21647:1): 'BEGIN' expected in script C:\Program Files\SCAR 3.21\Scripts\SPC V0.1 B.scar

    . G2G, I'll be back in 2 hours or so, please help me. Thanks.

  4. #4
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Put the Program SPC; before the {.include ...} things.

  5. #5
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    With this:
    SCAR Code:
    Case Random(100) of
      0,1,2,3,4,5,6,7,8,9,10 : BoredHuman;
      11,12,13,14,15,16,17   : RandomMovement;
      18,19,20,21,22,23,24   : HoverSkill('woodcutting');
      25,26,27,28,29,30,31   : HoverSkill('random');
      32,33,34,35,36,37,38   : PickUpMouse;
    End;
    You could do:
    SCAR Code:
    Case Random(100) of
      0..10 : BoredHuman;
      11..17   : RandomMovement;
      18..24   : HoverSkill('woodcutting');
      25..31   : HoverSkill('random');
      32..38   : PickUpMouse;
    End;

    Richard
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

  6. #6
    Join Date
    Feb 2009
    Location
    Hungary (GMT + 1)
    Posts
    1,774
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program SPC;       //program name to first line then the includes
    {.include SRL/SRL.scar}
    {.include SRL/SRL/misc/users.scar}

    var
      x,y,LogsCut,AxeDTM,LogDTM: Integer;  //When declaring vars use ":".
    Procedure Setup;
    begin
      Writeln('Starting up the script');
      AxeDTM := DTMFromString('78DA63AC606060C86140011EF6C60CFF81342' +
           '310FF0702C61220238E010D302291401A64461901350540228B80' +
           '9A7C20514E404D3D904827A0A61648C4E357030056B70BE4');
      LogDTM := DTMFromString('78DA637466626078CA8002FCAD1519FE03694' +
           '620FE0F048C2E4035B719D000231209A42D806AEE1250630254F3' +
           '84801A73A09AB704D4D803D57C20A0C607A8E60D0135814035CF8' +
           '930E7217E3500A2A81037');
      SRLPlayerForm(true,['Axe Equipped ?'],['Logs to cut ?'],[],[]);
      LoginPlayer;
      Wait(400+random(200));
      FindNormalRandoms;
      If not (Players[CurrentPlayer].Booleans[1]) then
      Begin
        If FindDTM(AxeDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
        Begin
          Writeln('Axe was found.');
        End else;
        Begin
          Writeln('Axe not found. Terminating.');
          TerminateScript;
        End;
      End;
    End;

    Procedure FACT;
    begin
      If not(LoggedIn) then
      Begin
        Writeln('Something is wrong, you arent logged in for the procedure : FACT');
        TerminateScript;
      End;
      If (FindObjCustom(x,y,['ree','Tree','Chop down Tree','down Tree'],[1192491,3431805,930345,1649980],10)) then
      Begin
        Writeln('Tree found');
        Begin
          If IsUpText('ree') then
          Begin
            GetMousePos(x,y);
            Mouse(x,y,0,0,true);
            Repeat
              Wait(50+random(50));
              Case Random(100) of
                0,1,2,3,4,5,6,7,8,9,10 : BoredHuman;
                11,12,13,14,15,16,17   : RandomMovement;
                18,19,20,21,22,23,24   : HoverSkill('woodcutting', False);   //look in the includes AntBan.scar, this procedure got two parameters
                25,26,27,28,29,30,31   : HoverSkill('random', False);  //^
                32,33,34,35,36,37,38   : PickUpMouse;
              End;
            Until(FindDTM(LogDTM,x,y,MIX1,MIY1,MIX2,MIY2));
            Mouse(x,y,3,3,false);
            ChooseOption('rop');
          End;
        End;
      End else;
      Begin
        Writeln('Did not find tree...');
        TerminateScript;
      End;
      Inc(LogsCut); //better use Inc(var)<- will increase the variable by one, and IncEx(var, how)<- will increase the variable by how.
    End;

    begin
      Setup;
      repeat
        FACT;
      until(LogsCut = Players[CurrentPlayer].Integers[1]);   //player variables are in plural
    end.

    EDIT: Damn, while I was making it to compile I got ninjad! But mine is better

  7. #7
    Join Date
    Aug 2009
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    With alot of help from great people from the #SRL channel and you, posters, I updated it ^^.

    Code:
    program SPC;
    {.include SRL/SRL.scar} //Thanks for the help ian.
    {.include SRL/SRL/misc/users.scar} //Thanks for the help ian.
    
    var
      x,y,LogsCut,AxeDTM,LogDTM,ABP,TI: Integer; //Thanks for the help Sabzi for
                                              //changing '=' to ':'.
      
    procedure Setup;
    begin
      Writeln('Starting up the script');
      AxeDTM := DTMFromString('78DA63AC606060C86140011EF6C60CFF81342' +
           '310FF0702C61220238E010D302291401A64461901350540228B80' +
           '9A7C20514E404D3D904827A0A61648C4E357030056B70BE4');
      LogDTM := DTMFromString('78DA637466626078CA8002FCAD1519FE03694' +
           '620FE0F048C2E4035B719D000231209A42D806AEE1250630254F3' +
           '84801A73A09AB704D4D803D57C20A0C607A8E60D0135814035CF8' +
           '930E7217E3500A2A81037');
      SRLPlayerForm(true,['Axe Equipped ?'],['Logs to cut ?'],[],[]);
      LoginPlayer;
      Wait(400+random(200));
      FindNormalRandoms;
      if not (Players[CurrentPlayer].Booleans[1]) then
      begin
        if FindDTM(AxeDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
        begin
          Writeln('Axe was found.');
        end else;
        begin
          Writeln('Axe not found. Terminating.');
          TerminateScript;
        end;
      end;
    end;
    
    procedure AB;
    begin
      case Random(39) of
        0..10    : BoredHuman; //Fixed all the case number lines thanks to R1ch
        11..17   : RandomMovement;
        18..24   : HoverSkill('woodcutting',false); //Fixed with the help of Sabzi (added ",false")
        25..31   : HoverSkill('random',false); //Fixed with the help of Sabzi (added ",false")
        32..38   : PickUpMouse;
      end;
      Inc(ABP);
    end;
    
    procedure FACT;
    begin
      TI := 0;
      if not(LoggedIn) then
      begin
        Writeln('Something is wrong, you arent logged in for the procedure : FACT');
        TerminateScript;
      end;
      if (FindObjCustom(x,y,['ree','Tree','Chop down Tree','down Tree'],[1192491,3431805,930345,1649980],10)) then
      begin
        Writeln('Tree found');
        begin
          if IsUpText('ree') then
          begin
            GetMousePos(x,y);
            Mouse(x,y,0,0,true);
            repeat
              Wait(200+random(50));
              case Random(10) of
                1,2: AB
              end;
              Inc(TI);
            until(FindDTM(LogDTM,x,y,MIX1,MIY1,MIX2,MIY2) or (TI = 20));
            Mouse(x,y,3,3,false);
            ChooseOption('rop');
          end;
        end;
      end else;
      begin
        Writeln('Did not find tree...');
        TerminateScript;
      end;
      Inc(LogsCut); //Changed from LogsCut:=LogsCut+1 thanks for Sabzi
    end;
    
    procedure WPR;
    begin
      Writeln('======================================');
      Writeln(' SPC - Simple Power Cutter by Aeon C.  ');
      Writeln('======================================');
      Writeln('Progress report written on :          ');
      Writeln(TheDate(3)+' '+Thetime);
      Writeln('======================================');
      Writeln('You have cut : '+Inttostr(LogsCut)+' logs.');
      Writeln('You have gained : '+Inttostr(LogsCut * 25)+' exp.');
      Writeln('You have performed : '+Inttostr(ABP)+' antibans.');
      Writeln('======================================');
    end;
    
    procedure ETS;
    begin
      FreeDTM(AxeDTM);
      FreeDTM(LogDTM);
      if (LoggedIn) then
        Logout;
      Writeln('Hope you enjoyed SPC by Aeon C.');
      WPR;
    end;
    
    begin
      Setup;
      repeat
        FACT;
      until(LogsCut = Players[CurrentPlayer].Integers[1]);
      ETS;
    end.
    Last edited by Aeon C; 08-31-2009 at 10:31 PM.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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