Okay, I think I have it working. Here's what I did to test:
1. Start MapTool (revision 5556).
2. Drag three tokens to the default map.
3. Assign all the same name.
4. Initialize the "HP" property to "1", "2", and "3" for each token, respectively.
5. Select all three and execute this macro:
Code: Select all
currentToken() = [r: currentToken()]
[HP = HP + 1]
<br>
The token IDs and proper HP values were printed for each token. Mousing over the token showed the correct HP value on the statsheet.
This fix touched a lot of files -- over a dozen! Most were small changes.
There's still what I consider a bug, but it's cosmetic only. Whenever the macro subsystem is done running a macro and there are no tokens to impersonate (perhaps because none were impersonated before running the macro) the player's name is used to add the string, "Speaking as: ABC". Yet impersonating a token and then canceling the impersonation usually removes this string entirely. It's always worked like this and trying to fix it would again touch many files and I don't want to do that.
Those with source code access please test revision 5556 with a complex framework! That will give it a good stress test. I've played with it with lmarkus' D&D/PF FW but more is better.
