Results 1 to 3 of 3

Thread: Weird Error

  1. #1
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Exclamation Weird Error

    SCAR Code:
    {.include SRL\SRL.Scar}
    var
       x, y: integer;
    function Attack(var x, y: integer; Color: TIntegerArray; name: string): Boolean;
    var
      TPA: TPointArray;
      aTPA, Split: T2DPointArray;
      i, Ix, H, mX, mY: Integer;
      TP: TPoint;
    begin
      ColorToleranceSpeed(1);
      for i := 0 to 2 do
      begin
      {  mX := MSCX;
        mY := MSCY;     }

        FindColorsSpiralTolerance(MSCX,MSCY, TPA, Color[i], MSX1, MSY1, MSX2, MSY2, 35);
        SortTPAFrom(TPA, Point(MSCX, MSCY));
        Split := SplitTPA(TPA, 40);
        H := High(Split);
        for i := 0 to Ix do
        begin
          TP := MiddleTPA(Split[i]);
          MMouse(TP.x, TP.y, 3, 3);
          Wait(500 + Random(600));
          Case Random(3) of
          0: if IsUpText(name)then
             begin
               Disguise('Attacking');
               Mouse(TP.x, TP.y, 2, 2, true);
               //antiban;
             end;
          1: if IsUpText(name)then
             begin
               Disguise('Attacking');
               Mouse(TP.x, TP.y, 2, 2, false);
               Wait(Random(500) + Random(750));
               ChooseOption('ttack');
               //antiban;
             end;
          2: if IsUpText(name) then
             begin
               Disguise('Attacking');
               HoldMouse(TP.x, TP.y, true);
               Wait(100 + RandomRange(50, 150));
               ReleaseMouse(TP.x, TP.y, true);
              //antiban;
             end;
          end;
         Result := True;
       end;
      end;
    end;

    begin
      SetupSRL;
      Attack(x, y, [7036937, 7036937], '88');
    end.

    When i press 'PLAY', i get
    [Runtime Error] : Out Of Range in line 22 in script
    Now line 22 is TP := MiddleTPA(Split[i]);
    I don't know wats wrong.

    Note: The mainloop is just an example.

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

    Default

    You declare only two colors([7036937, 7036937]) and the first loop(For I := 0 To 2 Do) checks for 3 indexes when the length of Colors is 2. Also change:
    scar Code:
    TP := MiddleTPA(Split[i]);
    To:
    scar Code:
    TP := MiddleTPA(Split[Ix]);
    Because you are looping trough 'I' when you have to be in 'Ix'.


  3. #3
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Omg, i make such silly errors, thanks Cazax. Rep := Rep + 1;

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
  •