Results 1 to 5 of 5

Thread: Question

  1. #1
    Join Date
    Mar 2012
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Question

    Script is working fine but I am getting the message of 'Warning! You passed a wrong ys to a finder function: -5. That is below 0, thus out of bounds. Setting the value to 0 for now.


    Simba Code:
    Function AttackingCow:Boolean;
    Var
      x,y,i:Integer;
      CowColor:Array [0..3] of Integer;
    begin
    CowColor[0]:=6915485;
    CowColor[1]:=5397355;
    CowColor[2]:=4543321;
    CowColor[3]:=9738395;
    x:=MSX1;
    y:=MSY1;
     begin
      For i:=0 to 3 do
      If FindObjCustom(x,y,['ttack'],[CowColor[i]],6) then
        Begin
        If IsUpText('Cow') Then
        begin
        GetMousePos(x,y);
         Case random(2) of
          0: Mouse(x, y, 5, 5, True);
          1: Begin
               Mouse(x, y, 5, 5, False);
               WaitOption('ttack', 500);
               if (InFight) then
               writeln('We are in a fight');
               wait(1000+ random(300))
              end;
            End;
          End;
        end;
      end;
    end;

  2. #2
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    I knew why this happened, but I forgot.

    My suggestion is you just ignore it as it doesn't affect the performance of the script. If you're getting fed up of the error you can always look at some guide on TPA's in the tutorial section

  3. #3
    Join Date
    Mar 2012
    Location
    Over there
    Posts
    840
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    Change
    Simba Code:
    x:=MSX1;
    y:=MSY1;

    to something else like
    Simba Code:
    x:=MSCX;
    y:=MSCY;

    Or just remove that part completely.

  4. #4
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Just delete
    Simba Code:
    x:=MSX1
    y:=MSY1
    Should work after that.

  5. #5
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    A lot of functions that requires a box to search in need the following parameters; xs, ys ,xe and ye(x start, y start, x end and y end). For some reason it starts to look 5 pixels above the client, but I don't see you use any function that requires a search box, like FindColors or such. Maybe it is a mistake in FindObjectCustom?

    These lines can be removed as they aren't used: x:=MSX1;
    y:=MSY1;

    edit:
    Could you replace FindObjectEx in Srl/srl/Object.simba with the following code, and post here if the debug tells you something new?
    Simba Code:
    function FindObjEx(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray;
        Tol, Step, xs, ys, xe, ye: Integer): Boolean;
    var
      CurX, CurY, a, b, c, i: Integer;
      Start: Boolean;
    begin
      for b := 0 to (GetArrayLength(Color)-1) do
      begin
        if (FindColorSpiralTolerance(cx, cy, color[b], xs, ys, xe, ye, Tol)) then
        begin
          Start := True;
          Break;
        end;
      end;
      if (Start) then
      begin
        CurX := Round((xs + xe) div 2);
        CurY := Round((ys + ye) div 2) - Step;
        i := 1;
        repeat
          for c := 1 to i do
          begin
            case a of
              0: begin  //To allow for beginning offset and loop
                   a := a + 1;
                   i := 0;
                   CurY := CurY + Step;
                 end;
              1: CurX := CurX + Step;
              2: CurY := CurY - Step;
              3: CurX := CurX - Step;
              4: CurY := CurY + Step;
            end;
            if (CurX >= xs) and (CurX <= xe) and (CurY >= ys) and (CurY <= ye) then
            begin
              try
                for b := 0 to (GetArrayLength(Color)-1) do
                begin
                  if (CurY-(Step div 2) < 0)then
                    writeln('Fast tell everyone the FindObjectCustom function is bad');
                  if (FindColorTolerance(cx, cy, Color[b], CurX-(Step div 2), CurY-(Step div 2), CurX+(Step div 2), CurY+(Step div 2), Tol)) then
                  begin
                    MMouse(cx, cy, 3, 3);
                    If (WaitUptextMulti(Text, 300)) then
                    begin
                      GetMousePos(cx, cy);
                      Result := True;
                      Exit;
                    end;
                  end;
                end;
              except
              end;
            end;
          end;
          a := a + 1;
          if a mod 5 = 0 then a := 1;
          if (a = 1) or (a = 3) then i := i + 1;
        until (Result) or ((CurX > xe) and (CurY > ye))
      end;
    end;
    Last edited by masterBB; 04-26-2012 at 11:28 AM.
    Working on: Tithe Farmer

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
  •