Results 1 to 14 of 14

Thread: Semi-colon expected?

  1. #1
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default Semi-colon expected?

    I want to have 3 colors for each tree, and this is what I came up with:

    Line 163 I get the error, I marked it in script.

    SCAR Code:
    //Special thanks to Nava2, and everyone in the IRC chat who helped me out. :)

    program PowerChopper;
      {.Include SRL\SRL\Misc\SMART.SCAR}
      {.include SRL\SRL.scar}
      {.include SRL\SRL\Misc\Debug.scar}

    const
      RunOn = True;//Turn False if you want run on.

    var
      HatchetDTM : Array of Integer;
      x, y, c, NumOfLogs, TotalProggies : Integer;
      TreeColor : TIntegerArray;
      XpGain : TExtendedArray;
      TreePoint : TPoint;
     
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Players[0].Pin := '';
      Players[0].Strings[0] := 'willow';//Which tree to cut?
      Players[0].Integers[0] := 200;//How many logs to cut?
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume'];
     
     {Players[1].Name := '';
      Players[1].Pass := '';
      Players[1].Nick := '';
      Players[1].Active := True;
      Players[1].Pin := '';
      Players[1].Strings[0] := '';//Which tree to cut?
      Players[1].Integers[0] := 000;//How many logs to cut?
      Players[1].BoxRewards := ['Xp', 'mote', 'ostume'];}

    end;

    procedure S_FindRandoms;
    begin
      if FindFight then
        RunAway('N', True, 1, 5000);
      LampSkill := 'woodcutting';
      FindNormalRandoms;
    end;

    function S_LevelUp: Boolean;
    begin
      if ClickContinue(True, True)then
      begin
        Writeln('Congratulations, you have gained a Woodcutting level!');
        Result := True;
      end;
    end;

    procedure S_MyAntiBan;
    begin
      case Random(70) of
        0: RandomMovement;
        1: BoredHuman;
        2: HoverSkill('random', false);
        3: RandomRClick;
        4: begin
             case Random(2) of
               0: begin
                    KeyDown(VK_RIGHT);
                    Wait(50 + Random(1300));
                    KeyUp(VK_RIGHT);
                    Wait(60 + Random(2000));
                    KeyDown(VK_LEFT);
                    Wait(70 + Random(1100));
                    KeyUp(VK_LEFT);
                  end;
               1: begin
                    KeyDown(VK_LEFT);
                    Wait(50 + Random(1300));
                    KeyUp(VK_LEFT);
                    Wait(60 + Random(2000));
                    KeyDown(VK_RIGHT);
                    Wait(70 + Random(1100));
                    KeyUp(VK_RIGHT);
                  end;
              end;
           end;
        5: begin
             KeyDown(VK_LEFT);
             Wait(100 + Random(1200));
             KeyUp(VK_LEFT);
           end;
        6: begin
             KeyDown(VK_RIGHT);
             Wait(150 + Random(1100));
             KeyUp(VK_RIGHT);
           end;
        7..69:
      end;
    end;

    procedure S_HatchetDTMs;
    begin
     SetArrayLength(HatchetDTM, 7);//[0]:= Bronze, [6]:= Rune
       HatchetDTM[0] := DTMFromString('78DA630C646260D8C4C8800C7CAC9519F8813' +
           '44C94D113A86617AA1A982C5C8D1B50CD36026ABC816AD6125013' +
           '0C54B38E809A504C3763A80921EC1E00949107EF');
       HatchetDTM[1] := DTMFromString('78DA630C626260D8C4C8800C02BDBD19F8813' +
           '448F43F1030BA03D5EC47550391859140DA0DA8662B01355E4035' +
           '6B09A80906AA5947404D2850CD06026A42806AB6E157030033F30' +
           'C28');
       HatchetDTM[2] := DTMFromString('78DA630C626260D8C8C8800CCAF3F318F8813' +
           '448F43F10307A02D5EC40550391859140DA0DA8660B01355E4035' +
           '6B09A80904AA5947404D28A69BB1AAD98A5F0D0090050C8D');
       HatchetDTM[3] := DTMFromString('78DA63F4676260D8C0C8800C44454418F8813' +
           '448F43F1030BA03D5EC43550391859140DA05A8661701351E4035' +
           'EB09A80900AA5947404D28A69BB1AAD98A5F0D0095870B78');
       HatchetDTM[4] := DTMFromString('78DA630C646260D8C8C8800C1C1CE319F8813' +
           '44C94D10DA8E600AA1A982C5C8D2B50CD0E026A3C806A36105013' +
           '0054B38E809A504C3763A80901AAD9865F0D00C5940824');
       HatchetDTM[5] := DTMFromString('78DA63EC64626038C0C8800C9C829D18F8813' +
           '44C94B101A8E614AA1A982C8A9A7D04D4F402D5EC2742CD21026A' +
           '6A816AAEE05703006FA208C7');
       HatchetDTM[6] := DTMFromString('78DA638C676060E8614001AE31690CFC409A1' +
           '188FF0301633090B180010D302291403A1048CC22A0260448F413' +
           '501309243A08A84902129D04D42403895EFC6A00F1EB0B8F');
    end;

    procedure Cut_FindHatchet;
    var
      b: Boolean;
      i: Integer;
    begin
      GameTab(4);
      for i:= 0 to 6 do
        if(FindDTM(HatchetDTM[i], x, y, MIX1, MIY1, MIX2, MIY2))then
        begin
          b:= True;
          Break;
        end;
        if(b = True)then
          Writeln('Found hatchet.')
        else
        begin
          Writeln('Didn''t find hatchet, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      FreeDTM(HatchetDTM[i]);
    end;

    procedure Cut_TreeColors;
    begin
      SetArrayLength(TreeColor, 12);
        TreeColor := [1525050, 2451291, 6266770,
                      3439727, 1065011, 1199164,
                      7774605, 10075304, 6260601,
                      4295550, 1718835, 4623230];
      case LowerCase(Players[CurrentPlayer].Strings[0])of
        'tree': c := 0..2;//Error in this line.
        'oak': c := 3..5;
        'willow': c := 6..8;
        'yew': c := 9..11;
      else
        begin
          Writeln('No tree specified, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      end;
    end;

    function Cut_TreeCutDown: Boolean;
    var
      TrCols : TPointArray;
    begin
      FindColorsTolerance(TrCols, TreeColor[c], TreePoint.x - 25, TreePoint.y - 25, TreePoint.x + 25, TreePoint.y + 25, 18);
      if(Length(TrCols) < 10)then
      begin
        //Writeln('Tree has been cut down.');
        Result := True;
      end;
    end;

    procedure Cut_ChopTrees;
    var
      fx, fy, k : Integer;//fx, fy : Temp. coords.
      s, e : String;
      TPA : TPointArray;
      T2D : T2DPointArray;
    begin
      ColorToleranceSpeed(2);
      repeat
        FindColorsSpiralTolerance(fx, fy, TPA, TreeColor[c], MSX1, MSY1, MSX2, MSY2, 18);//Stores the color's x, y coords as TPoints.
        T2D := SplitTPAEx(TPA, 6, 6);//Splits TPA into boxes.
        DebugATPA(T2D, '');
        if Length(T2D) = 0 then Exit;
        SortATPAFromFirstPoint(T2D, Point(MSCX, MSCY));

        for k := 0 to High(T2D) do
        begin
          Writeln('Length:' + IntToStr(Length(T2D[k])));
          if(Length(T2D[k]) < 50)then Continue;
          MiddleTPAEx(T2D[k], fx, fy);//Stores coords of the middle TPointArray to x, y.
          Wait(30 + Random(20));
          MMouse(fx, fy, 4, 4);
          s := RS_GetUpText;
          e := Players[CurrentPlayer].Strings[0];
          if((Pos('hop', s) > 0) and (Pos(Copy(e, 2, Length(e)), s) > 0))then
          begin
            GetMousePos(x, y);
            Wait(80 + Random(100));
            Mouse(x, y, 4, 4, True);
            TreePoint := IntToPoint(x, y);
            repeat
              S_MyAntiBan;
              Wait(80 + Random(5000));
              S_LevelUp;
              Continue;
            until(Cut_TreeCutDown or InvFull);
          end;
        end;
      until(InvFull or not LoggedIn);
      ColorToleranceSpeed(1);
    end;

    procedure Cut_DropLogs;
    var a : Integer;
    begin
      if(InvFull)then
      begin
        Wait(80 + Random(100));
        for a := 2 to 28 do
          DropItem(a);
        NumOfLogs := NumOfLogs + 27;
        if(NumOfLogs >= Players[CurrentPlayer].Integers[0])then
        begin
          Writeln('Cut desired number of logs, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      end;
      S_FindRandoms;
    end;

    {****************************
     Function Prg_PlayerActivity;
     By: Drags111
     ****************************}


    function Prg_PlayerActive(i : Integer): String;
    begin
      if Players[i].Active then Result := 'T' else Result := 'F';
    end;

    procedure Prg_ExpGained(var g : Integer);
    begin
      SetArrayLength(XpGain, 4)
        XpGain := [25, 37.5, 67.5, 175];
      case Lowercase(Players[CurrentPlayer].Strings[0])of
        'tree' : g := 0;
        'oak' : g := 1;
        'willow' : g := 2;
        'yew' : g := 3;
      end;
    end;
     

    procedure Prg_ProgReport;
    var
      i, g : Integer;
    begin
      Prg_ExpGained(g);
      Players[i].Integers[9] := NumOfLogs / 27;
      Players[i].Integers[10] := NumOfLogs;
      Inc(TotalProggies);
      Writeln(' _______________________________________________');
      Writeln(PadR('|            Coh3n''s Power Chopper', 48) + '|');
      Writeln('|_________________First Script__________________|');
      Writeln('|                                               |');
      Writeln(PadR('|  Time run: ' + TimeRunning, 48) + '|');
      Writeln(PadR('|  Loads: ' + IntToStr(NumOfLogs / 27), 48) + '|');
      Writeln(PadR('|  Logs: ' + IntToStr(NumOfLogs), 48) + '|');
      Writeln(PadR('|  Exp Gained: ' + FloatToStr(NumOfLogs * XpGain[g]), 48) + '|');
      Writeln('|_______________________________________________|');
      Writeln('|________________Player''s Stats_________________|');
     {Writeln('|      ____      ___      _____      ____       |');}
      Writeln('|      Nick      T/F      Loads      Logs       |');
      Writeln('|      ¯¯¯¯      ¯¯¯      ¯¯¯¯¯      ¯¯¯¯       |');
      for i := 0 to High(Players)do
        Writeln('|      ' + PadR(Players[i].Nick, 10) + PadR(Prg_PlayerActive(i), 9)
                          + PadR(IntToStr(Players[i].Integers[9]), 11)
                          + PadR(IntToStr(Players[i].Integers[10]), 11) + '|');
      Writeln('|_______________________________________________|');
    end;

    procedure F_Setup;
    begin
      ClearDebug;
      SMARTSetupEx(152, False, True, False);
      Wait(5000);
      SetTargetDC(SmartGetDC);
      SetupSRL;
      ActivateClient;
      DeclarePlayers;
      LoginPlayer;
      SetAngle(True);
      if RunOn then SetRun(True);
      S_HatchetDTMs;
      Cut_FindHatchet;
    end;

    begin
      F_Setup;
      repeat
        repeat
          if(ExistsItem(1))then
          begin
            Cut_TreeColors;
            repeat
              Cut_ChopTrees;
              S_FindRandoms;
            until(InvFull);
            Cut_DropLogs;
            Prg_ProgReport;
          end;
        until(NumOfLogs >= Players[CurrentPlayer].Integers[0])or(not LoggedIn);
        NextPlayer(False);
      until False;
    end.

    Not sure why I get that, and I don't know if that's the best way to write it. Please tell me if there's a better way.

    Thanks.
    Last edited by Coh3n; 06-15-2009 at 05:59 AM.

  2. #2
    Join Date
    Jul 2007
    Posts
    1,055
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    post entire script?

  3. #3
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by osmm View Post
    post entire script?
    Done.

  4. #4
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    try
    SCAR Code:
    'tree': c := [0..2];

    and if that doesn't work then try
    SCAR Code:
    'tree': c = 0..2;

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    I tried the first one originally and got "Close bracket expected" and the second one got "Assignment expected".

  6. #6
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Use:
    scar Code:
    'tree': c := [1, 2];
    'oak': c := [3, 4, 5];
    etc


  7. #7
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    Use:
    scar Code:
    'tree': c := [1, 2];
    'oak': c := [3, 4, 5];
    etc
    I get "Type Mismatch" doing that..

  8. #8
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I found your error, c is an Integer the correct variable is TreeColor


  9. #9
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Or make C an TIntegerArray?
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  10. #10
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    I found your error, c is an Integer the correct variable is TreeColor
    That doesn't work either, unless I did it wrong. I just replaced c with TreeColor.

    Quote Originally Posted by noidea View Post
    Or make C an TIntegerArray?
    That didn't work either.

    This is what I had originally and it worked.

    SCAR Code:
    procedure Cut_TreeColors;
    begin
      SetArrayLength(TreeColor, 4);
        TreeColor := [6266770, 1199164, 7774605, 1718835];//10075304
      case LowerCase(Players[CurrentPlayer].Strings[0])of
        'tree': c := 0;
        'oak': c := 1;
        'willow': c := 2;
        'yew': c := 3;
      else
        begin
          Writeln('No tree specified, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      end;
    end;

    I just want to add 2 more colors for each tree, I didn't think it would be this difficult. Lol.

  11. #11
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure Cut_TreeColors;
    begin
      TreeColor := [6266770, 1199164, 7774605, 1718835];//10075304
      case LowerCase(Players[CurrentPlayer].Strings[0])of
        'tree': c := TreeColor[0];
        'oak': c := TreeColor[1];
        'willow': c := TreeColor[2];
        'yew': c := TreeColor[3];
      else
        begin
          Writeln('No tree specified, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      end;
    end;

    The one you originally had would work of course, but would be REALLY off as it is set to 0, 1, 2, or 3. Those colors shouldn't be found in RuneScape (maybe 0). So you should set it to what is in TreeColors at the correct index.

    I will work on fixing your multiple colors thing now and will edit this when it is complete.

    Edit: There you go
    SCAR Code:
    procedure Cut_TreeColors;
    begin
      SetArrayLength(TreeColor, 12);
        TreeColor := [1525050, 2451291, 6266770,
                      3439727, 1065011, 1199164,
                      7774605, 10075304, 6260601,
                      4295550, 1718835, 4623230];
      case LowerCase(Players[CurrentPlayer].Strings[0])of
        'tree': c := TIntegerArray([TreeColor[0], TreeColor[1], TreeColor[2]]);//Error in this line.
        'oak': c := TIntegerArray([TreeColor[3], TreeColor[4], TreeColor[5]]);
        'willow': c :=TIntegerArray([TreeColor[6], TreeColor[7], TreeColor[8]]);
        'yew': c := TIntegerArray([TreeColor[9], TreeColor[10], TreeColor[11]]);
      else
        begin
          Writeln('No tree specified, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      end;
    end;
    You will have to edit your chop procedure as c is no longer an integer pointing to an index.
    Last edited by Da 0wner; 06-15-2009 at 07:06 AM.

  12. #12
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Da 0wner View Post
    Edit: There you go
    You will have to edit your chop procedure as c is no longer an integer pointing to an index.
    Tyvm!

    But how would I edit the drop procedure so it finds the right colors?

    EDIT: It gets a "Type Mismatch error"?

    And would you be able to write this line(s):

    SCAR Code:
    'tree': c := TIntegerArray([TreeColor[0], TreeColor[1], TreeColor[2]]);

    Like this:

    SCAR Code:
    'tree': c := TIntegerArray([TreeColor[0..2]);

    To my knowledge that's still right, right?
    Last edited by Coh3n; 06-15-2009 at 07:18 AM.

  13. #13
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    function FindColorsMultiTolerance(var ATPA : T2DPointArray; Colors : TIntegerArray; x1, y1, x2, y2, Min, Tol : integer) : boolean;
    var
      i, h, t : integer;
    begin
      h := high(Colors);
      SetArrayLength(ATPA, h + 1);
      for i := 0 to h do
        if FindColorsTolerance(ATPA[i], Colors[i], x1, y1, x2, y2, Tol) then
          inc(t);
      if t >= Min then
        result := true;
    end;

    function Cut_TreeCutDown: Boolean;
    var
      TrCols : T2DPointArray;
      i : integer;
    begin
      FindColorsMultiTolerance(TrCols, c, TreePoint.x - 25, TreePoint.y - 25, TreePoint.x + 25, TreePoint.y + 25, 3, 18);
      for i := 0 to 2 do
      begin
        if Length(TrCols[i]) > 10 then
          Continue;
        result := true;
      end;
    end;

    You can try editing your chop procedure to fix it. All you need to change is make a for to do loop through the colors.

  14. #14
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Okay, this is getting a little confusing and complicated. I'm not really understanding all of this.

    SCAR Code:
    procedure Cut_TreeColors;
    begin
      SetArrayLength(TreeColor, 4);
        TreeColor := [6266770, 1199164, 7774605, 1718835];//10075304
      case LowerCase(Players[CurrentPlayer].Strings[0])of
        'tree': c := 0;
        'oak': c := 1;
        'willow': c := 2;
        'yew': c := 3;
      else
        begin
          Writeln('No tree specified, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      end;
    end;

    Quote Originally Posted by Da 0wner View Post
    The one you originally had would work of course[the one I originally had is above], but would be REALLY off as it is set to 0, 1, 2, or 3. Those colors shouldn't be found in RuneScape (maybe 0).
    The "0, 1, 2, 3" aren't colors, they're the TreeColors[0] etc. and it works fine, it finds the trees, chops them, all is well. So I don't understand why it would be way off when it's working fine. I also used the same format for my Prg_EXPGained procedure, and it works fine. I'm not questioning your intelligence or anything because I guarantee it's 10x better than mine. Lol. I just think maybe you misunderstood what I was trying to do.

    I honestly don't understand why this procedure wouldn't work, when the one above works perfectly.

    SCAR Code:
    procedure Cut_TreeColors;
    begin
      SetArrayLength(TreeColor, 12);
        TreeColor := [1525050, 2451291, 6266770,
                      3439727, 1065011, 1199164,
                      7774605, 10075304, 6260601,
                      4295550, 1718835, 4623230];
      case LowerCase(Players[CurrentPlayer].Strings[0])of
        'tree': c := [0..2];//This line is the error.
        'oak': c := [3..5];
        'willow': c := [6..8];
        'yew': c := [9..11];
      else
        begin
          Writeln('No tree specified, logging out.');
          Wait(80 + Random(100));
          Logout;
          Players[CurrentPlayer].Active := False;
          Exit;
        end;
      end;
    end;

    The procedure above I get:

    Line 163: [Error] (18731:16): Closing square bracket (']') expected in script
    All want is for the first 3 colors to be for Trees, the second 3 colors for Oak Trees, and so on. It's not complicated. I'm sorry if I sound bitter, but everything I seem to be doing lately isn't working, and it's very frustrating. I just need a nice, simply put answer to help me understand why the second above procedure doesn't work.

    Thank you.
    Last edited by Coh3n; 06-15-2009 at 08:02 AM.

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
  •