Results 1 to 14 of 14

Thread: Syntax Error?

  1. #1
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Syntax Error?

    I dont understand why i'm getting a syntax error:
    SCAR Code:
    Failed when compiling
    Line 156: [Error] (17141:21): Syntax error in script C:\SCAR 3.15\Scripts\Powerminerv2.scar

    Because 19 lines up also uses the
    SCAR Code:
    if (not(FindGas(x,y))) then

    and i'm not getting an error for that

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


    function FindObjectTin(var fx, fy: Integer): Boolean;
    var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      if not(FindColorsTolerance(arP, 6118756, MSX1, MSY1, MSX2, MSY2, 113)) then
      begin
        Writeln('Failed to find the color, tin not found.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      arUC := arC;
      ClearSameIntegers(arUC);
      arL := High(arUC);
      arL2 := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 0.00) and (H <= 3.35) and (S >= 3.14) and (S <= 6.40) and (L >= 12.14) and (L <= 63.16) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 1.27) and (X <= 33.76) and (Y >= 1.31) and (Y <= 34.38) and (Z >= 1.40) and (Z <= 35.88) then
          begin
            for j := 0 to arL2 do
            begin
              if (arUC[i] = arC[j]) then
              begin
                SetLength(arAP, Length(arAP) + 1);
                arAP[High(arAP)] := arP[j];
              end;
            end;
          end;
        end;
      end;

      SortTPAFrom(arAP, Point(MSCX, MSCY));
      ararP := SplitTPAEx(arAP, 10, 10);
      arL := High(ararP);

      for i := 0 to arL do
      begin
        if (Length(ararP[i]) < 10) then Continue;
        P := MiddleTPA(ararP[i]);
        MMouse(P.x, P.y, 5, 5);
        Wait(100 + Random(100));
        if (IsUpText('Mine')) then
        begin;
          Result := True;
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
      begin
        Writeln('FindObjectTin could not find Tin.');
        Exit;
      end;

      GetMousePos(fx, fy);
    end;


    function AutoColorTin: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 6118756, MSX1, MSY1, MSX2, MSY2, 113);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 0.00) and (H <= 3.35) and (S >= 3.14) and (S <= 6.40) and (L >= 12.14) and (L <= 63.16) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 1.27) and (X <= 33.76) and (Y >= 1.31) and (Y <= 34.38) and (Z >= 1.40) and (Z <= 35.88) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    procedure TinProcess;//find the tin, mines it, then drops it
    var
    x,y:integer;
    begin
    repeat
      if (FindObjectTin(x,y)) then
        begin
          FindPick;
          if (not(FindGas(x,y))) then
            begin
              MMouse(x,y,0,0);
              if (IsUpText('Mine')) then
                begin
                  Mouse(x,y,0,0,true);
                  wait(200+random(700))
                end else
                  begin
                    Mouse(x,y,0,0,false);
                    ChooseOption('Mine');
                    wait(250+random(700));
                   end;
            end;
        end else
        begin
          if (FindColor(x,y,AutoColorTin,MSX1, MSY1, MSX2, MSY2)) then
            begin
              FindPick;
              if (not(FindGas(x,y,))) then
                begin
                  MMouse(x,y,0,0);
                  if (IsUpText('Mine')) then
                    begin
                      Mouse(x,y,0,0,true);
                      wait(200+random(700))
                    end else
                      begin
                        Mouse(x,y,0,0,false);
                        ChooseOption('Mine');
                        wait(250+random(700));
                      end;
                    end;
                end;
            end;
        end else
        begin
          Writeln('Couldnot find the tin rock, LoggingOut');
          Logout;
          TerminateScript;
        end;
    until(InvFull = True);
    begin
      MMouse(576,225,0,0);
      if (IsUpText('Weil')) then
        begin
          DropItem(2);
          DropItem(3);
          DropItem(4);
          DropItem(5);
          DropItem(6);
          DropItem(7);
          DropItem(8);
          DropItem(9);
          DropItem(10);
          DropItem(11);
          DropItem(12);
          DropItem(13);
          DropItem(14);
          DropItem(15);
          DropItem(16);
          DropItem(17);
          DropItem(18);
          DropItem(19);
          DropItem(20);
          DropItem(21);
          DropItem(22);
          DropItem(23);
          DropItem(24);
          DropItem(25);
          DropItem(26);
          DropItem(27);
          DropItem(28);
        end else
          begin
            DropAll;
          end;
    end;
    end;



    begin
      SetupSRL;
      FindPickHeadColor;
      TinProcess;
    end;

    Thats the full script
    BarbvilleCoalMinerAndBanker
    80% complete
    AutoPCTrainer
    60% complete

    Quote Originally Posted by whereyouat07 View Post
    [Runtime Error] : Out Of Range in line 68 in script C:\Users\Oliver\AppData\Local\Microsoft\Windows\Te mporary Internet Files\Low\Content.IE5\OB8J6FUC\LumbyNewbie%20V0.9[1].scar

    what the hell is this lol?
    Quote Originally Posted by TravisV10 View Post
    An error (h)

  2. #2
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Do you mind telling me what part you got the error on?

    The SCAR tags lack numbered lines.

  3. #3
    Join Date
    Sep 2007
    Posts
    638
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    if (not(FindGas(x,y,))) then

    should be

    SCAR Code:
    if (not(FindGas(x,y))) then

    extra comma

  4. #4
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OMGOSH thats so dumb

    thanks aser
    BarbvilleCoalMinerAndBanker
    80% complete
    AutoPCTrainer
    60% complete

    Quote Originally Posted by whereyouat07 View Post
    [Runtime Error] : Out Of Range in line 68 in script C:\Users\Oliver\AppData\Local\Microsoft\Windows\Te mporary Internet Files\Low\Content.IE5\OB8J6FUC\LumbyNewbie%20V0.9[1].scar

    what the hell is this lol?
    Quote Originally Posted by TravisV10 View Post
    An error (h)

  5. #5
    Join Date
    Jan 2009
    Location
    canada
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well i was also looking for the same thing thanks aser .

  6. #6
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Fixed it =) yay!
    and it compiles, but its SUPER SLOW! like it waits 40 seconds inbetween finding the Tin. at first i didn't even think worked -_-

    Can any one lead me in the direction of making it not super slow?

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


    function FindObjectTin(var fx, fy: Integer): Boolean;
    var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      if not(FindColorsTolerance(arP, 6118756, MSX1, MSY1, MSX2, MSY2, 113)) then
      begin
        Writeln('Failed to find the color, tin not found.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      arUC := arC;
      ClearSameIntegers(arUC);
      arL := High(arUC);
      arL2 := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 0.00) and (H <= 3.35) and (S >= 3.14) and (S <= 6.40) and (L >= 12.14) and (L <= 63.16) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 1.27) and (X <= 33.76) and (Y >= 1.31) and (Y <= 34.38) and (Z >= 1.40) and (Z <= 35.88) then
          begin
            for j := 0 to arL2 do
            begin
              if (arUC[i] = arC[j]) then
              begin
                SetLength(arAP, Length(arAP) + 1);
                arAP[High(arAP)] := arP[j];
              end;
            end;
          end;
        end;
      end;

      SortTPAFrom(arAP, Point(MSCX, MSCY));
      ararP := SplitTPAEx(arAP, 10, 10);
      arL := High(ararP);

      for i := 0 to arL do
      begin
        if (Length(ararP[i]) < 10) then Continue;
        P := MiddleTPA(ararP[i]);
        MMouse(P.x, P.y, 5, 5);
        Wait(100 + Random(100));
        if (IsUpText('Mine')) then
        begin;
          Result := True;
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
      begin
        Writeln('FindObjectTin could not find Tin.');
        Exit;
      end;

      GetMousePos(fx, fy);
    end;


    function AutoColorTin: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 6118756, MSX1, MSY1, MSX2, MSY2, 113);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 0.00) and (H <= 3.35) and (S >= 3.14) and (S <= 6.40) and (L >= 12.14) and (L <= 63.16) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 1.27) and (X <= 33.76) and (Y >= 1.31) and (Y <= 34.38) and (Z >= 1.40) and (Z <= 35.88) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    procedure TinProcess;//find the tin, mines it, then drops it
    var
    x,y:integer;
    begin
      repeat
      if (FindObjectTin(x,y)) then
        begin
          FindPick;
          if (not(FindGas(x,y))) then
            begin
              MMouse(x,y,0,0);
              if (IsUpText('Mine')) then
                begin
                  Mouse(x,y,0,0,true);
                  wait(200+random(700))
                end else
                  begin
                    Mouse(x,y,0,0,false);
                    ChooseOption('Mine');
                    wait(250+random(700));
                   end;
            end;
        end else
        begin
          if (FindColor(x,y,AutoColorTin,MSX1, MSY1, MSX2, MSY2)) then
            begin
              FindPick;
              if (not(FindGas(x,y))) then
                begin
                  MMouse(x,y,0,0);
                  if (IsUpText('Mine')) then
                    begin
                      Mouse(x,y,0,0,true);
                      wait(200+random(700))
                    end else
                      begin
                        Mouse(x,y,0,0,false);
                        ChooseOption('Mine');
                        wait(250+random(700));
                      end;
                    end;
                end;
            end;
    until(InvFull = True);
    begin
      DropAll;
      end;
    end;


    begin
      SetupSRL;
      FindPickHeadColor;
      TinProcess;
    end.
    BarbvilleCoalMinerAndBanker
    80% complete
    AutoPCTrainer
    60% complete

    Quote Originally Posted by whereyouat07 View Post
    [Runtime Error] : Out Of Range in line 68 in script C:\Users\Oliver\AppData\Local\Microsoft\Windows\Te mporary Internet Files\Low\Content.IE5\OB8J6FUC\LumbyNewbie%20V0.9[1].scar

    what the hell is this lol?
    Quote Originally Posted by TravisV10 View Post
    An error (h)

  7. #7
    Join Date
    Sep 2007
    Posts
    638
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It appears that it has to run through the whole script before it gets to the mining part. I noticed that some of the if thens had a lot of ands on them. That might cause slowdown.
    Try putting a repeat on the tin process and it should only take a long time when you first start the script.

    EDIT: Sorry I missed the repeat...but

    SCAR Code:
    Until (InvFull = True);

    is bad to have. You need to equip it with better failsafes.

  8. #8
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Aser View Post
    It appears that it has to run through the whole script before it gets to the mining part. I noticed that some of the if thens had a lot of ands on them. That might cause slowdown.
    Try putting a repeat on the tin process and it should only take a long time when you first start the script.

    EDIT: Sorry I missed the repeat...but

    SCAR Code:
    Until (InvFull = True);

    is bad to have. You need to equip it with better failsafes.
    why is
    SCAR Code:
    Until (InvFull = True);
    bad to have?

    So would it help if i just took out the whole drop process? then just added

    SCAR Code:
    begin
      SetupSRL;
      repeat
      TinProcess;
      until(InvFull = True);
       begin
         DropAll;
       end;
    end.
    BarbvilleCoalMinerAndBanker
    80% complete
    AutoPCTrainer
    60% complete

    Quote Originally Posted by whereyouat07 View Post
    [Runtime Error] : Out Of Range in line 68 in script C:\Users\Oliver\AppData\Local\Microsoft\Windows\Te mporary Internet Files\Low\Content.IE5\OB8J6FUC\LumbyNewbie%20V0.9[1].scar

    what the hell is this lol?
    Quote Originally Posted by TravisV10 View Post
    An error (h)

  9. #9
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Instead of using
    SCAR Code:
    until(InvFull = True);

    Just use
    SCAR Code:
    until(InvFull);

    because if it returns true, it returns as itself.

  10. #10
    Join Date
    Sep 2007
    Posts
    638
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Until (InvFull = True);
    is bad because it is easy to get stuck in an endless loop. What if somehow you get away from the rock or a random gets you. It will just sit around trying to mine tin until you stop it.

    I don't remember exactly buy you need to search for tutorials on MarkTime and TimeFromMark. Also JAD has a pretty good tutorial on fail safes.

  11. #11
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oops double post -_-
    BarbvilleCoalMinerAndBanker
    80% complete
    AutoPCTrainer
    60% complete

    Quote Originally Posted by whereyouat07 View Post
    [Runtime Error] : Out Of Range in line 68 in script C:\Users\Oliver\AppData\Local\Microsoft\Windows\Te mporary Internet Files\Low\Content.IE5\OB8J6FUC\LumbyNewbie%20V0.9[1].scar

    what the hell is this lol?
    Quote Originally Posted by TravisV10 View Post
    An error (h)

  12. #12
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    begin
          if (FindColor(x,y,AutoColorTin,MSX1, MSY1, MSX2, MSY2)) then
            begin
              FindPick;
              if (not(FindGas(x,y))) then
                begin
                  MMouse(x,y,0,0);
                  if (IsUpText('Mine')) then
                    begin
                      Mouse(x,y,0,0,true);
                      wait(200+random(700))
                    end else
                      begin
                        Mouse(x,y,0,0,false);
                        ChooseOption('Mine');
                        wait(250+random(700));
                      end;
                    end;
                end;
        end else
        begin
          Writeln('Couldnot find the tin rock, LoggingOut');
          Logout;
          TerminateScript;
        end;


    if it doesn't find the color, it logs out and terminates the script.
    but i'll chek out those tutorials =)



    if figured out it was just the findobj function -_- was being realy slow. got rid of it and works fine
    BarbvilleCoalMinerAndBanker
    80% complete
    AutoPCTrainer
    60% complete

    Quote Originally Posted by whereyouat07 View Post
    [Runtime Error] : Out Of Range in line 68 in script C:\Users\Oliver\AppData\Local\Microsoft\Windows\Te mporary Internet Files\Low\Content.IE5\OB8J6FUC\LumbyNewbie%20V0.9[1].scar

    what the hell is this lol?
    Quote Originally Posted by TravisV10 View Post
    An error (h)

  13. #13
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Try it with lower tolerance. With tol 113 it's going to be sorting through a lot of colors.

  14. #14
    Join Date
    Dec 2008
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    works =) thanks
    BarbvilleCoalMinerAndBanker
    80% complete
    AutoPCTrainer
    60% complete

    Quote Originally Posted by whereyouat07 View Post
    [Runtime Error] : Out Of Range in line 68 in script C:\Users\Oliver\AppData\Local\Microsoft\Windows\Te mporary Internet Files\Low\Content.IE5\OB8J6FUC\LumbyNewbie%20V0.9[1].scar

    what the hell is this lol?
    Quote Originally Posted by TravisV10 View Post
    An error (h)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Line 135: [Error] (14845:1): Syntax error in script
    By AbsTrACt'^.| in forum OSR Help
    Replies: 16
    Last Post: 05-23-2008, 01:14 PM
  2. Syntax error(need help.)
    By weequ in forum OSR Help
    Replies: 9
    Last Post: 04-04-2008, 04:54 AM
  3. Replies: 5
    Last Post: 02-26-2008, 04:14 PM

Posting Permissions

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