12-05-2014, 08:20 PM
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
12-05-2014, 10:04 PM
Anti, will you be creating and releasing a bot or will this just be a thread of info if users are creating their own bot?
12-05-2014, 10:22 PM
I don't intend to create a full feature bot since it's very time consuming to fine tune all details for everyone's use. For now it just helps me train troops and attack. I created this thread so people who are interested can discuss/share info 

12-05-2014, 10:36 PM
Fair enough - cant wait to see how this thread progresses.
would be interesting if the community got together and all chipped in to make a script - end result would be better than the current bots I think.
would be interesting if the community got together and all chipped in to make a script - end result would be better than the current bots I think.
12-07-2014, 03:24 AM
If i were to make a bot for myself.. u guys have any samples for me to learn?
Or is it impossible for someone like me with no experience to do a bot?
Or is it impossible for someone like me with no experience to do a bot?
12-08-2014, 03:46 PM
(12-07-2014, 03:24 AM)Captain Planet Wrote: [ -> ]If i were to make a bot for myself.. u guys have any samples for me to learn?
Or is it impossible for someone like me with no experience to do a bot?
haha don't worry, I have zero experience in botting myself, just some basic programming background.
here's the function I wrote for reading gold and elixir (bluestacks resolution 800x600)
Code:
Func ReadValue()
$Read = _TesseractWinCapture("BlueStacks App Player,"",0,"",1,2,42,70,660,490,0) ;Capture screen region with gold and elixir
$Read = StringSplit(StringStripWS($Read, 1+2+4), @CRLF) ;Strip whitespaces & blank lines and split into array
$Gold = Number(StringStripWS($Read[2], 8)) ;Convert gold to number
$Elixir = Number(StringStripWS($Read[3], 8)) ;Convert exlir to number
;$Dark = Number(StringStripWS($Read[4], 8)) ;Convert dark to number
;MsgBox(0,"Result", "Gold: " & $Gold & @CR & "Elixir: " & $Elixir & @CR & "Dark: " & $Dark)
EndFunc
12-09-2014, 10:32 PM
hi antidote.. hope you get an idea on this script and apply it to autoit..
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Clash of Clans Auto Tool for Genymotion (VirtualBox Android VM)
"""
import os
import sys
import virtualbox
import subprocess
import cv2.cv as cv
import tesseract
import PIL.ImageOps as ImageOps
from time import sleep
from PIL import Image
# Genymotion Android VM name
genymotion_vm_name = "Google Nexus 7"
menu_text = """Choose function?
1. Keep Alive
2. Auto Search
3. Quit
"""
vbox = virtualbox.VirtualBox()
genymotion_vm = vbox.find_machine(genymotion_vm_name)
genymotion_session = genymotion_vm.create_session()
def keep_alive():
while True:
genymotion_session.console.mouse.put_mouse_event_absolute(360,223,0,0,0)
genymotion_session.console.mouse.put_mouse_event_absolute(360,223,0,0,1)
genymotion_session.console.mouse.put_mouse_event_absolute(360,223,0,0,0)
sleep(60)
def auto_search():
# click search button
genymotion_session.console.mouse.put_mouse_event_absolute(660,280,0,0,0)
genymotion_session.console.mouse.put_mouse_event_absolute(660,280,0,0,1)
genymotion_session.console.mouse.put_mouse_event_absolute(660,280,0,0,0)
sleep(12)
# processing
subprocess.call("adb shell screencap -p /sdcard/screen.png", shell=True)
subprocess.call("adb pull /sdcard/screen.png", shell=True)
im = Image.open("screen.png")
#box = (60, 80, 165, 180)
#box = (53, 72, 140, 165)
box = (53, 72, 140, 130)
loot = im.crop(box).convert('L')
loot = ImageOps.invert(loot)
loot.save("loot.png", "png")
api = tesseract.TessBaseAPI()
api.Init(".", "coc",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789")
api.SetPageSegMode(tesseract.PSM_AUTO)
image = cv.LoadImage("loot.png", cv.CV_LOAD_IMAGE_UNCHANGED)
tesseract.SetCvImage(image,api)
text = api.GetUTF8Text()
conf = api.MeanTextConf()
total_loot = text.splitlines()
gold_loot, elixir_loot = total_loot[0:2]
gold_expr = gold_loot.find(" ") == 3 and int(gold_loot.split(" ")[0]) >= 180
elixir_expr = elixir_loot.find(" ") == 3 and int(elixir_loot.split(" ")[0]) >= 180
if gold_expr or elixir_expr:
print gold_loot
print elixir_loot
subprocess.call("mplayer /home/mrtux/Downloads/gun.mp3", shell=True)
api.End()
return True
return False
if __name__ == "__main__":
try:
while True:
print menu_text
answer = raw_input("Your choice: ")
if answer == "1":
try:
keep_alive()
except:
pass
elif answer == "2":
try:
while auto_search() is False:
pass
except:
pass
elif answer == "3":
sys.exit(0)
except:
sys.exit(1)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Clash of Clans Auto Tool for Genymotion (VirtualBox Android VM)
"""
import os
import sys
import virtualbox
import subprocess
import cv2.cv as cv
import tesseract
import PIL.ImageOps as ImageOps
from time import sleep
from PIL import Image
# Genymotion Android VM name
genymotion_vm_name = "Google Nexus 7"
menu_text = """Choose function?
1. Keep Alive
2. Auto Search
3. Quit
"""
vbox = virtualbox.VirtualBox()
genymotion_vm = vbox.find_machine(genymotion_vm_name)
genymotion_session = genymotion_vm.create_session()
def keep_alive():
while True:
genymotion_session.console.mouse.put_mouse_event_absolute(360,223,0,0,0)
genymotion_session.console.mouse.put_mouse_event_absolute(360,223,0,0,1)
genymotion_session.console.mouse.put_mouse_event_absolute(360,223,0,0,0)
sleep(60)
def auto_search():
# click search button
genymotion_session.console.mouse.put_mouse_event_absolute(660,280,0,0,0)
genymotion_session.console.mouse.put_mouse_event_absolute(660,280,0,0,1)
genymotion_session.console.mouse.put_mouse_event_absolute(660,280,0,0,0)
sleep(12)
# processing
subprocess.call("adb shell screencap -p /sdcard/screen.png", shell=True)
subprocess.call("adb pull /sdcard/screen.png", shell=True)
im = Image.open("screen.png")
#box = (60, 80, 165, 180)
#box = (53, 72, 140, 165)
box = (53, 72, 140, 130)
loot = im.crop(box).convert('L')
loot = ImageOps.invert(loot)
loot.save("loot.png", "png")
api = tesseract.TessBaseAPI()
api.Init(".", "coc",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist", "0123456789")
api.SetPageSegMode(tesseract.PSM_AUTO)
image = cv.LoadImage("loot.png", cv.CV_LOAD_IMAGE_UNCHANGED)
tesseract.SetCvImage(image,api)
text = api.GetUTF8Text()
conf = api.MeanTextConf()
total_loot = text.splitlines()
gold_loot, elixir_loot = total_loot[0:2]
gold_expr = gold_loot.find(" ") == 3 and int(gold_loot.split(" ")[0]) >= 180
elixir_expr = elixir_loot.find(" ") == 3 and int(elixir_loot.split(" ")[0]) >= 180
if gold_expr or elixir_expr:
print gold_loot
print elixir_loot
subprocess.call("mplayer /home/mrtux/Downloads/gun.mp3", shell=True)
api.End()
return True
return False
if __name__ == "__main__":
try:
while True:
print menu_text
answer = raw_input("Your choice: ")
if answer == "1":
try:
keep_alive()
except:
pass
elif answer == "2":
try:
while auto_search() is False:
pass
except:
pass
elif answer == "3":
sys.exit(0)
except:
sys.exit(1)
12-09-2014, 10:34 PM
and also to this one antidote..
ScanLoot(bmpHaystack)
found :=
Loop, 10
{
num := A_Index-1
bmpNeedle := Gdip_CreateBitmapFromFile( "images/" . num . ".png")
RET := Gdip_ImageSearch(bmpHaystack,bmpNeedle,LIST,0,0,0,0,5,0x000000,1,0)
Gdip_DisposeImage(bmpNeedle)
Loop, Parse, LIST, `n
{
StringSplit, Coord, A_LoopField, `,
found = %found%%Coord1%,%Coord2%,%num%`n
}
}
sort found, N ; sort list of found numbers by x coordinate
StringLeft, found, found, StrLen(found)-1
amt :=
; bring number together and return amount found
Loop, parse, found, `n
{
StringSplit, v, A_LoopField, `,
amt = %amt%%v3%
}
return amt
} - See more at: http://droidgagu.blogspot.com/2014/05/ho...Vnw4K.dpuf
ScanLoot(bmpHaystack)
found :=
Loop, 10
{
num := A_Index-1
bmpNeedle := Gdip_CreateBitmapFromFile( "images/" . num . ".png")
RET := Gdip_ImageSearch(bmpHaystack,bmpNeedle,LIST,0,0,0,0,5,0x000000,1,0)
Gdip_DisposeImage(bmpNeedle)
Loop, Parse, LIST, `n
{
StringSplit, Coord, A_LoopField, `,
found = %found%%Coord1%,%Coord2%,%num%`n
}
}
sort found, N ; sort list of found numbers by x coordinate
StringLeft, found, found, StrLen(found)-1
amt :=
; bring number together and return amount found
Loop, parse, found, `n
{
StringSplit, v, A_LoopField, `,
amt = %amt%%v3%
}
return amt
} - See more at: http://droidgagu.blogspot.com/2014/05/ho...Vnw4K.dpuf
12-09-2014, 11:10 PM
I would be interested in doing so. my email is presidentpat99@yahoo.com
I have finals coming up in school next week byut after that i have winter break
LETS DO THIS!
I have finals coming up in school next week byut after that i have winter break

LETS DO THIS!
12-10-2014, 02:02 AM
We should create a github repo with the sources, and manage updates via pull requests. It's not manageable to copy paste code here all the time.
I have a working bot in Java, using Sikuli API and Tesseract. But, i'm having hard time to make Tesseract reliable, as well as Sikuli which randomly fails in image search. I can share my Java code, but would like to trained data for Tesseract too
I have a working bot in Java, using Sikuli API and Tesseract. But, i'm having hard time to make Tesseract reliable, as well as Sikuli which randomly fails in image search. I can share my Java code, but would like to trained data for Tesseract too

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104