Jump to content
jDavies97

Really simple script, need help!

Recommended Posts

Ello jDavies97,

 

Test if this does what you are looking for:

 

// Script stops with CTRL + ALT + S

const
 INTERVAL = 250; // Minimum interval between button clicks? 1000 milliseconds = 1 second.
 INTERVAL_R = 150; // Randomness for the interval between button clicks.
 CLIENT_ACTIVATION = True; // Activate client in script setup? False to disable.
 AREA_XS = 0; // Custom area for bitmap detection. Keep values as 0 if you want full client area to be scanned!
 AREA_YS = 0;
 AREA_XE = 0;
 AREA_YE = 0;
 MOUSE_SPEED = 25; // The higher value, the faster mouse movement.

var
 area: TBox;
 click: TPoint;
 mark, randomness: Integer;
 yesButton, skipAD: TSCARBitmap;

procedure SetupScript;
var
 w, h: Integer;
begin
 if CLIENT_ACTIVATION then
   GetClient.Activate;
 yesButton := TSCARBitmap.Create('deNrtl99LWmEYx88f0cXWhdfhosKS/L' +
   'HCEEEQSZAgIiIKvPV++AcIu2gLHDbGzu1GG9pWtLEf0kXbWilNIt1mm8f90LXJ' +
   '0XPStHPMHTuPetxosK6eA+/L5+Z8n+cI3/frec57/NRl6nR+noCQ2twcASHi7C' +
   'wBIcLMDAEhJ9PTBIRUp6YICKlMTuJm/LGG8lANfMbxls4YNbLo0RgZ7BYuwvHE' +
   'BG7oGl+XVyni3wLRufeKBZXfO8Fu4SKU3G7svMxABPXEvuVMsfiTEAsv3nWrwM' +
   'L/c+RyoeeOyEEw2ftDBy7X61ACrjMv2m32IR8FE6+BdlTxC6OLypI0EofsyF3z' +
   'TqcKeM5AEOxm/KouCrFw4m1oSOm6Pd5Iqa5YCdrTrUtJVZvOR9HZescqb99Cbr' +
   'nocKiBJQHeMmySbu4/86xZNW1E5LnGVOVm+fliIxsmx8frm9Cfhv7jOH8aX0Ju' +
   'uWC3q4PgO6HjL88JwWbJ8FB+HCrRICjrn+Smw5Wxw+0CzEBammCXQmPq8MvabG' +
   'qhmlbEkn7a0t+HPyh2/ozmTCu/XSzvcorb2KS30XBDj91s3mpVDYGdCmxvkQ20' +
   '9aOdYv2cVdsN5K1PxL/07L0rCdxmf1ks6uFRHvY1lVPqawcwtUKm8+9d70insJ' +
   'XDbfbnyIh6WGnlklXqN2MifHh6F/pb+vCDLkq63O/putYzDGL/MhzMuBiP2+wP' +
   's1k9hNu5dJa4GPfnK4bySt+e+bD5+5uClBeINJywhTXsZnMGg3pYbR7JPpf/VW' +
   '0vYdXARblOjasuqMBsVq8nIOTb4CABIV8HBggI+dLXR0BIpreXgBBGqyUg5De/' +
   'FZ5Q');
 skipAD := TSCARBitmap.Create('deNrtlM0NwyAMhT1Bh+kyjMQMDBD5zghcW' +
   'CEbcMgQbQKG2Py0iZRIPRRxSKzY/vx45AkPeP3XVctbAAPKhds7LagMwIShGy/' +
   'b+gFVwGkL6vlM01nzskepUlYOBqfAaH+dVqlO3Nofpmq7B4eSymtDzym4aUWzq' +
   'CyywuVTR78NW3VRwA+oR5U2P5pCFVjBhiqWIgN0pNhzpSCElM607yuSosImKqt' +
   '5Sk1FVkl+a+Xi8dHz2O2NpGtfrmEx6oCKxT8YJqYwS2RtO1QBrXydhIWUQ80O9' +
   '5RWYi7DPf9Vq/SBxK7uILNQn0reYmkMgVrSuVf76dXPSlooJpKAK0NNNbhBw17' +
   '7LLlmucgDX51b0le/su6iegMJtWwu');
 area := Box(AREA_XS, AREA_YS, AREA_XE, AREA_YE);
 GetBoxSize(area, w, h);
 if ((w < yesButton.Width) or (h < yesButton.Height) or (w < skipAD.Width) or (h < skipAD.Height)) then
   area := GetClient.ImageArea;
end;

procedure Wait2(MS: LongInt);
var
 t: Integer;  
 k: Byte; 
begin
 t := GetSystemTime;
 k := CharToVKey('s');  
 repeat
   if (GetCurrentKeyState(VK_CONTROL) and GetCurrentKeyState(VK_MENU) and GetCurrentKeyState(k)) then // CTRL + ALT + S
     TerminateScript;
   Wait(1);
 until ((GetSystemTime - t) > MS);
end;

procedure OffsetPoint(var pt: TPoint; xOffset, yOffset: Integer);
begin
 pt.X := (pt.X + xOffset);
 pt.Y := (pt.Y + yOffset);
end;

function FindButton(var pt: TPoint): Boolean;
var
 x, y: Integer;
begin
 Result := FindBitmap(x, y, yesButton, area.X1, area.Y1, area.X2, area.Y2);
 case Result of
   False:
   begin
     Result := FindBitmap(x, y, skipAD, area.X1, area.Y1, area.X2, area.Y2);
     if Result then
       pt := BoxCenter(Box(x, y, (x + skipAD.Width), (y + skipAD.Height)));
   end;
   True: pt := BoxCenter(Box(x, y, (x + yesButton.Width), (y + yesButton.Height)));
 end;
 if Result then
   OffsetPoint(pt, RandomRange(-6, 5), RandomRange(-3, 2));
end;

begin                         
 SetupScript;
 Wait(1000);
 repeat
   if ((GetSystemTime - mark) >= (INTERVAL + randomness)) then
     if FindButton(click) then
     begin
       MoveMouseEx(click.X, click.Y, MOUSE_SPEED);
       MouseBtnDown(click.X, click.Y, mbLeft);
       Wait(35 + Random(25));
       MouseBtnUp(click.X, click.Y, mbLeft);
       randomness := Random(INTERVAL_R);
       mark := GetSystemTime;
     end;
   Wait2(10);
 until False;
end.

 

Obviously I couldn't test it.. :P So, I hope it does what you need.

Let me know if it doesn't work the way you needed and I will tweak it.

 

-Jani

Edited by Janilabo
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...