Results 1 to 3 of 3

Thread: Need help with "Or" Statements

  1. #1
    Join Date
    Oct 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Need help with "Or" Statements

    Hi, i posted this in one of my other threads in the replies but as it no longer has to do with stump detection i am making a new thread.
    So basically i want to add a double until statement but one has to be an or so this is a part of my script so far:

    Simba Code:
    procedure ChopTree;
     begin
     repeat
           if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance) then
           begin
           writeln('Found Magic Tree.');
           Mouse (x ,y ,0 , 0, True);
           end;
           repeat
           until not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance))
           writeln('Waiting for tree');
           wait(3000);
           until not(FindColorSpiralTolerance(x, y, 3029313, 715, 450, 725, 460, 20));
           Writeln('Full inventory, Going to bank.');
           end;
    This basically finds the color of a magic tree's white sparkly bits (back in 2006 graphics) this then clicks the tree ONCE until it can no longer find the color of the magic tree. It waits 3000ms until it checks for it again. If the inventory is full AND the tree is down, the script will continue on to banking.

    So my problem is... If i am the only person botting, and i have a full inventory... I cannot continue to bank until the tree has fallen down... so it will keep clicking the tree because it see's the color but it will never fall down because of the current inventory is full and cannot continue to woodcut.

    Basically at the part where it says "until not" find the color of the tree, there also needs to be an inventory check..

    I tried adding
    Simba Code:
    or (FindColorSpiralTolerance (x, y, 3029313, 715, 450, 725, 460, 20)) = False)
    so that it will continue to bank after the inventory is full EVEN IF the tree is not fallen and will look like this.

    Simba Code:
    procedure ChopTree;
     begin
     repeat
           if FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance) then
           begin
           writeln('Found Magic Tree.');
           Mouse (x ,y ,0 , 0, True);
           end;
           repeat
           until not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance))
           or (FindColorSpiralTolerance (x, y, 3029313, 715, 450, 725, 460, 20)) = False) //added this or but is broken
           writeln('Waiting for tree');
           wait(3000);
           until not(FindColorSpiralTolerance(x, y, 3029313, 715, 450, 725, 460, 20));
           Writeln('Full inventory, Going to bank.');
           end;

    only problem is, i cannot get the "or" statement to work :/ i get the error:

    Code:
    [Error] (28:85): Identifier expected at line 27
    Compiling failed.
    which is at the line where the or statement is. Please could you tell me what i am missing out here. Thank you

  2. #2
    Join Date
    Mar 2007
    Posts
    674
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    SCAR Code:
    procedure ChopTree;
    begin
       if not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance)) then
       begin //did not find the tree.
       repeat
          writeln('waiting for tree.');
          wait(3000);//this loop will wait for the tree to respawn
       until(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance);// found the tree. breaks the loop.
       end else // found the TreecColor.
       begin
          writeln('Found Magic Tree.');
          Mouse (x ,y ,0 , 0, True); //found the tree and will click it
          exit;
       end;
     end;  
    end;
     
    //this is the main loop now...
    begin
    repeat
      ChopTree;
    //you will need to add a mechanism to wait while chopping tree
    // or else it will spam click the tree.
    until (InvFull); //will repeat until the inv is full
    //banking procedure will go here.

    Try that. Did I miss any details?
    Post here if you run into some more problems.

  3. #3
    Join Date
    Nov 2011
    Location
    United states
    Posts
    516
    Mentioned
    1 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Lalaji View Post
    SCAR Code:
    procedure ChopTree;
    begin
       if not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance)) then
       begin //did not find the tree.
       repeat
          writeln('waiting for tree.');
          wait(3000);//this loop will wait for the tree to respawn
       until(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance);// found the tree. breaks the loop.
       end else // found the TreecColor.
       begin
          writeln('Found Magic Tree.');
          Mouse (x ,y ,0 , 0, True); //found the tree and will click it
          exit;
       end;
     end;  
    end;
     
    //this is the main loop now...
    begin
    repeat
      ChopTree;
    //you will need to add a mechanism to wait while chopping tree
    // or else it will spam click the tree.
    until (InvFull); //will repeat until the inv is full
    //banking procedure will go here.

    Try that. Did I miss any details?
    Post here if you run into some more problems.
    You should most likely add antiban in the wait for tree loop so you don't logout also the mouse function in theory should also be right after the first until so it won't repeat trying to find when it already found it once but it would still function the way you have it

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
  •