Results 1 to 5 of 5

Thread: Stuck on my first script - Invalid number of parameters, line 153

  1. #1
    Join Date
    May 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Stuck on my first script - Invalid number of parameters, line 153

    I am attempting to make my first script and have hit a wall consisting of a "Invalid number of parameters" error when compiling. Posting the script & error below for someone with experience to look it over and point out what I have missed.

    I appreciate the assistance and am looking forward to learning more about coding SRL scripts.

    Code:
    [Error] C:\Simba\Scripts\MineCopper.simba(154:15): Invalid number of parameters at line 153
    Compiling failed.
    Code:
    program StoicCopperPower07;
    {$DEFINE SMART8}
    {$I SRL-OSR/SRL.simba}
    {$I SRL/SRL/Misc/Debug.Simba}
    {$I SRL-OSR/SRL/Misc/SmartGraphics.Simba}
    
    // Begin User Setup
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      with Players[0] do
      begin
        Name := ''; // Username
        Pass := ''; // Password
        Nick := ''; // Three Letter Nick
        BoxRewards := ['Xp'];
        Active:=True;
      end;
    end;
    
    // End User Setup
    // Begin AntiBan
    
    procedure AntiBan;
    begin
      if(not(LoggedIn))then Exit;
      begin
        case Random(100) of
          10: RandomRClick;
          25: HoverSkill('Mining', false);
          30: PickUpMouse;
          50: RandomMovement;
          70: BoredHuman;
          89: ExamineInv;
          92: HoverSkill('Mining', false);
        end;
      end;
    end;
    
    // End AntiBan
    // Begin Finding Copper
    
    function FindCopper(var x, y : Integer) : Boolean;
    var
      a : Integer;
      TPA  : TPointArray;
      ATPA : T2DPointArray;
      MP   : TPoint;
      tmpCTS :Integer;
      Box  : TBox;
    begin
      if(not(LoggedIn))then Exit;
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.02, 0.83)
    
      FindColorsSpiralTolerance(MSCX, MSCY, TPA,
      3502798, MSX1, MSY1, MSX2, MSY2, 4);
      SortTPAFrom(TPA, Point(MSCX, MSCY));
      ATPA := TPAtoATPAEx(TPA, 15, 15);
    
      for a := 0 to High(ATPA) do
      begin
        MP := MiddleTPA(ATPA[a]);
        Box := IntToBox((MP.X - 20), (MP.Y - 20), (MP.X + 20), (MP.Y + 20));
        {$IFDEF SMART8}
        SMART_DrawBoxEx(True, True, Box, clYellow);
        {$ENDIF}
        MMouse(MP.X, MP.Y, 4, 4);
        if(WaitUpText('Mine', 750))then
        begin
          x := MP.x; y := MP.y;
          Result := True;
          {$IFDEF SMART8}
          SMART_ClearCanvas;
          {$ENDIF}
          Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    end;
    
    // End Finding Copper
    // Begin Mining Copper
    
    procedure MineCopper;
    var
      x, y: Integer;
      Box : TBox;
    begin
      if(not(LoggedIn))then Exit;
      MakeCompass('N');
      Box := IntToBox(MSCX - 10, MSCY - 25, MSCX + 15, MSCY + 15);
      repeat
        if(not(FindNormalRandoms))then
        begin
          if(FindCopper(x, y))then
          begin
            Wait(RandomRange(100, 450));
            Mouse(x, y, 12, 12, mouse_Left)
            Wait(RandomRange(100, 550));
            while(Animating(Box, 750, 30))do
            begin
             AntiBan;
             Wait(RandomRange(100,300));
            end;
          end else
            Exit;
        end;
      until(InvFull or (not FindCopper(x, y)));
    end;
    
    // End Mining Copper
    // Begin Find & Drop Copper
    
    procedure FindAndDrop();
    var
      DTM, x, y : Integer;
      TP : TPoint;
    begin
      DTM := DTMFromString('mPwEAAHic42dgYLAEYg0g1gdiIyA2B2I7IHYGYjcgdgViJyC2B2ILqBpDINYCYmsgtgViU6iYAZI5IDErqD4XIPYAYk8oG4Sv15gBSUYyMfmAXBux2AoACj0Iew==');
      if(FindDTM(DTM, x, y, MIX1, MIY1, MIX2, MIY2))then
      begin
        Mouse(x, y, 7, 7, mouse_Right);
        Wait(RandomRange(750, 900));
        if(FindTextTPAEx(4231423, 0, MIX1, MIY1, MIX2, MIY2, TP.X, TP.Y,
        'rop', StatChars, ClickLeft))then
          Wait(RandomRange(750, 900));
        begin
          while(InvCount > 1)do
          begin
            AntiBan;
            Wait(RandomRange(250, 500));
          end;
        end;
      end;
      FreeDTM(DTM);
    end;
    
    // End Find & Drop Copper
    // Begin Main Loop Procedure
    
    procedure MainLoop;
    begin
      SetAngle(SRL_ANGLE_HIGH);
      repeat
        FindCopper();
        MineCopper();
        FindAndDrop();
      until(AllPlayersInactive);
    end;
    
    begin
      {$IFDEF SMART8}
       Smart_Server := 0;
       Smart_Members := True;
       Smart_Signed := True;
       Smart_SuperDetail := False;
      {$ENDIF}
      SetupSRL();
      ClearDebug();
      DeclarePlayers();
      LoginPlayer();
      MainLoop();
    end.

  2. #2
    Join Date
    Mar 2013
    Location
    The Netherlands
    Posts
    185
    Mentioned
    2 Post(s)
    Quoted
    70 Post(s)

    Default

    The function you try to call is
    Code:
    function FindCopper(var x, y : Integer) : Boolean;
    As you can see, the FindCopper function requires a X and Y parameter.

    you could try:

    Code:
    procedure MainLoop;
    var
    X, Y : integer;
    begin
      SetAngle(SRL_ANGLE_HIGH);
      repeat
        FindCopper(X, Y);
        MineCopper();
        FindAndDrop();
      until(AllPlayersInactive);
    end;
    Nothing to do here :l.

  3. #3
    Join Date
    Feb 2013
    Location
    Narnia
    Posts
    615
    Mentioned
    8 Post(s)
    Quoted
    252 Post(s)

    Default

    impressive syntax use for a first script! nice work

    View my OSR Script Repository!


    Botted to max
    Guides: How to Report Bugs to the Scripter
    ~~~~ Moved to Java. Currently Lurking ~~~~

  4. #4
    Join Date
    May 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ok thanks that got it working but now it won't click the damn rocks, also the impressive syntax is taken from a beginner guide so it's not really mine.

  5. #5
    Join Date
    Mar 2007
    Posts
    393
    Mentioned
    1 Post(s)
    Quoted
    98 Post(s)

    Default

    If you declare
    Simba Code:
    x := MP.x; y := MP.y;
    and use x and y in other procedure/function then x and y need to be global variables. May be I'am wrong but try adding this before //Begin User Setup:
    Simba Code:
    var
    x, y:integer;

    And for middleTPA I use something like this:
    Simba Code:
    if MiddleTPAEx(ATPA[a], x, y) then
      begin
        mmouse(x, y, 3, 3);  
          ......

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
  •