Results 1 to 6 of 6

Thread: script help

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

    Default script help

    so anyways this is my question i got this working almost great... ya almost.. wondering what i need to do to make it to where it waits until the monster is dead until it clicks the next one as of right now it clicks one then it fights for like 3-5 seconds then it starts to click another monster...

    any tip would be great

    Simba Code:
    program Auto_Soulsplit_Fighter;
    {$i srl/srl.simba}
    const
      COLOR =  6387343;  //  Monster Colour
      TOL   =  10;        //  Colour Tolerance

    ///////////////////////////////////////////////////////
    //PLEASE DO NOT TOUCH UNLESS YOU KNOW WHAT YOUR DOING//


    function Click(): boolean;
    var
      x, y, w, h: integer;
      B: TBox;
    begin
      GetMousePos(x, y);
      w := 525;
      h := 338;
      GetClientDimensions(w, h);
      B := IntToBox(x - 15, y - 15, x + 15, y + 15);
      if B.x1 < 0 then B.x1 := 0;
      if B.y1 < 0 then B.y1 := 0;
      if B.x2 > w then B.x2 := w;
      if B.y2 > h then B.y2 := h;
      begin
        if findColorTolerance(x, y, 62713, B.x1, B.y1, B.x2, B.y2, 20) then
        begin
        Result := True
          Exit;
        end;
      end;
    end;


    Function YellowClick: Boolean;
    begin
      Result := Click;
    end;


    Function RedClick: Boolean;
    begin
      Result := Not Click;
    end;


    Function Moving: Boolean;
    var
      MovingBox: Tbox;
    begin
      MovingBox   := IntToBox(259, 133, 272, 151);
      Result := (AveragePixelShift(MovingBox, 500, 300) > 80);
      //Writeln(IntToStr(AveragePixelShift(MovingBox, 500, 300))); //Shows PixelShift in debug

    end;


    Function InFight: Boolean;
    var
      InFightBox: Tbox;
    begin
      InFightBox  := IntToBox(260, 137, 277, 185);
      Result := (AveragePixelShift(InFightBox, 500, 300) > 100);
      //Writeln(IntToStr(AveragePixelShift(InFightBox, 500, 300))); //Shows PixelShift in debug

    end;


    procedure FindMonster;
    var
      I, Kill : Integer;
      Corners, TPA: TPointArray;

    begin
      Corners := [Point(266, 174), Point(0, 0), Point(520, 0), Point(0, 340), Point(520, 340)];// Corners of the client and center point
      I := 0

      begin
        repeat
          if I = 4 then
            Exit;

          if FindColorsSpiralTolerance(Corners[i].X, Corners[i].Y, TPA, COLOR, MSX1, MSY1, MSX2, MSY2, TOL) then
            begin
              MarkTime(Kill);
              Mouse(TPA[i].X, TPA[i].Y, 0, 0, true);
              Writeln('Attempting To Attack!');

              if YellowClick then
                begin
                  Writeln('');
                  Writeln('Missed!');
                  Writeln('Searching Again!');
                  Writeln('');
                  Continue;
                end;

                if RedClick then
                begin
                  Wait(4000);

                if (TimeFromMark(Kill) > 6000) and not Moving then
                  begin
                    Writeln('');
                    Writeln('Monster Already Infight');
                    i := i + 1;
                    Writeln('Searching Again!');
                    Writeln('');
                    Continue;
                  end else

                  if InFight then
                    begin
                      Writeln('Attacking!');
                      begin
                        repeat
                          Wait(2000);
                        until not InFight and not Moving or (TimeFromMark(Kill) > 2000);
                      end;
                      Writeln('Monster Dead!');
                      Writeln('');
                      Wait(2000);
                    end;
                  end;
              end;
          until (false);
      end;
    end;



    begin
      SetupSRL;
      ClearDebug;
      begin
        repeat
          FindMonster;
        until (false);
      end;
    end.

  2. #2
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    Simba Code:
    if RedClick then
    begin
      Wait(4000);

    Here you have if Simba detects a RedClick, it waits for 4 seconds... That's why. Boost that number.

  3. #3
    Join Date
    Feb 2013
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Chris! View Post
    Simba Code:
    if RedClick then
    begin
      Wait(4000);

    Here you have if Simba detects a RedClick, it waits for 4 seconds... That's why. Boost that number.
    k thanx trying it now i put it to 8000-8 seconds

  4. #4
    Join Date
    Feb 2013
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Chris! View Post
    Simba Code:
    if RedClick then
    begin
      Wait(4000);

    Here you have if Simba detects a RedClick, it waits for 4 seconds... That's why. Boost that number.
    got it working better at 8 seconds thanx again

  5. #5
    Join Date
    Jul 2012
    Posts
    279
    Mentioned
    5 Post(s)
    Quoted
    46 Post(s)

    Default

    Personally, I'd make a function that detects when the monster is dead rather than rely on a static wait. After, I could use WaitFunc:

    Simba Code:
    WaitFunc(@MonsterDead, 10, 20000);

    With this, there would be no wasted time after a kill.

  6. #6
    Join Date
    Feb 2013
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Wardancer View Post
    Personally, I'd make a function that detects when the monster is dead rather than rely on a static wait. After, I could use WaitFunc:

    Simba Code:
    WaitFunc(@MonsterDead, 10, 20000);

    With this, there would be no wasted time after a kill.
    how do i add that in? so it doesnt wait it just goes right to the next one once its dead?

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
  •