Results 1 to 9 of 9

Thread: Help w/ Procedure

  1. #1
    Join Date
    Mar 2009
    Location
    Antaractica, Penguin Drive
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help w/ Procedure

    Weeel, since my other yew cutting script was a failure, I decided to try the same script in Reflection, and I am getting an error like this:
    [Error] (24460:4): Identifier expected

    I suspect it is a problem with this procedure:
    SCAR Code:
    procedure NewYew;
    var
      OtherTree, NormalTrees: TPoint;
      NearTree: TPoint;
    begin
      if not FindYew then
      begin
        if Debug then WriteLn('No trees found, going to Tree 3.');
        SetLoc('Going to the far tree.');
        OtherTree := Point(3219, 3502);
        WalkToTile(OtherTree, 1, 1);
        NearTree := GetMyPos;
        if PointInBox(NearTree, IntToBox(3218, 3503, 3220, 3501)) then
        begin
          FindYew;
          if not FindYew then
          begin
            if Debug then WriteLn('Tree not found, going back.');
            SetLoc('Returning from the far tree');
            NormalTrees := Point(3207, 3501);
            WalkToTile(NormalTrees, 1, 1);
            NearTree := GetMyPos;
            if PointInBox(NearTree, IntToBox(3206, 3502, 3208, 3500)) then
            begin
              repeat
                Wait(100);
                AntiRandoms;
                AntiBan;
              until(FindYew);
            end else
            begin
              NearTree := GetMyPos;
              if PointInBox(NearTree, IntToBox(3202, 3506, 3211, 3499)) then
              begin
                FindYew;
              end else
                Lost;
          end;
        end else
        begin
          NearTree := GetMyPos;
          if PointInBox(NearTree, IntToBox(3218, 3505, 3223, 3498)) then
          begin
            FindYew;
          end else
            Lost;
      end;
    end;

    If you can figure it out, thanks! If only it told me which line the error was on... lol. Btw, I know it's a weird procedure I'm just trying to make it very stable

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

    Default

    You're missing a couple ends; in there. "Identifier expected.." usually means you're missing an end; or until(); somewhere. Just make sure you have the same amount of ends as begins and the same amount of untils as repeats.

    That should clear up your problem.

  3. #3
    Join Date
    Mar 2009
    Location
    Antaractica, Penguin Drive
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay, thanks, I knew I was probably missing an end, but I'm too lazy to look for it in my mess of scripting :P

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

    Default

    Quote Originally Posted by CowFish View Post
    Okay, thanks, I knew I was probably missing an end, but I'm too lazy to look for it in my mess of scripting :P
    Lol, no problem.

    The easiest way is just to count them, gets it done fast.

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

    Default

    Quote Originally Posted by Coh3n View Post
    Lol, no problem.

    The easiest way is just to count them, gets it done fast.
    no
    the easiest way is to have good scripting standards then you will be able to see if you are missing any because it wont go back to where it should be

    ~shut

  6. #6
    Join Date
    Mar 2009
    Location
    Antaractica, Penguin Drive
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol i got a new error:
    Line 172: [Error] (24488:37): Semicolon (';') expected in script C:\Program Files\SCAR 3.20\Scripts\R_YewCutter.scar

    Line 172 = if WalkToTile(WalkToBankPointsNormal[i], 1, 1) then

    And the procedures/functions messing up are:

    SCAR Code:
    function WalkToBankPointsNormal: TPointArray;
    begin
      SetLength(Result, 2);
      Result[0] := Point(3196, 3490);
      Result[1] := Point(3178, 3489);
      Result[2] := Point(3169, 3489);
    end;

    function WalkToBankPointsFar: TPointArray;
    begin
      SetLength(Result, 3);
      Result[0] := Point(3208, 3501);
      Result[1] := Point(3196, 3490);
      Result[2] := Point(3178, 3489);
      Result[3] := Point(3169, 3489);
    end;

    procedure WalkToBank;
    var
      i: Integer;
    begin
      if not FarTree then
      begin
        for i := 0 to High(WalkToBankPointsNormal) do
        begin
          if WalkToTile(WalkToBankPointsNormal[i], 1, 1) then
          begin
            R_Flag;
            AntiRandoms;
            Wait(300 + Random(425));
          end;
        end;
      end else begin
        for i := 0 to High(WalkToBankPointsFar) do
        begin
          if WalkToTile(WalkToBankPointsFar[i], 1, 1) then
          begin
            R_Flag;
            AntiRandoms;
            Wait(300 + Random(425);
          end;
        end;
      end;
    end;

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

    Default

    WalkToBankPointsNormal[i]

    That.

    Create an array, and set it to that function.

    Semicolon missing errors are elusive, usually its something else.



    So just do:
    SCAR Code:
    Path := FUncTION;
    for i := 0 to High(Path) do
      if WalkToTile(Path[i], 213, 234) then

    Let me know if that worked.
    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

  8. #8
    Join Date
    Mar 2009
    Location
    Antaractica, Penguin Drive
    Posts
    140
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol big edit: Nevermind it worked! =D At first I thought you meant to do a lot of confusing things but then i kept rereading and then i understood! Thanks
    Last edited by CowFish; 06-25-2009 at 09:41 PM.

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

    Default

    You put the function you want it to be -.-. Not the actual word.

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
  •