Results 1 to 8 of 8

Thread: A looping issue

  1. #1
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default A looping issue

    i have this probably too easy to fix but its taking too long to fix chunk that i want straightened out



    Simba Code:
    procedure MineOre;
    var
      c, j, x, y: integer;
    begin
    if InvFull then
      exit else
        begin
          c:= InvCount+1;
          for j:= Invcount to 27 do
          repeat
              if FindObjEx_F(55511, 156151, 12, 20, MSCX, MSCY, ['Mine', 'Rocks'], X, Y, False) then
                  Mouse(x, y, 6, 6, false);
                  until(invcount=c)
                  end;
              end;


    as you can see

    it clicks and mines but then it just doesnt do what i want it to do...

    i would like it to click mine the rock and when my invcount increases by 1 then continue the loop all the way till what it says....

    im kinda stuck

  2. #2
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    Simba Code:
    procedure MineOre;
    var
      a, c, j, x, y: integer;
    begin
    if InvFull then exit;
          repeat
            //  if FindObjEx_F(55511, 156151, 12, 20, MSCX, MSCY, ['Mine', 'Rocks'], X, Y, False) then
                  Mouse(x, y, 6, 6, Mouse_Right); ///chaneg this from false
                  a:=InvCount;
                  while InvCount = a do
                  begin
                    wait(0);
                  end;
                  until(invFull)
              end;

    FindObjEx_F i dont have your edited version to check if this compiles

    ill try answer you question now tho will edit this post
    Last edited by Mark; 01-13-2012 at 10:07 PM.

  3. #3
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    i dont know mang im just going to have to look at more script examples...

  4. #4
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    does this work
    Last edited by Mark; 01-13-2012 at 10:07 PM.

  5. #5
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    545
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Quote Originally Posted by CRU1Z1N View Post
    Simba Code:
    procedure MineOre;
    var
      a, c, j, x, y: integer;
    begin
    if InvFull then exit;
          c:= InvCount+1;
          for j:= Invcount to 27 do
          repeat
              if FindObjEx_F(55511, 156151, 12, 20, MSCX, MSCY, ['Mine', 'Rocks'], X, Y, False) then
                  Mouse(x, y, 6, 6, Mouse_Right); ///chaneg this from false
                  a:=InvCount;
                  while a = a do
                  begin
                    wait(0);
                  end;
                  until(invFull)
              end;

    does this work
    Arent a for-loop and a repeat 2 different loops?
    like:
    for j := invcount to 27 do
    begin

    end;
    or
    repeat

    until this := thus

    when im looking through the code, it seems like it rpeats something until the inventory is full: invcount 28 and it repeats something else until its 27 but because the second repeat will go all the way till 28 before it checks if it is 27 again, it will be an infinite loop

  6. #6
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    good spot didnt notice that

    As you can see he do not even use j anywhere in that procedure

    updated the code above still needs alot of work but i hope it shows you some ideas
    Last edited by Mark; 01-13-2012 at 10:07 PM.

  7. #7
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    545
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Thanks
    btw, m3gaman, if you dont know how the while loop works:
    the while loop checks If the given statement (a=a) is correct, if it is then it will wait 500 ms and check again until the statement is false, so because a is a just like b is b and chris is chris, this will be an infinite loop
    So it should be:
    Simba Code:
    a:=invcount;
    b:=invcount;
    while a = b do
    begin
      b:=invcount;
    end;
    Last edited by Chris; 01-13-2012 at 10:25 PM. Reason: Forgot simba tags

  8. #8
    Join Date
    Jan 2012
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    While i=invcount(lets say it counts 6) to 27 (for 22 to 27) do (5 Times)

    A mining Procedure?
    how can i make this work smoothly...

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
  •