The Bytecode Club - Reverse Engineering Forum
Developing Bot - Printable Version

+- The Bytecode Club - Reverse Engineering Forum (https://the.bytecode.club)
+-- Forum: Lobby (https://the.bytecode.club/forumdisplay.php?fid=1)
+--- Forum: Game Cheating, Botting & Reverse Engineering (https://the.bytecode.club/forumdisplay.php?fid=97)
+--- Thread: Developing Bot (/showthread.php?tid=155)



RE: Developing Bot - AtoZ - 12-15-2014

(12-15-2014, 06:32 PM)vanadium Wrote:  I know this, but to know if you have 10k elixir, or 100k elixir, you need to read the whole value. And if the value is not accurate (example: 50.000 elixir, but reads 500.000), then it fails. I disagree with the W feature, which was a lot confusing when i was using lf-robot.
I suggest we stick to thousands, far easier to understand than 10th of thousands. Think about a hard disk drive sold with 10th of thousands of Megabytes, you will love the conversion haha
Yes. You are right. Let me rethink again.. hmmm.. more ideas:
We get 2 digit from the left by tesseract and determine the existence of the 3rd digit by pixelsearch or somecode to check the color. If it returns to white, then we know it's by 10,000. if It returns to dark green then we know it is just by the thousands.

ex. 50 000 elixir and tesseract reads it 500.000

then we get 50 and check the pixel of the third digit's location.
If it is white (500 000) then 50x10,000 = 500,000. (in this case the '0')
If it is green (50 000)then it 50x1,000 = 50,000. (in this case the BLANK)

Alternatively.. if we use 3 digits.. then we get a value of 500.
But we still check the pixel of the third digit's location.
If it is white (500 000) then 500x1,000 = 500,000. (in this case the '0')
If it is green (50 000)then it 500x100 = 50,000. (in this case the BLANK)

Also we have to check the pixel to the 5th and 6th digit as well not to misread 500 as 500,000.

Do you think this will help?


RE: Developing Bot - Konloch - 12-15-2014

(12-10-2014, 02:02 AM)vanadium Wrote:  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 Smile

Let me know if you ever decide to open source it, I'd love to contribute some stuff.


RE: Developing Bot - Malosa - 12-15-2014

Check Windows folder that coc-en iTS THE LF folder with THE tesseract and files for image recognition , iT waves you slot of work , Open coc file with paint and u see the image That helpt u with your script


RE: Developing Bot - Malosa - 12-15-2014

Check THE windows folder , than coc-en there are THE tesseract and img recognition files , iT saves you alot of work , open coc file with paint and u see THE image trigger and search!


RE: Developing Bot - GeoByte - 12-16-2014

Anything us non coders with absolutely no idea how to write code or use those scripts can do to help?


RE: Developing Bot - vanadium - 12-16-2014

Learn by trying out simple things, it's not that difficult to use Autoit and there are plenty of tutorials on the web to get started. Smile


RE: Developing Bot - odySSeys - 12-16-2014




RE: Developing Bot - Antidote - 12-16-2014

First to train Tesseract you'll need the following files: (for training with supercell magic font and naming the new language 'coc')

coc.supercell-magic.exp0.tif (image file containing letters/numbers/symbols you need to train Tesseract with)
coc.supercell-magic.exp0.box (containing location of each characters inside the tif file and its translation)
coc.font_properties
coc.words_list
coc.frequent_words_list

Now I'll go into explaining how to prepare each file

You need to install the supercell font to your system first. Download from here: http://www71.zippyshare.com/v/46981357/file.html
Open Supercell-Magic_5.ttf and click install.

Then download jTessBoxEditor from this link: http://sourceforge.net/projects/vietocr/files/jTessBoxEditor/jTessBoxEditor-1.2.1.zip/download
It's a program written in Java to help automate the training process. Unzip and run it. If your PC doesn't have java, download and install it from here: http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html

Once you open the program, go to Tiff/Box Generator, click on the font and choose Supercell-Magic, for font size I choose 18pt but I'm not sure which one is optimum. For noise I set 2. Output is coc (language prefix)

For Input, you can either type directly inside the text box or input txt file. I use http://psychicscience.org/random.aspx to generate a list of 500 ramdom number from 0 to 999999 (it allows maximum 2500, I tried that but it took so long (2 hours before I gave up).
http://textmechanic.com/Generate-List-of-Numbers.html allows you to generate complete list from 0 to 999999 but jTessBox crashed when I tried to import.
Once you got the list, copy paste to the text box and click Generate. It will generate two files: coc.supercell-magic.exp0.tif and coc.supercell-magic.exp0.box. Move both to a new folder.

[Image: DDiISub.png]

For coc.font_properties, I'm not exactly sure which are the correct properties for Supercell Magic. The standard format is: <fontname> <italic> <bold> <fixed> <serif> <fraktur>. I put: supercell-magic 1 1 0 0 0

For coc.frequent_words_list, I put 0 1 2 3 4 5 6 7 8 9 (seperated by line), same for coc.words_list

Move all the files to one folder, then go to Trainer in jTessBoxEditor, choose the folder with your files in Training Data, make sure it's Train with Existing Box and Press Run. For 500 numbers it only took around 5 minutes and output coc.traineddata. Move your coc.traineddata to tessdata in Tesseract-OCR and you're good to go Smile


RE: Developing Bot - Antidote - 12-16-2014

(12-16-2014, 04:35 AM)GeoByte Wrote:  Anything us non coders with absolutely no idea how to write code or use those scripts can do to help?
Believe me 2 weeks ago I had no idea what Autoit is. Happened to come accross a piece of Autoit script that periodically click on BlueStacks while I was looking for a program to help me keep CoC from getting disconnected. Took me only 1 to 2 days to learn the basic syntax by googling. Their documentation is very good and lots of code snippets being shared online. Then another 2 to 3 days to figure out Tesseract and the rest are just finding what function you need and read it up online. I'm not a programmer myself and don't even work with computer, if you really want to learn it's not that hard Smile

I implemented idea from AtoZ to run Tesseract 3 to 5 times and get the smallest value. It works out really well. Since most of the wrong value we got are from extra number, finding minimum from 3 consecutive Tesseract run seems to minimize chance of error to very low. I tests around 100 search and only get a few wrong, a few of which are from misaligning of array (I've put a Ubound check and will see how it goes)

Also added text box from GkevinOD's idea and Pixelsearch for finding button from odySSeys. Thanks a lot guys!


RE: Developing Bot - AtoZ - 12-16-2014

(12-16-2014, 08:47 AM)Antidote Wrote:  For coc.font_properties, I'm not exactly sure which are the correct properties for Supercell Magic. The standard format is: <fontname> <italic> <bold> <fixed> <serif> <fraktur>. I put: supercell-magic 1 1 0 0 0
For coc.frequent_words_list, I put 0 1 2 3 4 5 6 7 8 9 (seperated by line), same for coc.words_list

I'm lost with these two files. How do I generate these files?

I already have the tiff/box pairs. What to do next? how do I generate the coc.font_properies and coc.frequent_words_list file?