Results 1 to 4 of 4

Thread: Duplicate indentifier

  1. #1
    Join Date
    Feb 2012
    Posts
    48
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Duplicate indentifier

    Hello people! I'm trying to add banking to one of my scripts and i looked the command withdraw in function list and it showed me an example. i copyed it and when i try to compile the script it says

    Simba Code:
    [Error] (76:10): Duplicate identifier 'WITHDRAW' at line 75
    Compiling failed.

    Here is the code


    Simba Code:
    program Bonfire;
    {$i SRL\SRL.simba}
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Active := True;
      Players[0].Member := True;
      Players[0].Pin := '1999';
    end;// declare players


    function OpenBankNPCEx :Boolean;
    var
      NPCBox :TBox;
      Colors, NPCArray :TPointArray;
      ATPA: T2DPointArray;
      MSNPC, NPCPoint :TPoint;
      TempCTS, C, HiNPC, II, I :Integer;
    begin
      Result := False;
      Result := (BankScreen) or (PinScreen);
      If Result then Exit;

      NPCArray := GetMinimapDots('NPC');
      HiNPC := High(NPCArray);

      If Length(NPCArray) = 0 then Exit;
      SortTPAFrom(NPCArray, Point(MMCX, MMCY));
      for I := 0 to HiNPC do
      begin
        NPCPoint := MMToMS(NPCArray[I])
        If NPCPoint = Point(-1, -1) then Continue;
        NPCBox := IntToBox(NPCPoint.X - 40, NPCPoint.Y - 40, NPCPoint.X + 40, NPCPoint.Y + 40)
        If PixelShift(NPCBox, 200) > 500 then Continue;

        TempCTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        SetColorSpeed2Modifiers(0.13, 1.52);
        FindColorsTolerance(Colors, 6067652, NPCBox.X1, NPCBox.Y1, NPCBox.X2, NPCBox.Y2, 13);
        ATPA := TPAToATPAEx(Colors, 15, 20);
        SortATPASize(ATPA, True);

        for II := 0 to High(ATPA) do
        begin
          MSNPC := MiddleTPA(ATPA[II]);
          MMouse(MSNPC.X, MSNPC.Y, 3, 3);
          If WaitUpTextMulti(['ooth', 'anker'], 200) then
          begin
            Mouse(MSNPC.X, MSNPC.Y, 1, 1, False);
            If WaitOptionMulti(['ank B', 'quick'], 300) then
            MarkTime(c);
            Begin
              Repeat
                Wait(RandomRange(50, 100));
              Until (BankScreen) or (PinScreen) or (TimeFromMark(C) > 4500);
              if (Players[CurrentPlayer].Pin <> '') then //
                InPin(Players[CurrentPlayer].Pin);
              Result := (BankScreen) or (PinScreen);
              If Result then
              begin
               ColorToleranceSpeed(TempCTS);
               Exit;
              end
              else
                ColorToleranceSpeed(TempCTS);
            end;
          end;
        end;
      end;
    end;
    function Withdraw(2, 1, 5: Integer): Boolean; // This line is highlighted when it shows error in debug box
    begin
      Result := WithdrawEx(2, 1, 5,[]);
    end;

    begin
      SetupSRL;
       OpenBankNPCEx;
       withdraw;
    end.

  2. #2
    Join Date
    Jan 2012
    Location
    Runescape News and General & Skill Guides
    Posts
    2,544
    Mentioned
    37 Post(s)
    Quoted
    545 Post(s)

    Default

    Im not a scripter, but i searched up duplicate identifiers and found this by abu_jwka.

    Duplicate Identifier '' at Line xx
    There are a few reason why this may occur.

    The first is because you have made two procedures/functions with the same name.

    The second is because you have made a procedure/function with a name that already exists in the SRL Include.

    The third is because you named a variable the same as a procedure or function that already exists in the SRL Include.
    ---

  3. #3
    Join Date
    Mar 2012
    Location
    Color :D
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    There's already a function name withdraw, you can't make another function with the same name. Maybe change the name to TakeItem, or WithdrawItem or something else.

    EDIT: By looking at your script, its not neccesary to make a function for that. You could just use the Withdraw function at your main loop.

    EDIT AGAIN: Where do you get that openbanknpcex function from? :O
    Last edited by CephaXz; 06-28-2012 at 08:38 PM.

  4. #4
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Get rid of your function 'Withdraw' from the script, it is trying to read that as a function as well as read the one in the SRL include this is where your duplicate identifier error is coming in.

    With any functions found in the SRL include, if you have SRL included in your script {$i SRL\SRL.Simba} then you don't need to copy out the whole function.

    For examplem, this is what you would have found in the SRL include when you searched withdraw -
    Simba Code:
    (*
    Withdraw
    ~~~~~~~~

    .. code-block:: pascal

        function Withdraw(Col, Row, Amount: Integer): Boolean; // This is a break down of each variable

    Withdraws Amount at Column/Row.

    .. note::

        Author: Starblaster100, Town, Wizzup? and Narcle
        Last Modified: Unknown

    Example:

    .. code-block:: pascal

        Withdraw(1, 3, 28); // This line is an example of what you might enter into your script
    *)

    function Withdraw(col, row, Amount: Integer): Boolean; // This bit down here shows you how the function works
    begin
      Result := WithdrawEx(Col, Row, Amount,[]);
    end;

    Put this in your mainloop instead (in place of withdraw).
    Simba Code:
    Withdraw(2, 1, 5);
    That will withdraw 5 of the item in column 2 of row 1. Keep in mind that most functions work with 0,0 as the first point, so this would be 3 items across and one item down IIRC
    Last edited by P1ng; 06-29-2012 at 12:50 AM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

Posting Permissions

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