Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Nikromizera

Need help with an autoclicker script

Recommended Posts

The purpose of this script is to locate a game window and click inside this specific game window as a specific location. I was having difficulties with just using the crosshairs because even though SCAR would move to the specified coordinates, it would click on the desktop window instead (as though game client is transparent) even when the game client is selected. Anyways, this is my script and I'm having an error I cant seem to fix.

program Autoclicker;

 

var

x, y : Integer;

Int : Integer;

NewClient: TSCARWindowClient;

 

begin

NewClient := TSCARWindowClient.Create(FindWindowsEx(GetDesktopWindow, 'Game Window', '', False, False, True));

SetClient(NewClient).Free();

NewClient.Activate();

Int := 0;

MoveMouseEx (637, 396, 15);

Wait (500 + Random (500));

 

repeat

 

begin

 

ClickMouseEx(637, 396, mbLeft, 70 + Random(20));

Wait (10 + Random (100));

ClickMouseEx(637, 396, mbLeft, 70 + Random(20));

Wait (2500 + Random (500));

WriteLn('Command run ' + IntToStr(Int) + 'time(s)');

Inc(Int);

end;

 

until Int = 900;

 

 

end.

 

I get error on line 9 with Type Mismatch.

Share this post


Link to post
Share on other sites

It's because FindWindowsEx out puts an array while TSCARWindowClient.Create wants just 1 of those values

 

 

THWNDA: THWNDArray;           begin THWNDA := FindWindowsEx(GetDesktopWindow, 'Game Window', '', False, False, True); if (Length(THWNDA) > 0) then   NewClient := TSCARWindowClient.Create(THWNDA[0]);

 

 

If you look at the code hints and or use CTRL+space you'll see one is asking for TSCARWindowClient type while the other is outputting a THWNDArray another way to predict this is to notice it's a plural and or Ex function FindWindow(s)(Ex)

Edited by Wanted

Share this post


Link to post
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...