Hey guys, new on this forum. Excited to share my little contribution on pixel botting to all of you. I know most people use AutoIt but I use AutoHotKey. They are similar so you can always re-code it on AutoIt.
0. Coordinates and color info
Any time you launch a script, you can right click on it and launch the Spy Window. Coordinates of resources, characters etc vary depending on your screen resolution. I usually script for 1920*1080 with a 125% zoom, but you can addapt the script to any screen resolution. This tool will give you the coordinates where your mouse is, and the color of that pixel.

1. Dofus client detection.
You can check for the client window name with a specific pj name, or use SetTitleMatchMode RegEx to match any name and Dofus version. I recommend that.
2. Combat detection.
You can check if a combat has started by checking the pixel colors of certain areas of your screen. For example a yellow "Ready" button appears, or the remaining turn time, which is also yellow:
![img]()
Basically you may check if a combat has started after every resource you collect on your route (because of the resource protectors). Its no big deal, it takes like 200ms to check it.
3. Combat.
The first step is to send a F1 to start the combat. You can do that by using the Send {key} instruction. Once the combat has started, I do these tasks until the combat has finished:
- Check if its my turn. If not, wait 2 seconds. (If the yellow turn bar is black, its not my turn yet.)
- If it is my turn:
- If enemy is near enough, attack him.
- If it is not near, move all your PMs, then summon your invos, or attack the enemy if possible
- Check if combat has finished (enemy dark blue color is not found on the screen anymore, and Victory/Defeat display appears)
So, how we detect where my character and the enemy are? If you used the creatures mode, the enemies are always grey/black, so by searching on the screen for that color, you can detect them and get his coordinates. For the ally is a little bit more complex, each race has its own colors in creatures mode. Anyways they only use one or two colors, so its easy to code. For example sacrieur is green and his hat and feet is orange (I usually search for the orange). If you want to avoid this step and code a script that can be used by anyone, use an encarnation weapon. Encarnations always have certain blue color, independently of your race.

Once you have the coordinates of both, and if you need to get closer to the enemy, you need to move. But how to do that?
4. Displacement.
Just use a loop that will make the character move while he has PMs > 0. That can be done by checking if there are green movement cells on your screen.
If you dont find that green, it means you have spent all your PMs.

So in order to move, we need to decide to where. It is a simple choice between the 4 adjacent cells:
![img]()
In order to check if the movement is allowed (no obstacles, no entities like summons or enemies or allies etc) just check if the target cell is green. If not, choose another one.
Once we know the allowed cells where we can move to, its time to decide the most efficient one. That can be done by calculating the (absolute) distance from the target cell to the enemy. You should move to the cell whose distance to the enemy is less. On the previous image, you can move to 1,2,3 or 4, but the best choices are cells 1 and 3. Imagine cell 1 is on coordinate 970*400 and cell 3 is on 970*500. Since the enemy is on 1200*400, doing simple maths you can calculate which cell is closer.
To move the character just click on the cell. To know the coordinates, just add or substract some pixels to the sacrieur coordinates. For example to move to cell 1, its coordinates (x,y) are (sacrieurPosX + 40, sacrieurPosY - 20). Cells 2,3,4 are the same but just changing the sign of the operations. Then move your mouse to that pos and click it.
If the most efficient cell is not avalaible, move to the second most efficient cell, if that is also not avalaible, move to the third one and so on. Also to avoid cicles, check that the most efficient cell is not the last one you have been on.
Disclaimer: this is not the most efficient pathfinding code, but is doesnt require to map or check external data, or map all the cells, or do any A* stuff. And it works like a charm. (And its super fast).

Last step is to summon some stuff, and attack the enemy. That can be done by simple clicking on the spell coordinates and then clicking on the enemy. Or if you want to summon stuff, click on the spell, then summon it near to your character. Take on consideration the cooldown of some spells, and reduce the cooldown value on your variable every time you finish your turn.
![img]()
Once the combat is finished you may want to check for the "Victory" display and send Enter key to close that interface. Then you can continue with your route or collecting resources or whatever.
Thats all for today. Routes, Resource collecting, Pods, Bank, Enclos, Treasure Hunt... will come soon!
Scripts:
https://drive.google.com/file/d/15tBKqA7nfCHGx_wOC-SwYZ4Wp3bdQX20/view?usp=sharing
VirusTotal:
