Results 1 to 17 of 17

Thread: Semicolon expected?

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

    Default Semicolon expected?

    I made this script in like 3 minutes. Lol.
    I figured there'd be an error, but I also figured I could solve it..
    Here it is:

    SCAR Code:
    function findTrees(rx, ry: integer; colors: tintegerarray): boolean;
    var
      i, count: integer;
      tTPA: TPointArray;
      aTPA: T2DPointArray;
    begin
      count := High(colors);
      for i := 0 to count do
        begin
          FindColorsSpiralTolerance(rx, ry, tTPA, colors[i], MSX1, MSY1, MSX2, MSY2, 5);
        end;
      aTPA := SplitTPA(tTPA, 5);
      count := High(aTPA);
      for i := 0 to count do
        begin
          MMouse(aTPA[i].x, aTPA[i].y, 0, 0);    //Line 19: [Error] (16352:16): Semicolon (';') expected in script
          Wait(250+Random(250));
          if IsUpText('Chop') then
            begin
              Mouse(aTPA[i].x, aTPA[i].y, 0, 0, False);
              Wait(250+Random(250));
              if ChooseOption('Chop') then
                begin
                  Result := True
                  Exit;
                end else
                  WriteLn('No ChooseOption..');
            end else
              WriteLn('No UpText..');
    end;

  2. #2
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    putting standard in can help you find out where the bugs are
    SCAR Code:
    function findTrees(rx, ry: integer; colors: tintegerarray): boolean;
    var
      i, count: integer;
      tTPA: TPointArray;
      aTPA: T2DPointArray;
    begin
      count := High(colors);
      for i := 0 to count do
      begin
        FindColorsSpiralTolerance(rx, ry, tTPA, colors[i], MSX1, MSY1, MSX2, MSY2, 5);
      end;
      aTPA := SplitTPA(tTPA, 5);
      count := High(aTPA);
      for i := 0 to count do
      begin
        MMouse(aTPA[i].x, aTPA[i].y, 0, 0);    //Line 19: [Error] (16352:16): Semicolon (';') expected in script
        Wait(250+Random(250));
        if IsUpText('Chop') then
        begin
          Mouse(aTPA[i].x, aTPA[i].y, 0, 0, False);
          Wait(250+Random(250));
          if ChooseOption('Chop') then
          begin
            Result := True
            Exit;
          end else
          WriteLn('No ChooseOption..');
        end else
        WriteLn('No UpText..');
      end;
    end;
    that should work

    ~shut

  3. #3
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    aTPA is a T2D Array, you can't just have [i] for that

    edit:
    oh and you missed a end; like Shuttleu pointed out

    SCAR Code:
    function findTrees(rx, ry: integer; colors: tintegerarray): boolean;
    var
      i, count: integer;
      tTPA: TPointArray;
      aTPA: T2DPointArray;
      TP: TPoint; //Added variable
    begin
      count := High(colors);
      for i := 0 to count do
        begin
          FindColorsSpiralTolerance(rx, ry, tTPA, colors[i], MSX1, MSY1, MSX2, MSY2, 5);
        end;
      aTPA := SplitTPA(tTPA, 5);
      count := High(aTPA);
      for i := 0 to count do
        begin
          TP := MiddleTPA(aTPA[i]); //added this whole line
          MMouse(TP.x, TP.y, 0, 0); //Changed to TP.x, TP.y
          Wait(250+Random(250));
          if IsUpText('Chop') then
           begin
             Mouse(TP.x, TP.y, 0, 0, False);//Changed to TP.x, TP.y
             Wait(250+Random(250));
             if ChooseOption('Chop') then
              begin
                Result := True
                Exit;
              end else
               WriteLn('No ChooseOption..');
           end else
            WriteLn('No UpText..');
        end; //added end;
    end;
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    Narcle, can you indepthly explain to me what you changed please..

  5. #5
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

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

    Default

    Narcle's worked, still waiting on an explanation..

  7. #7
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by TheVoiceInYourHead View Post
    Narcle, can you indepthly explain to me what you changed please..
    aTPA := SplitTPA(tTPA, 5);
    Here you are splitting "TPA" into a T2D array.

    TP := MiddleTPA(aTPA[i]);
    MiddleTPA gets the middle point of the TPA, because aTPA is a array of arrays, the first array is converted to a middle point first. aTPA[i] is a array by itself so then have TP declared this center point of aTPA[i]. Thus it will go from 0 to High(aTPA) looking at all the mid-points.

    Is that enough in depth?
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    I still don't really understand the last part.

  9. #9
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Alright... ummm

    TPA: Array of TPoints; [same as TPointArray]
    ATPA; Array of Array of TPoints; [Same as T2DPointArray]

    TPA := ATPA[i];
    ATPA := [TPA, TPA, TPA, TPA];

    So Middle(ATPA[i]) is like Middle(TPA)

    I think a visual makes it easier to understand.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

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

    Default

    So, aTPA is multiple TPAs..So aTPA[i] is 1 TPA inside aTPA, and MiddleTPA(aTPA[i]) is the middle of the i TPA?

  11. #11
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by TheVoiceInYourHead View Post
    So, aTPA is multiple TPAs..So aTPA[i] is 1 TPA inside aTPA, and MiddleTPA(aTPA[i]) is the middle of the i TPA?
    Exactly. You got it.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  12. #12
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  13. #13
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Simple way of looking at it.

    TPointArray = Array of TPoint

    T2DPointArray = Array of Array of TPoint

    T3DPointArray = Array of Array of Array of TPoint

    Everytime you see Array it means you have to specify which piece you are talking about.

    Also, more specific to your function, when you Used ATPA[i] that is actually talking about a WHOLE TPointArray! You can't quite mouse each of those . You need to use MiddleTPA. Aka, what narcle posted!
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

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

    Default

    Quote Originally Posted by Narcle View Post
    Exactly. You got it.
    So does that mean that the middle of aTPA if the length were 5 would be 3?

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

    Default

    2.5 but I suppose SCAR would round it, unless you wanted it as a float.

  16. #16
    Join Date
    Jun 2008
    Posts
    0
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    it dont work on me

  17. #17
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by TheVoiceInYourHead View Post
    So does that mean that the middle of aTPA if the length were 5 would be 3?
    like Naum said it would be 2/3 depending what Round function you use

    Technically I think it does this:

    TPoint.x := (1.x + 2.x + 3.x + 4.x + 5.x)/5
    TPoint.y := (1.y + 2.y + 3.y + 4.y + 5.y)/5

    TPoint := (TPAs added, x/y separate) / GetArrayLength(TPA)

    That's just my guess, Wizzup would know exactly since it's in his plugin.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Semicolon expected in script (?)
    By Fabis in forum OSR Help
    Replies: 2
    Last Post: 03-27-2008, 05:14 PM
  2. Semicolon Expected
    By Lee Lok Hin in forum OSR Help
    Replies: 4
    Last Post: 03-06-2008, 12:43 AM
  3. Semicolon expected?
    By Johura in forum OSR Help
    Replies: 8
    Last Post: 04-17-2007, 06:02 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
  •