Results 1 to 8 of 8

Thread: Clicking and object

  1. #1
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default Clicking and object

    Never Mind got it working!

    Simba Code:
    Function PickBerries: Boolean;
        var
        x, y, xa, ya, xas, yas: Integer;
        Begin
       xas:=MSCX;
       yas:=MSCY;
       If FindObjCustom(x, y, ['hite'], [14146272], 15)  Then
       //begin
        GetMousePos(x, y);
          if((x = x) and (y = y))then
              ClickMouse2(mouse_Left);
            wait(2500 + random(200));
       repeat
       If(WaitUpText('ake', 200+Random(500))) then
       PickBerries;
       Until (InvCount=28)

     end;
    Last edited by jman1208; 07-23-2012 at 05:10 AM.

  2. #2
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    I'm not sure which part you fixed, but I found several things I thought I should point out...

    This part:
    Simba Code:
    if((x = x) and (y = y))then
    Will always be true since something is always going to be equal to itself, you need to use more variables:
    Simba Code:
    function PickBerries: Boolean;
    var
      x1, y1, x2, y2: Integer;
    begin
      x1 := MSCX;
      y1 := MSCY;
      if FindObjCustom(x1, y1, ['hite'], [14146272], 15) then
        begin
          GetMousePos(x2, y2);
          if ((x1 = x2) and (y1 = y2)) then
            ClickMouse2(mouse_Left)
          else
            Mouse(x1, y1, 5, 5, mouse_Left);
          wait(2500 + random(200));
        end;
    end;
    For this part:
    Simba Code:
    repeat
      if (WaitUpText('ake', 200 + Random(500))) then
        PickBerries;   //This is calling your function you are already in
    until (InvCount = 28);//what if it runs out of berries on the bush, this will cause an infinite loop
    You would be better with this:
    Simba Code:
    if (WaitUpText('ake', 200 + Random(500))) then
      begin
        ClickMous2(mouse_Left);
        Wait(200+Random(2000));  
      end;

  3. #3
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default

    Thanks that works a lot better.. I feel like such a scrub. but it works! Thanks, since there's no repeat how can I use this until inv is full?

  4. #4
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    Simba Code:
    repeat
      PickBerries;
    until(InvFull);

  5. #5
    Join Date
    Jun 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by P1ng View Post
    Simba Code:
    repeat
      PickBerries;
    until(InvFull);
    I know that but i'm trying to avoid it mass clicking i guess i could add a wait right after unless theres a better way?

  6. #6
    Join Date
    Jan 2008
    Location
    C:\
    Posts
    1,483
    Mentioned
    2 Post(s)
    Quoted
    2 Post(s)

    Default

    Quote Originally Posted by jman1208 View Post
    I know that but i'm trying to avoid it mass clicking i guess i could add a wait right after unless theres a better way?
    You could try something like this:

    Simba Code:
    if PickBerries then
    begin
      StartCount := InvCount;
      MarkTime(t);
      while (TimeFromMark(t) < 4000) do
      begin
        Wait(100);
        //Antiban;
        if (InvCount > StartCount) then
        begin
          //Inc(BerriesPicked);
          Break;
        end;
      end;
    end;

    Just be sure to cut out any waits after clicking on a berry so the StartCount is the inventory count before picking up the berry.

  7. #7
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    You could avoid that problem by:
    Simba Code:
    StartCount := InvCount;
    if PickBerries then
    begin  
      MarkTime(t);
      while (TimeFromMark(t) < 4000) do
      begin
        Wait(100);
        //Antiban;
        if (InvCount > StartCount) then
        begin
          //Inc(BerriesPicked);
          Break;
        end;
      end;
    end;

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

    Default

    ^^^ You both posted the same code?

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
  •