Results 1 to 4 of 4

Thread: Why is the constantly looping?

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default Why is the constantly looping?

    In my script, the bot checks for combat, when the hp bar disapears it starts the looting procedure:
    Simba Code:
    procedure PickUp;
    var
      X, Y: Integer;
    begin
      Wait(500 + Random(1200));
      WriteLn('Looking for bones...');
      if FindColorTolerance(X, Y, loot, 223, 114, 388, 290, 15) then
      begin
        WriteLn('Found bones!');
        MouseSpeed:=40;
        mmouse(x, y,1,1);
        Wait(120 + Random(80));
        ClickMouse(x, y, mouse_Right);
        WriteLn('Looking for charm...');
        Wait(1100);
        FindBitmapToleranceIn(charm, X, Y,161, 86, 420, 252, 95)
        MouseSpeed:=40;
        mmouse(x, y,1,1);
        WriteLn('Found charm!');
        Wait(500);
        ClickMouse(X, Y, mouse_Left);
        Wait(1820 + Random(80));
        end;
      end;

    After its done with this it is supposed to go back to attacking Skeletons but it won't. In a older version the method was:
    Simba Code:
    procedure PickUp;
    var
      X, Y: Integer;
    begin
      Wait(1700 + Random(1200));
      WriteLn('Looking for bones...');
      if FindColorTolerance(X, Y, loot, 223, 114, 388, 290, 15) then
      begin
        WriteLn('Found bones!');
        MouseSpeed:=40;
        mmouse(x, y,1,1);
        Wait(120 + Random(80));
        ClickMouse(x, y, mouse_Right);
      end;
      WriteLn('Looking for charm...');
      Wait(1100);
      if FindBitmapToleranceIn(charm, X, Y,161, 86, 420, 252, 85) then
      begin
       MouseSpeed:=40;
        mmouse(x, y,1,1);
        WriteLn('Found charm!');
        Wait(500);
        ClickMouse(X, Y, mouse_Left);
        Wait(1820 + Random(80));
      end;
    end;
    But it proved to be to buggy so i re-did it.

  2. #2
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    show us your loop, not the procedure's you call in your loop... lol

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Simba Code:
    // fill out const's
    Program autofight;
    {$i srl/srl.simba}
    const
      NPC = 1121869;
      loot = 14079706;
      tolerence = 12;
      time = 1; // in seconds
      rwait = 1000;
      tleft = 41;
      tright = 44;
      bleft = 426;
      bright = 280;

    var
      charm: Integer;
      Skeleton:TPoint;

    procedure PickUp;
    var
      X, Y: Integer;
    begin
      Wait(500 + Random(1200));
      WriteLn('Looking for bones...');
      if FindColorTolerance(X, Y, loot, 223, 114, 388, 290, 15) then
      begin
        WriteLn('Found bones!');
        MouseSpeed:=40;
        mmouse(x, y,1,1);
        Wait(120 + Random(80));
        ClickMouse(x, y, mouse_Right);
        WriteLn('Looking for charm...');
        Wait(1100);
        FindBitmapToleranceIn(charm, X, Y,161, 86, 420, 252, 95)
        MouseSpeed:=40;
        mmouse(x, y,1,1);
        WriteLn('Found charm!');
        Wait(500);
        ClickMouse(X, Y, mouse_Left);
        Wait(1820 + Random(80));
        end;
      end;

    procedure CheckCombat;
    var
      X, Y: Integer;
    begin
      if FindColorTolerance(X, Y,49499,241, 115, 291, 179, 17) then
      begin
      Wait(700 + Random(250));
      WriteLn('Waiting to get out of combat . . .');
      CheckCombat;
      end;
      Pickup
    end;

    procedure ClickNPC;
    var
      X, Y: Integer;
    begin     // kill npc
      WriteLn('Attacking skeleton...');
      if FindColorTolerance(X, Y, NPC, tleft, tright, bleft, bright, tolerence) then
      begin
        MouseSpeed:=25;
        mmouse(x, y,1,1);
        Wait(20 + Random(50));
        ClickMouse(X, Y, Mouse_Left);
        WriteLn('Attacked skeleton!');
        Wait(3000 + Random(150));
        CheckCombat;
      end;
    end;

    begin
      charm := BitmapFromString(44, 12, 'meJzFU9sNgCAMZBD+/XAJR/THXZ' +
            'jAtdTYpClH2xQJkfSDXvo4zjMva/4j0ns+t2/7xREsjuNxAvSKyBy' +
            'uD+JdBIKSzuMw3iLxo5yMP3cOf6DqB9UnLQdZRjiLSasptWhAo1xn' +
            '+QQ4wCt4lBQB+PjCyrTrDhzUD8GCTOJg+UGudtxu6TzIAWj4tmxNB' +
            'bIArkoHnsz1P57qY9GwalRcTWXZDd+RiMw=');
      repeat
        ClearDebug;
        ClickNPC;
      until False;
      FreeBitmap(charm);
    end.

  4. #4
    Join Date
    Nov 2012
    Location
    N/A
    Posts
    185
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    Im not 100% sure why it isn't working im only new here...

    But i do suggest adding a procedure that actually enables/opens the HP bar, if your ever going to release it.

    I notice your adding the next procedure in the procedures:/ Anyways:

    *in ClickNPC it attacks the skeleton and then does CheckCombat;.
    *in CheckCombat it waits until its out of combat and then you tell it to CheckCombat; again? Maybe remove this? or add a repeat instead... and instead of having "Pickup" change it to "Pickup;" I believe thats the issue?

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
  •