Jump to content
Nikromizera

Can find either bitmap image

Recommended Posts

I checked both with the DebugBitmap command and I get the correct images. Code compiles perfectly as well. I appreciate the help.

program VariableIntervalClickBitmapScript;

var 
 Pack, Cultivate : TSCARBitmap;
 x, y, randx, randy : Integer;
 Int : Integer;  

procedure RandomRightClick;
begin
       Randx := randomrange(-50,50);
       Randy := randomrange(-50,50);           
       MoveMouseEx(x+Randx, y+Randy, 5 + Random(5));
       Wait (2000 + Random (500));
       GetMousepos(x,y);
       ClickMouseEx(x, y, mbRight, 70 + Random(20));
       Wait (2000 + Random (500));  

end;

procedure ClickPack; 
begin
  Pack := TSCARBitmap.Create('deNo1lHlvG1UUxfsJ+AQ0M/NmC0lU27N6S6LIc' +
   'byNPfbYE4eGRhQQUZFA0ET0j6K2ICpUoKJABWr/CBK7VBBdgkJUAaIlyiI+FL8' +
   '3BsuKnPvuO/fcc+59yqlnTnUDfSWnRI62WrEHoZlW7PG8lZbtpGg08mqzoA2K5' +
   'qhspyWrF+jdor44c7qWU7qePqxYcWD0QzMOja6vNx2Z2Xa1lqNFrqjlpjqu6AZ' +
   'GRGbJ7BdN/vLt+XrHEXHRIHl98bl+0YpDcyWvruQVQMhPSnbs6wlXQpnT8UTH0' +
   'zM+JgSGJWs5pwBOobYjmq5aO6MszU39k31OTk7+eLy/9fJoGJJsxIGZlKxRyaS' +
   'XQWBFvtFytUZBhVjk662CxhVK0MWQHjNubcj7Ig4hYEWegAOdkgY9Kr6+Hu39+' +
   'hCew7KFUGvV6SgQG4szZxemk6IFCGmIhgIoya2eb0BY6uCJJDSQpR8Yg1Bq0gu' +
   'NlYwJaRCgu0HROjk+3lia3Uwbj375id9//fn7lTde6nnihbp779uvjo4O93Yfb' +
   'I6akWdwa1i2t86nX3z8PjypW88rPV/UcwpmrVYt0Kj1H4eyuf3KGMy1ir2/+2D' +
   '7xYSjzcHiwdMntbmp73e+/Oz6O8hy8XwKPiJza1Sd2bl9Uwrlac2CujD7rOzLV' +
   'fuh7J3uJrJMPo/39y5uxGnVPrvs3Lz29jd3P/9t9yHxtqcdHx1KmwpqI690ED+' +
   'vEL91/crVtzYRoemoDQcHp5jAjsf8YJmOC8wJac28ivV80XNx7vT9ez9efu3cm' +
   '+f6a8sep/WcCji0l88omU0CNOIfXN766OolqQmYKO9itBq5GgkoT3egkcZFcpi' +
   'HbiYa2m60y+OF2Tuf3MhOle927tx67xJzS2uINq7aMp5X73764atJDb/G89MY1' +
   '3KwWwWcWo3/DW25IiukwqHn6TR7eHDw99Mn725fkLK4Wrrk/PzD11i89+j+hVG' +
   'd68SZK+y+feNan7sFgRpwi+XMs5jGalWWI8iIUmV9wUZwlhe0QTallJPT6+n1g' +
   'oq/gPSyU0Dk7mRQk3i7IEWmfSL0zvaxxc/PTyPUsGSslpl80PTYN5sFZbIU9bw' +
   'KFDq3MyVlIerK7WZCZEI3Q2PRxhnPLm4GlNBHZYvqiXxDTNJIYL9G/Fu1IQOrC' +
   'W3ZlIQVwLL+xNGNvngH2BpWgIh8pjwhHyLfAC3JdrbliJan8SPNAOmOI1Z7XLG' +
   'k3b6eda2nFQtABjgzi3dG59WKAzGQEomJeswPCvCOEfkXMUeCJQ=='); 
  if (FindBitmapTol (x, y, Pack, 350, 100, 1700, 900, 10)) then  
  begin 
  Randx := randomrange(0,10);
  Randy := randomrange(0,3);
   MoveMouseEx(x + Randx, y + Randy, 5 + Random (5));
   GetMousepos(x,y); 
   Wait (1000 + Random (100));
   ClickMouseEx(x, y, mbLeft, 90 + Random(20));
   Pack.Free;
  end else
  begin
    WriteLn('Error on Pack')
  end;

  end; 

procedure ClickCultivate; 
begin
  Cultivate := TSCARBitmap.Create('deNqdluuPE2UUxvkX/O7uTGem04LsdttOL9Puh' +
   'bXb7fY27fS2CIjc1BghRIlGo1ziBQJCTFBRP5AYL1HiJ40mKomiEuQSBQLEVdE' +
   'YvxiRqFEBYTX4O+9EiRvjBwmZzE7Pe85znue855zMvOvmtXLhlmvXHKOZseqOW' +
   'Y7rk0NaJRny0kYpodd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N4BbwhCDQnIszpwVRil4m/M8WpEqO7NwwSfFeS8mzpETnUpcV1Xh' +
   'bVc1/fuYkZgS9o1dC3GWTyRee3nXgrddBK/BcSYcaxvjKlctX//oH1dwy3Pppm' +
   'xASSC7ptRY0p5njcN1S7+9mvmFlG9HxQ3elx64qxNQdkS8Bq1xkX8ntpay2a5/' +
   '6+Oi9q7vUDGlScp+fObFr4/pNa5evqOSVjTCJGcaAnB5ZKM1cCURfwu2S0ejys' +
   'QUEms5H6HK+SzM3J+Xembx4GYuuAntrp0snjx1aXc35ueiLe3a++fJeDKiBzet' +
   'X+vkbPjn8gUisVBsf6Pvjj98bmfmMGwmdi5D4k1sf5H3P9i1F6eHGlcuXb2sVF' +
   'i8a3P/aPmE7E+ZIZ3ghJXfs4IGXnnkcER++Z+2Zkx9Lz5SpYdCpgnlEXHppN2e' +
   '3XKuTlSrtDdt+1m6qqth+37ofz58j07dfe/Xm8UHa46MbbgXnxQu/7tkmGLrDi' +
   'smYdvzIQWAElRZ06enxOF964/HRG66Hoie2PnDp4kWq8dkdW6Q20taJowfxDNp' +
   'bvZHPTh3H+OsvZtb4hV7e7ubDhQH6gMhdS0i9VakBJ1Qc1HzXpv+gqcwLRzqzD' +
   'FnVciG8OxzBgKFw00iULChdeh14ytJbdEYefniW1TCSueOYTGrqhMtCFrRHKoc' +
   'jsNRzIz25khYXRJ5JafJB14I9mfiqkZaTMiuLQ7IVAMNT4wPPwUilYLjg3KypI' +
   'V1RbVJvYzKdQ4EBawAOmVnsD1TRxKCmylj2h2BnqKjBJ9iInpRdhSEuU1tNn5q' +
   'sJRReWOkl9T8xoHG2m5NBzK/YS8PEXgarzCNfde9mSkFVleAJjBCkBYsKbpnCR' +
   'cUGdGGPk6m4xvggR9Rpqoht15oejkAg4nqqh/NxeiSqFJH1pppUz4BSCGEUZhj' +
   'TchFgjHqrydyXTKsqopLYaGdF2WBDUPuAgCT3kro4auYaCrAOJ4z+ioxgkbKia' +
   'OHJsGvhwbX9tBWQGbhCU/kixSBUEFHtPKHAlWprlIpQxEWmqNQGhQSy7DVlAZD' +
   'tq54WUTqq4aCmmjh6S9Ye9gqrNxxVHcwKqmvpaISCpB5E7mDVTEjhwUAxrjcVG' +
   'E/9CphgpKrZJ98rcSmeYOepJvQO15PNMCU9DTl8WS0smXoDGhNw2dj8dtYsS+5' +
   '6Q2khA9RRGan9EFd/AtPRVbU='); 
  if (FindBitmapTol (x, y, Cultivate, 350, 100, 1700, 900, 10)) then  
  begin 
  Randx := randomrange(0,10);
  Randy := randomrange(0,3);
   MoveMouseEx(x + Randx, y + Randy, 5 + Random (5));
   GetMousepos(x,y); 
   Wait (1000 + Random (100));
   ClickMouseEx(x, y, mbLeft, 90 + Random(20));
   Cultivate.Free;
  end else
    begin
    WriteLn('Error on Cult')
  end; 
   MoveMouseBoxEx(Box(970, 400, 1100, 500), 5 + Random (5));
  end;    

begin

 Int := 0;

 MoveMouseBoxEx(Box(970, 400, 1100, 500), 10 + Random (5));
 Wait (1000 + Random (500));

 repeat 

     GetMousepos(x,y);

     begin
       RandomRightClick;
       ClickPack;      
       Wait (14000 + Random (2000));
       RandomRightClick;
       ClickCultivate;
       Wait (14000 + Random (2000)); 
       WriteLn('Command run ' + IntToStr(Int) + 'time(s)');
       Inc(Int);
     end;   

 until Int = 60; 


end.

Link to comment
Share on other sites

Yes it would. I have an alternate script but i don't much like it because it involves imprecise mouse movements which sometimes result in the wrong option being pressed on the right-click menu. I need it to be more specific by finding those two bitmap images in a sequence of two events. Yes, it was count to whatever you set the integer to be. Hmmmm, I will check whether it does take longer than 2.5 seconds by running it at maybe 3 seconds.

Link to comment
Share on other sites

You can always try raising the Tolerance with FindBitmapTol until your image is found...

If you are sure that an option should pop up in the Right Click Menu then you can try using:

repeat
 Wait(100);
until FindBitmapTol(X, Y, Bitmap, 0, 0, 400, 400, 10);

 

Or use something like a five second checking:

repeat
 if FindBitmapTol(X, Y, Bitmap, 0, 0, 400, 400, 10) then
 begin
   //Go and click this
   ImageFound := True;
 end else
 begin
   Wait(100);
   Tries := Tries + 1;
 end;
until (ImageFound = True) or (Tries >= 50);

 

This way the program will search for the image for 5 seconds (50 x 100 milliseconds) and then call it quits if the image is not found, or break out of the loop at the moment the ImageFound boolean is set to True...Meaning the image has been found and the menu clicked.

This is very useful if lag for example makes the Right Click Menu open after a different time every run. If you'd set the wait simply to 5000 milliseconds and the menu would open after one second you're losing 4 seconds each alliteration.

 

Hope this helps in any way :P

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...