Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CoC Clicker 2.1
#1
First of all, allow me to apologize if this should not be here. If I am in the wrong, I am sorry about that.

So, what is this? All it is, for the most part, is a simple 'keep alive' for CoC. It is also handy for those who still manually play the game :)

While playing via BlueStacks I noticed it was a pain in the butt to try and select a troop to deploy using the mouse. So, I made this. Each troops slot has a function key associated to it. Press the function key on your keyboard to select that troop. Makes life much easier during battle.

If you have to leave CoC running for a bit while you go do something, engage the anti-idle function. Shift+F1 to engage, shift+F2 to disengage.

I use BlueStacks beta 1. If your window title is something different you will need to change this line:
Code:
$Title = "BlueStacks App Player for Windows (beta-1)" ; Window name

Also, I am using the default BlueStacks window size. If you have changed yours the troop selection portion probably won't work right for you. If you do have your window size changed and wish to change the script, it is easy to fix.

Start BlueStacks then CoC. Put this script into an empty SCITE window and run it:
Code:
HotKeySet ("{F1}", "ShowMouseLocation")

While 1
   Sleep (100)
WEnd

Func ShowMouseLocation ()
  Local $CurrentMouseLocation = MouseGetPos ()
  MsgBox ($MB_SYSTEMMODAL, "Mouse x, y:", $CurrentMouseLocation[0] & ", " & $CurrentMouseLocation[1])
  Sleep (2000)
  SplashOff ()
EndFunc    ;==>ShowMouseLocation

Start an attack on a goblin village (there is no attack timer there so take your time). Put your mouse over each troop location and press the F1 key. Make a note of the coordinates that pop up.

Once you have each location mapped, exit out of that script and open up mine. Edit the appropriate lines to match the new coordinates. For example, to change the default F1 location, edit this line:
Code:
Case "{F1}" ; Select troop position 1
ControlClick ($HWnD, "","", "left", "1", 232, 513) ;<== Edit these coordinates

Put in the new coordinates.

That's pretty much it. It is super-simple but, it gets the job done. And again, if this should not have been posted here, or posted at all, I apologize for that.

So, here is the script:
Code:
#include <MsgBoxConstants.au3>
#include <TrayConstants.au3>

Opt ("MouseCoordMode", 2)

Global $ThisVariable = 0

SplashTextOn ("CoC Clicker", "CoC Clicker 2.1", 200, 100)
Sleep (2000)
SplashOff ()

$Title = "BlueStacks App Player for Windows (beta-1)" ; Window name
$Full = WinGetTitle ($Title) ; Get The Full Title..
$HWnD = WinGetHandle ($Full) ; Get The Handle
WinActivate ($HWnD)

; Press Esc to terminate script
; Press F1 - F11 to select a troop
; Press Left Shift + F1 to enable anti-idle
; Press Left Shift + F2 to disable anti-idle

HotKeySet ("{ESC}", "Terminate")

HotKeySet ("{F1}", "HotKeyPressed")
HotKeySet ("{F2}", "HotKeyPressed")
HotKeySet ("{F3}", "HotKeyPressed")
HotKeySet ("{F4}", "HotKeyPressed")
HotKeySet ("{F5}", "HotKeyPressed")
HotKeySet ("{F6}", "HotKeyPressed")
HotKeySet ("{F7}", "HotKeyPressed")
HotKeySet ("{F8}", "HotKeyPressed")
HotKeySet ("{F9}", "HotKeyPressed")
HotKeySet ("{F10}", "HotKeyPressed")
HotKeySet ("{F11}", "HotKeyPressed")

HotKeySet ("+{F1}", "ClickyIdleEnable")
HotKeySet ("+{F2}", "ClickyIdleDisable")

While 1
  Sleep (100)
WEnd

Func Terminate()
  SplashTextOn ("Goodbye", "Thanks For Playing :)", 200, 100)
  Sleep (500)
  SplashOff ()
  Exit
EndFunc   ;==> Terminate

Func HotKeyPressed ()
 Switch @HotKeyPressed ; The last hotkey pressed.
Case "{F1}" ; Select troop position 1
ControlClick ($HWnD, "","", "left", "1", 232, 513)
Case "{F2}" ; Select troop position 2
ControlClick ($HWnD, "","", "left", "1", 286, 513)
Case "{F3}" ; Select troop position 3
ControlClick ($HWnD, "","", "left", "1", 352, 513)
Case "{F4}" ; Select troop position 4
ControlClick ($HWnD, "","", "left", "1", 414, 513)
Case "{F5}" ; Select troop position 5
ControlClick ($HWnD, "","", "left", "1", 471 513)
  Case "{F6}" ; Select troop position 6
ControlClick ($HWnD, "","", "left", "1", 534, 513)
Case "{F7}" ; Select troop position 7
ControlClick ($HWnD, "","", "left", "1", 597, 513)
  Case "{F8}" ; Select troop position 8
ControlClick ($HWnD, "","", "left", "1", 660, 513)
Case "{F9}" ; Select troop position 9
ControlClick ($HWnD, "","", "left", "1", 722, 513)
  Case "{F10}" ; Select troop position 10
ControlClick ($HWnD, "","", "left", "1", 286, 513)
  Case "{F11}" ; Select troop position 11
ControlClick ($HWnD, "","", "left", "1", 846, 513)
 EndSwitch
EndFunc   ;==> HotKeyPressed

Func ClickyIdleEnable ()
  TrayTip ("Anti-idle enabled", "CoC Anti-idle is enabled. Press Left Shift + F2 to disable. You may use your computer normally while anti-idle is enabled however, do not minimize BlueStacks.", 0, $TIP_ICONASTERISK)
  Local $CurrentMouseLocation = MouseGetPos ()
  $ThisVariable = 1
  While $ThisVariable = 1
 If IsHWnD ($HWnD) And WinExists ($Full) <> '0' Then ; Win Check
 ControlClick ($HWnD, "","", "left", "1", $CurrentMouseLocation[0], $CurrentMouseLocation[1])
 EndIf
  $Justasec = Random (30000, 90000, 1)
  Sleep ($Justasec)
  WEnd
EndFunc    ;==> ClickyIdleEnable

Func ClickyIdleDisable ()
  TrayTip ("Anti-idle disabled", "CoC Anti-idle is disabled. Press Left Shift + F1 to enable.", 0, $TIP_ICONASTERISK)
  $ThisVariable = 0
EndFunc    ;==> CLlckyIdleDisable

Enjoy!
Reply
#2
Could you please add me on skype and tell me how to get this working , I'm don't really understand it Facelineside Skype: zvonimir.krezic69
Reply
#3
I don't use skype.
Reply
 


Forum Jump:


Users browsing this thread: 1 Guest(s)

About The Bytecode Club

We're a community forum focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website