Warning! This feature is still in beta state and may have bugs! NOT RECOMMENDED for beginner MyBot.run users. Only experienced users with significant bot knowledge should attempt to create new scripts.
We have not tested every possible attack, only the ones that are included. Others are not guaranteed to work. If you find a bug or an error, set $debugattackcsv to 1 in MBR Global Variables and post the log found in Profiles\01\Logs\debugAttackCSV.log. Posting a bug without this info will get your post deleted.
In future releases, there may be changes and/or additions to CSV capabiities. Mod developers: if you make a mod based on this feature, it will very likely be broken when the new features are added. Please be sure to add the date and bot version supported in NOTES section to any attack scripts posted in forums!
You can now make your own custom attack plans without editing any source code!
All you need to do is make a simple text file with .csv extension.
Where are CSV attack script files stored?
These scripted attack plans are located in the bot folder under the \CSV\Attack folder. You can add/edit these files with any text editor (notepad works, but we recommend NotePad++). Bot will automatically update the GUI ATTACK Deploy box with your available CSV attack plans when it starts (must select scripted attack). Can also manually refresh the attack plan list with green "reload" button.
How do I use CSV attack script file?
How to make custom attack csv files
View an attack made with this feature below
At the beginning of each file, you should have some notes that tell the bot what to display when your attack file is selected, like the author, date, and a brief description of your attack.
NOTE |Author: Sardo - ver. 1.0 - 07.01.2016
NOTE |Attack: Gi-Barch, 3 sides, Dark Elixir Attack.
NOTE |Make these Troops: 8-10 Giants, Barb 40%, Arch 60%, Minions optional
NOTE |Will drop Barb, Arch, All Heroes, CC and use Rage spell if enabled from GUI
will produce this when selected:
The next step is telling the bot which side to attack from. This is done with this command:
|EXTR. GOLD |EXTR.ELIXIR|EXTR. DARK |DEPO. GOLD |DEPO.ELIXIR|DEPO. DARK |TOWNHALL |FORCED SIDE|
SIDE | | | | | | | | |
You can tell the bot to only attack from one side by adding one of these under FORCED SIDE:
You can also tell the bot to attack on the side of a certain building/buildings by putting a number underneath one of the building names. Each building's number is its how much ONE of these buildings is worth. For example, if you put 5 under EXTR. GOLD, then each gold collector is worth 5 points. The bot finds which side the building is on and adds 5 points to that side. When all buildings have been detected, then the side with the most points is the side the bot will attack from.
|EXTR. GOLD |EXTR.ELIXIR|EXTR. DARK |DEPO. GOLD |DEPO.ELIXIR|DEPO. DARK |TOWNHALL |FORCED SIDE|
SIDE |1 |1 |3 |0 |0 |1 | | |
In this example, dark drills are worth 3 points while gold/elixir pumps and the DE storage are worth 1 point. This means that, if one side of the base has 1 dark storage and one gold collector and another side has one dark drill, then the bot will attack on the side of the dark drill because that side has 3 points(1 DE drill = 3 points) and the other has 2(1 DE storage = 1 point and 1 gold collector = 1 point).
There is also SIDEB command that allows adding defense buildings are targets. At present time, only defense building that can have points added to determine attack side scoring is the Eagle Artillery.
|EAGLE |INFERNO |XBOW |WIZTOWER |MORTAR |AIRDEFENSE |GEMBOX |GEMBOX |
SIDEB |0 |0 |0 |0 |0 |0 | | |
The above example will add 20 points to side of eagle artillery is detected. Sorry, the GEMBOX can not be attacked. These are place holders for more defense buildings to be added in future.
Update: V7.2+ includes additional building targets for side weigh calculation: INFERNO, XBOW, WIZTOWER, MORTAR, AIRDEFENSE
The next command involves calculating the troop drop points. Remember, this does not deploy troops. It simply calculates troop drop positions. These positions will be used later. You use the MAKE command like this:
MAKE |A |FRONT-LEFT |10 |1 |INT-EXT |0 |5 | |
You can use this image to help you visualize the following instructions:
VECTOR is the name of the drop calculation. One VECTOR is basically a list of where troops can be dropped. You can have multiple vectors, up to one for each letter of the alphabet. If you need more than 26 vectors, you can reuse them. You can MAKE a vector with same letter more than once, and the DROP commands after that MAKE will use new locations.
SIDE tells the bot which side to attack from. It uses the main side made by the SIDE command to determine which side is which. In the images below, you will see which main side was calculated by the SIDE command, and where the troops would be dropped if you put a different side in the MAKE command.
DROP_POINTS is how many different places troops should be dropped. If it is 1, then all troops will be dropped on one spot. If it is 2, troops will be dropped on two spots. As you can see in the image, each of the 8 sections has 10 numbered drop points(circles). These are where your troops will be dropped.
ADDTILES is the distance from the red line. In the picture, the red circles are the drop points with a ADDTILES of 1. The green circles have an ADDTILES of 2. If you want to drop spells inside the base, then you will have to make a vector with a negative number for ADDTILES.
VERSUS is the direction of troop drop. INT-EXT means that the bot will start dropping troops from the middle of the edges to the corners of the map. EXT-INT means that troops will be dropped from the corners of the map to the middle of the map.
RANDOMX_PX and RANDOMY_PX are the amount of randomness to use when dropping. If you have a randomx of 2 and a randomy of 3, then the bot will drop each troop between [droppointX-2, droppointY-3] and [droppointX+2, droppointY+3]. A higher randomness amount may make the bot look more humanlike, but there is a higher chance of accidentally dropping into the red area.
UPDATE: v7.2+ capability - DROP on BUILDING
BUILDING gives ability for vector to be created that targets buildings. There are two types of drop on building vectors that can be created.
When DROP_POINTS = 1; the vector created is on location of building found via image search.
When DROP_POINTS = 5; will create five (5) DROP locations that are near red line, at shortest distance to building specified on side of attack.
If no target buildings are found on side of attack, building location will be randomly picked, usually on top half of base if more than one exists.
With building target MAKE vectors; VERSUS, and RANDOM x,y values will be ignored.
VERSUS needs to have valid entry in field: "EXT-INT", "INT-EXT", or "IGNORE".
RANDOM can be empty and is ignored as the image find will create variability between attacks and we do not need to add more.
ADDTILES is also ignored when using NEAR BUILDING target, but can be used with drop on building to move spells towards/away from attack troops coming to help them reach the building.
Available BUILDINGS to target are: TOWNHALL, EAGLE, INFERNO, XBOW, WIZTOWER, MORTAR, AIRDEFENSE
Here is summary for MAKE BUILDING:
|A |FRONT-LEFT | 1 or 5 |same=1 NA=5|IGNORE | | |nameofBldg |
Drop commands actually drop troops. It uses the vectors you created in step 3 to determine where to drop the troops.
DROP |A-B |2 |1 |giant |0 |0 |800-1200 | |
VECTOR: use one of the vector letters you have created with a MAKE command here. Note that you can drop on multiple vectors at the same time by separating the vector numbers with a "-". In the example above, the DROP command would drop troops on vectors A and B at the same time.
INDEX: Which "drop points" to use. If you created 10 drop points with the MAKE command and put 5-10 in the INDEX column, then the bot will only drop troops on points 5 through 10.
QTY_X_VECT: How many troops to drop. If you specify a range here, the bot will choose a random value between the two numbers you set. The number of troops that will be dropped at each point will be QTY_X_VECT/# of INDEX values.
TROOPNAME: Which troop to drop in this wave. Here is how to figure out the name of the troop:
For elixir and dark elixir troops, the word to put under TROOPNAME is the first four letters of the full troop name(exception: if you want to deploy giants, put giant under TROOPNAME) eg. Dragon -> drag, Lava Hound -> lava, Giant -> giant For spells, put the first letter of the spell name, then the word "SPELL"(exception: for haste spell, put HaSpell because heal spell is HSpell) eg. Lightning Spell -> LSpell, Heal Spell -> HSpell, Poison Spell -> PSpell There are a few special units: Barbarian King, Archer Queen, Warden -> King, Queen, Warden Clan Castle -> Castle
DELAY_DROP: If dropping multiple troops on the same spot, how long to wait between each troop.(in ms)
DELAYCHANGE: If dropping troops on multiple spots, how long to wait after dropping on each spot. For this, SLEEPAFTER, and DELAY_DROP, you can specify a range so the bot's speed is random.
SLEEPAFTER: How long to wait after dropping the wave before moving on to the next instruction.
UPDATE: v7.2+ capability
Drop on BUILDING target vectors use DROP fields almost same. Key difference is limit on acceptable values for INDEX field. These can be ONLY "1" for drop on building, OR a range with values from 1-5 for drop near BUILDING. These can be a list of comma separated numbers like: 1,3,5 using values 5 or less, or partial range like 2-4. Example DROP line
DROP |Same |Any < 5 | Same | Same | Same | Same | Same | |
Wait is a very simple instruction, works like this:
WAIT |100-300 | | | | | | | |
This tells the bot to wait between 100 and 300 ms. During this time, the bot will also check for some certain end battle conditions if you have them enabled(certain amount of stars reached/0 resources left).
This command will make the bot check the number of remaining troops. Keep in mind that this is one of the slowest functions, which can take up to 10 seconds to complete on slower PCs. Try not to use it too much.
RECALC| | | | | | | | |
7. Debug scripted attacks
There are several debug variables located in the Global Variables.au3 file that can be enabled to help with testing and debug of CSV files.
Global $g_iDebugSetlog = 0, $g_iDebugOcr = 0, $g_iDebugImageSave = 0, $g_iDebugBuildingPos = 1, $g_iDebugSetlogTrain = 0, $g_iDebugDisableZoomout = 0, $g_iDebugDisableVillageCentering = 0
Global $g_iDebugAttackCSV = 1, $g_iDebugMakeIMGCSV = 1 ;attackcsv debug
When you enable the AttackCSV variables, code provides more detailed log information during CSV attack, PLUS a separate log file showing how every line in CSV file was processed.
The MakeIMGCSV will save in profile, both a clean image of base being attacked, and a mapped image. The mapped image shows the red line points, drop points, and building locations required from attack plan file.
If you enable the BuildingPos variable, you will also see log information of building positions found during search, before CSV executes (If building is known from search filter, it is not detected again in CSV)
8. Sharing your attack plans!
Once you have made and perfected your attack, please share it here: https://mybot.run/forums/index.php?/forum/76-csv-attack-files/
You will also find sub-forums in same location for support and discussion if you need help creating attack plans.
Thanks for supporting your community!