I encountered a problem when using this script. It's not the problem of the script itself, but the multiplayer Synchronization.
In MP, if a hero forgets his tactics skill just before initiating a battle, and then initiates a battle with another hero with tactics, this defending hero cannot place the troops correctly (coz (tacticsRange)=0).
I checked the Tactics levels on the defender's PC, it shows both heroes have Expert Tactics, which isn't true coz the attacking hero has already forgotten Tactics skill.
Here's my revised script.
Allow LMB on active stack - fixed
Allow LMB on opponent's stacks - fixed
Place wide stack [here][W][W] - fixed
Provide better acting side check for hot seat - fixed
Introduce mouse_owner - not sure what it is
The only remaining issue is the MP issue as I mentioned above - should be fixed in ERA.