Results 1 to 8 of 8

Thread: compiling

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

    Default compiling

    i know this is a crap stript and ive missed out half the vars but could some one help me get it up and running
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    Var x, y, Rock, LoadsDone,  AntibanUsed: Integer;
          Text: array of string;

    Procedure SetTree;
    begin
       case lowercase(Players[CurrentPlayer].Strings[0]) of
     'copper' :  begin
                    Rock := 5083645;
                    end;
       'tin'  :   begin
                    Rock := 9868957;
                    end;
       'iron' :   begin
                    Rock := 3029075;
                    end;
     'gold'   :   begin
                    Rock := 2344440;
                    end;
      Text := ['ine', 'Min', 'in']

    end;

    Procedure AntiBan;
    begin
      if not LoggedIn then Exit;
        FindNormalRandoms;
        Inc(AntibanUsed);
        case 7+random(18) of
          0: HoverSkill('Random', false);
          1: PickUpMouse;
          3: BoredHuman;
          4: begin
               MakeCompass('N');
               wait(10+random(55));
               MakeCompass('S');
               wait(10+random(55));
               MakeCompass('N');
             end;
          5: RandomRClick;
          6: RandomMovement;
    end;

    Procedure AreWeStillMinning;
    Var Col, Fail: Integer;
    begin
      if(findcolorspiraltolerance(x,y,Rock,msx1,msy1,msx2,msy2,25))then
        Col := GetColor(x,y);
          repeat
            begin
              wait(900+random(300));
              inc(failed);
            end;
          until(not(GetColor(x,y) = Col)) or Fail => 9
            if Failed = 9 then
              inc(CantFind);
              Antiban;
    end;
         

    Procedure Mine;
    Begin
      If (not LoggedIn) then
       Exit;
       MouseSpeed := RandomRange(14, 19);
        begin
          SetRock;
            repeat
               FindObjTPA(x, y, Rock, 7, 2, 20, 20, 12, Text);
               GetMousePos(x,y);
               Wait(50 + random(150));
                if(random(8) = 1)then
                 begin
                   Mouse(x, y, 3, 3, False);
                   ChooseOption('ine');
                   AreWeStillMinning;
                 end else
                   begin
                    Mouse(x, y, 3, 3, True);
                    AreWeStillMinning;
                   end;
            until (Invfull);
        end;
    end;

    procedure Drop;
    begin
     Inc(LoadsDone);
        case lowercase(Players[CurrentPlayer].Strings[1]) of
        'true': begin
                 for i:= 1 to 28 do
                  begin
                    DropAll;
                    IncEx(LogsCut, 28);
                  end;
                end;
        'false': begin
                  for i:= 2 to 28 do
                   begin
                     DropItem(i);
                     IncEx(LogsCut, 27);;
                   end;
                 end;
        end;
    end;

    begin
    SetupSRL;
    end.
    I see Now, says the blind man

  2. #2
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Missing an end in SetTree after case:

    SCAR Code:
    Procedure SetTree;
    begin
       case lowercase(Players[CurrentPlayer].Strings[0]) of
     'copper' :  begin
                    Rock := 5083645;
                    end;
       'tin'  :   begin
                    Rock := 9868957;
                    end;
       'iron' :   begin
                    Rock := 3029075;
                    end;
     'gold'   :   begin
                    Rock := 2344440;
                    end;
      Text := ['ine', 'Min', 'in']
      end; //HERE

    end;

    You always need an end when done with a case of statement.



    Also, no begin end is necessary in the cases if only doing 1 thing. So it could look better like:
    SCAR Code:
    Procedure SetTree;
    begin
       case lowercase(Players[CurrentPlayer].Strings[0]) of
     'copper' : Rock := 5083645;
       'tin'  : Rock := 9868957;
       'iron' : Rock := 3029075;
     'gold'   : Rock := 2344440;
      Text := ['ine', 'Min', 'in']
      end;
    end;



    In AntiBan it will never do anything because you do 7+random, when the options only go up to 6. Try doing like:
    SCAR Code:
    Procedure AntiBan;
    begin
      if not LoggedIn then Exit;
        FindNormalRandoms;
        Inc(AntibanUsed);
        case random(7) of
          0: HoverSkill('Random', false);
          1: PickUpMouse;
          3: BoredHuman;
          4: begin
               MakeCompass('N');
               wait(10+random(55));
               MakeCompass('S');
               wait(10+random(55));
               MakeCompass('N');
             end;
          5: RandomRClick;
          6: RandomMovement;
        end; //HERE
    end;

    Also missed an end after case. That will do something every time, because the random will pick a number 0-6, and which ever it matches it will do in the instances. If you don't want it to do anti ban every time, try increasing the randomness.



    ArewestillMining should be:
    SCAR Code:
    Procedure AreWeStillMinning;
    Var Col, Fail: Integer;
    begin
      if(findcolorspiraltolerance(x,y,Rock,msx1,msy1,msx2,msy2,25))then
      begin //Missed begin
        Col := GetColor(x,y);
          repeat
            wait(900+random(300));
            inc(failed);
          until(not(GetColor(x,y) = Col)) or Fail >= 9 .//Changed operator to >=
            if Failed = 9 then
            begin //Missed begin
              inc(CantFind);
              Antiban;
            end; //Missed end
      end; //Missed end
    end;

    Read comments. Also removed an unnecessary begin end in the repeat until.


    Here:
    SCAR Code:
    Procedure Mine;
    Begin
      If (not LoggedIn) then
       Exit;
       MouseSpeed := RandomRange(14, 19);
       SetRock;
       repeat
         if(FindObjTPA(x, y, Rock, 7, 2, 20, 20, 12, Text))then //Added to make sure it found the obj before proceeding
         begin
           GetMousePos(x,y);
           Wait(50 + random(150));
           if(random(8) = 1)then
           begin
             Mouse(x, y, 0, 0, False); //Changed to 00 so it would click in the same spot it moved the mouse to
             ChooseOption('ine');
           end else
             Mouse(x, y, 0, 0, True); //Changed to 00 so it would click in the same spot it moved the mouse to
           AreWeStillMining; //Put here because it was called either way
         end;
       until (Invfull);
    end;



    For Drop, you should ues a Booleans instead of Strings since it is true/false:
    SCAR Code:
    procedure Drop;
    begin
     Inc(LoadsDone);
        if(Players[CurrentPlayer].Booleans[0])then
        begin
          for i:= 1 to 28 do
            DropAll;
          IncEx(LogsCut, 28); //Moved outside of loop so it doesn't repeat IncEx multiple times
          Exit;
        end;
        for i:= 2 to 28 do
          DropItem(i);
        IncEx(LogsCut, 27);; //Also moved outside loop
    end;

    Much more efficient too, without all the begins/ends. Just add to the player array that Booleans instead of Strings.
    Last edited by JAD; 10-15-2009 at 04:59 PM.

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

    Default

    And in your AntiBan procedure, you're missing an end again.
    <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.

  4. #4
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    There you go. This one compiles!. Some idetifiers just didnt exist. And the script basicly does nothing.

    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    Var x, y, Rock, LoadsDone,CantFind, AntibanUsed,i: Integer;
          Text: array of string;

    Procedure SetTree;
    begin

       case lowercase(Players[CurrentPlayer].Strings[0]) of
     'copper' :  begin
                    Rock := 5083645;
                    end;
       'tin'  :   begin
                    Rock := 9868957;
                    end;
       'iron' :   begin
                    Rock := 3029075;
                    end;
     'gold'   :   begin
                    Rock := 2344440;
     end;
     end;
     
      Text := ['ine', 'Min', 'in']
    end;

    Procedure AntiBan;
    begin
      if not LoggedIn then Exit;
        FindNormalRandoms;
        Inc(AntibanUsed);
        case 7+random(18) of
          0: HoverSkill('Random', false);
          1: PickUpMouse;
          3: BoredHuman;
          4: begin
               MakeCompass('N');
               wait(10+random(55));
               MakeCompass('S');
               wait(10+random(55));
               MakeCompass('N');
             end;
          5: RandomRClick;
          6: RandomMovement;
    end;
    end;

    Procedure AreWeStillMinning;
    Var
      Col, Fail,failed: Integer;
    begin
      Col := 0;

      if(findcolorspiraltolerance(x,y,Rock,msx1,msy1,msx2,msy2,25))then
        Col := GetColor(x,y);
       
          repeat
              wait(900+random(300));
              inc(failed);

          until(not(GetColor(x,y) = Col)or(Failed >= 9));

            if Failed = 9 then
              inc(CantFind);
              Antiban;
    end;


    Procedure MineIt;
    Begin
      If (not LoggedIn) then
       Exit;
       MouseSpeed := RandomRange(14, 19);
        begin
          // SetRock; Does not exist
            repeat
               FindObjTPA(x, y, Rock, 7, 2, 20, 20, 12, Text);
               GetMousePos(x,y);
               Wait(50 + random(150));
                if(random(8) = 1)then
                 begin
                   Mouse(x, y, 3, 3, False);
                   ChooseOption('ine');
                   AreWeStillMinning;
                 end else
                   begin
                    Mouse(x, y, 3, 3, True);
                    AreWeStillMinning;
                   end;
            until (Invfull);
        end;
    end;

    procedure Drop;
    begin
     Inc(LoadsDone);
        case lowercase(Players[CurrentPlayer].Strings[1]) of
        'true': begin
                 for i:= 1 to 28 do
                  begin
                    DropAll;
                    //IncEx(LogsCut, 28); Does not exist
                  end;
                end;
        'false': begin
                  for i:= 2 to 28 do
                   begin
                     DropItem(i);
                     //IncEx(LogsCut, 27);;Does not exist
                   end;
                 end;
        end;
    end;

    begin
    SetupSRL;
    end.

  5. #5
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by caused View Post
    There you go. This one compiles!. Some idetifiers just didnt exist. And the script basicly does nothing.
    well ive made no main loop it should not do nothing

    Edit: thanks JAD and caused
    Last edited by rya; 10-15-2009 at 05:05 PM.
    I see Now, says the blind man

  6. #6
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    now im getting
    Code:
     
    Line 14: [Error] (20563:6): colon (':') expected in script
    that is in the procedure SetTree that is now SetRock
    I see Now, says the blind man

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

    Default

    Quote Originally Posted by rya View Post
    now im getting
    Code:
     
    Line 14: [Error] (20563:6): colon (':') expected in script
    that is in the procedure SetTree that is now SetRock

    SCAR Code:
    (Players[CurrentPlayer].Strings[0])

    Doesn't exist?
    <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.

  8. #8
    Join Date
    Aug 2009
    Posts
    242
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by R1ch View Post
    SCAR Code:
    (Players[CurrentPlayer].Strings[0])

    Doesn't exist?
    Of course i hav'nt put the player fourm in yet
    I see Now, says the blind man

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
  •