2 Attachment(s)
token, onMove,onAdd,onDelete, OnContainerChanged call order and issues.
Hi,
Find attached a quick change to coreRPG image.lua ( renamed image.txt to allow upload. ), basically it outputs some debug relating the token add/delete/move/conatainer change. The campaign used to do this is just an new one with the FG maps and an empty character named bob...
Because im in the image lua file, ive configured Token.onAdd = onTokenAdd for the debug output etc..
I've added gm chat about that is happening... on the gm side I've opened 2 maps and on the client 3 shared maps, before this sequence.
You can see that on the gm side with 2 maps you get 2 copies of the calls, one for both maps... even with just one token on one map !!!
On the client side with 3 maps open, this generates 3 copies of most calls.
Ive added a 'bTRUE', 'bFALSE' output for when the database node of the target (token) and the image (map) match.
Also note that the order of events are different for client and gm.
On the client it seems more in the correct order. When the token is added we first see onTokenAdd and I guess the 'first' onTokenMove to 'set' its position. Then a quick move by the player causes more onTokenMove, and then when the gm moves the token to a new map, we see some onTokenMove, and onTokenAdd, the 'first' onTokenMove and an onTokenDelete. I might suggest onTokenDelete before the onTokenAdd, as it seems sensible to 'delete' it from the current map before adding/moving it to the new map.
You will notice the client is missing 'onTokenContainerChanged' calls for some reason..
On the gm side, you can see the initial add of a token first generates onTokenMove before the onTokenAdd. The small move seems ok, with onTokenMove. But again the move to new map is an odd order, you can see 4 onTokenMove with the token on map id.0008, and then you get the incorrect onTokenMove for map id.0009 and the onTokenAdd follows again. You now get the onTokenContainerChanged calls and the onTokenDelete.
Again I'd probably expect onTokenDelete first then the onTokenAdd, not sure on the onTokenContainerChanged sequence probably last for me.
Clearing up the multiple calls on image that has nothing to do with the token generating the evens would be a help, or it needs to be made very very clear in the documentation that you will get calls on multiple open image maps for each token, even if its not on that map !!!
I think the sequence been in different orders between client and gm needs to be sorted, and I'd not expect to see onTokenMove calls before the onTokenAdd etc.. and why does client not get the onTokenContainerChanged calls..
The sequence is just broken in many ways.
Please let me know if/when a solution will be available.
Thanks, Pete