Ok, I think I fixed it. Or at least made it slightly less broken <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">
(link removed)
I changed the way you select dots that should be moved (nearest dot which is above the cell) and I put the entire "For each cell" loop into a function, because I think it should not be executed on each tick.
I call this function after a line has been completed or after all dots have stopped moving.
It still uses pathfinding just to move dots, and not for its true purpose <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">
You should probably replace it with MoveTo behavior or Custom Movement or something similar.
Edit: Fixed a few more things, here is a new link:
https://www.dropbox.com/s/5tw3tg8ilfs0b ... .capx?dl=0