Results 1 to 5 of 5

Thread: Need Help With Making A Procedure Run Only Once

  1. #1
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Unhappy Need Help With Making A Procedure Run Only Once

    Hi, so when you go to cut a log for the first time it asks you what tool to you
    *add to bonfire*
    *use knife*
    *use tinderbox*

    It only asks you once and then it will automatically select the tool for you until you log out.
    I need to make a procedure run only once, during the first batch of logs I tried doing something like this
    PHP Code:
    procedure clickKnife();
    begin
      mouseBox
    (intToBox(268,182,313,228), MOUSE_LEFT);
    end;

    procedure cutLogs();
    var 
    x,yinteger;
    begin

     
    if bankscreen.close then
       begin
          wait
    (randomRange(1000,2000));
          
    tabBackPack.mouseSlot(1MOUSE_LEFT)
       
    end;

         if 
    tabBackPack.mouseSlot(1MOUSE_LEFTthen
          begin
            wait
    (randomRange(1000,2000));
            
    clickKnife();
            
    wait(randomRange(500,1000));
            
    mouseBox(intToBox(287,328,507,352), MOUSE_LEFT);
            
    wait(randomRange(1000,2000));
            
    end;

            if 
    progressScreen.isOpen(6000then
              begin
                WriteLn
    ('Waiting for logs to cut');
                
    repeat
                  wait
    (randomRange(500,1000));
                
    until (progressScreen.getButton() < 1);
              
    end else
                
    writeLn('Couldnt open progress screen');
           
    end
    But it still tries to click the knife every time, which looks robotic since there isnt anything there onscreen.
    Thanks for any help!

  2. #2
    Join Date
    Dec 2011
    Posts
    266
    Mentioned
    16 Post(s)
    Quoted
    185 Post(s)

    Default

    Quote Originally Posted by luispadron View Post
    Hi, so when you go to cut a log for the first time it asks you what tool to you
    *add to bonfire*
    *use knife*
    *use tinderbox*

    It only asks you once and then it will automatically select the tool for you until you log out.
    I need to make a procedure run only once, during the first batch of logs I tried doing something like this

    But it still tries to click the knife every time, which looks robotic since there isnt anything there onscreen.
    Thanks for any help!
    Quote Originally Posted by luispadron View Post
    Hi, so when you go to cut a log for the first time it asks you what tool to you
    *add to bonfire*
    *use knife*
    *use tinderbox*

    It only asks you once and then it will automatically select the tool for you until you log out.
    I need to make a procedure run only once, during the first batch of logs I tried doing something like this

    But it still tries to click the knife every time, which looks robotic since there isnt anything there onscreen.
    Thanks for any help!
    Just off the top of my head, you could do a

    Code:
    procedure clickKnife();
    
    var
      knifesClicked: integer;
    
    begin
      inc(knifesClicked);
      if (knifesClicked) > 1 then
      exit;
      mouseBox(intToBox(268,182,313,228), MOUSE_LEFT);
    end;
    
    procedure cutLogs();
    var x,y: integer;
    
    begin
    
     if bankscreen.close then
       begin
          wait(randomRange(1000,2000));
          tabBackPack.mouseSlot(1, MOUSE_LEFT)
       end;
    
         if tabBackPack.mouseSlot(1, MOUSE_LEFT) then
          begin
            wait(randomRange(1000,2000));
            clickKnife();
            wait(randomRange(500,1000));
            mouseBox(intToBox(287,328,507,352), MOUSE_LEFT);
            wait(randomRange(1000,2000));
            end;
    
            if progressScreen.isOpen(6000) then
              begin
                WriteLn('Waiting for logs to cut');
                repeat
                  wait(randomRange(500,1000));
                until (progressScreen.getButton() < 1);
              end else
                writeLn('Couldnt open progress screen');
           end;
    That should only click the knife the first time. After that the count will be greater than 1 and it will just exit that procedure each time by. That's the logic anyways. You'll need to verify that that code is correct. It's 1AM and there may be some issues with it.

  3. #3
    Join Date
    Jun 2014
    Location
    Oklahoma
    Posts
    336
    Mentioned
    22 Post(s)
    Quoted
    231 Post(s)

    Default

    You could just use the toolscreen class in srl-6.

    Code:
    procedure cutLogs();
    var x,y: integer;
    
    begin
    
     if bankscreen.close then
       begin
          wait(randomRange(1000,2000));
          tabBackPack.mouseSlot(1, MOUSE_LEFT)
       end;
    
         if tabBackPack.mouseSlot(1, MOUSE_LEFT) then
          begin
            wait(randomRange(1000,2000));
            if ToolScreen.isOpen then
            begin
              Toolscreen.select('knife');
            end; 
            wait(randomRange(500,1000));
            mouseBox(intToBox(287,328,507,352), MOUSE_LEFT);
            wait(randomRange(1000,2000));
            end;
    
            if progressScreen.isOpen(6000) then
              begin
                WriteLn('Waiting for logs to cut');
                repeat
                  wait(randomRange(500,1000));
                until (progressScreen.getButton() < 1);
              end else
                writeLn('Couldnt open progress screen');
           end;

  4. #4
    Join Date
    Jun 2007
    Location
    The land of the long white cloud.
    Posts
    3,702
    Mentioned
    261 Post(s)
    Quoted
    2006 Post(s)

    Default

    Or you could use both:

    Simba Code:
    var
      CraftCount: integer;

    procedure cutLogs();
    begin
      tabBackpack.mouseSlot(randomRange(1, 7), MOUSE_LEFT);

      if craftCount < 1 then
        if toolScreen.isOpen(2000) then
          begin
            toolScreen.select('Knife');
            inc(CraftCount); // craftCount + 1 first time
          end;

      if productionScreen.isOpen(3000) then
      begin
        productionScreen.selectBox(1);
        productionScreen.clickStart();

        if progressScreen.isOpen(2000) then
        repeat
          wait(100);
          //some antiban here
        until progressScreen.getButton() < 1;
      end;
    end;

  5. #5
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Thank you all for the help! I thought there might be an srl6 function for this but didnt know it

    I'll try this tomorrow as its late right now, thanks again for being awesome and helpful!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •