Jump to content

Need help on this script


Recommended Posts

Hi guys,

I'm pretty new to AutoIt. I use an android emulator to play Clash of Clans on my pc. I am trying to add enter key functionality to the app so it will hit the send button in game when i hit enter.

Anyways this is the script im having trouble with 

#include <MsgBoxConstants.au3>

HotKeySet( "{F1}", "start")
HotKeySet( "{F2}", "terminate")
HotKeySet( "{Enter}", "sendStuff")
While 1
   sleep(10)
WEnd
Func start()
   While 1
      ControlClick("BlueStacks App Player", "", "", "left", "1", 1194, 905)
      Sleep(290000)
   WEnd
EndFunc
Func sendStuff()
   Local $color=PixelGetColor(548,143)
   if WinActive("BlueStacks App Player") Then
      if($color == 0xF8FCFF) Then
         ControlClick("BlueStacks App Player", "", "", "left", "1", 554, 149)
      else
         ControlClick("BlueStacks App Player", "", "", "left", "1", 554, 100)
      endif
   Else
      Send("{Enter}")
   endif
EndFunc
Func terminate()
    Exit
 EndFunc

Everything works, except when BlueStacks is not my active window, it does not send the enter key as it should. Any input will be greatly appreciated

Link to comment
Share on other sites

  • Jos locked this topic

To answer your question as why I would use AutoIt to make a "Bot"

First of all it wasnt a bot, it simply helps me play a game not made for a computer, on a computer

and 2. There is a full bot written in Autoit for this game, should check it out. clashbot.org

 

Edited by Melba23
Post merged from separate thread
Link to comment
Share on other sites

  • Moderators

dr3w1792,

Read the as you were told and do not start any other stupid threads like this one which I have no merged with the original.

M23

 

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...