Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

Bump handleTokenChange Event Detection

Question for The Aaron, or anyone else who can explain what is/is not happening and possibly how to address it. I'm using Bump to slave starship tokens in a combat simulator. If/when a player activates a starship's cloaking device, the GM calls !bump from a macro that swaps the slaved tokens. If/when a token is manually dragged, rotated, etc., everything works fine, but because starship movement is fairly prescribed and limited, I have another script which handles all movement and token rotation via a series of macro buttons. Each button is linked to a macro which then calls the movement script via a Roll20 API Chat message. So far, so good. The problem I have is that when a token is changed via the macro/custom script mechanism, Bump's handleTokenChange (triggered in Aaron's script by the R20  change:graphic  event handler) isn't being called - the Bump companion token doesn't respond to the script-driven movement changes. If I then grab the token and "jiggle" it, Bump kicks in and the companion token syncs as expected. The problem is, I need to do this after each cloaked ship's player completes their movement and I don't always remember to do so. This is especially frustrating for players after they rotate tokens, decloak, and the companion token isn't facing in the expected direction.? Thoughts on why script driven movement isn't triggering Bump as I expect and how to address this? Maybe something with the order of script execution and/or event handlers? Thanks, in advance.
1775423889

Edited 1775424056
The Aaron
Roll20 Production Team
API Scripter
Hi Omonubi, Most events are not issued for changes made by the API, only by changes made by VTT sessions.  So when the other scripts/macros make changes to the token, Bump is not aware of them.  GroupInitiative and TokenMod are special exceptions because they implement the Observer pattern, and Bump watches for updates from them. What other script are you using to modify the token? I could probably add a command to Bump that would let you tell it to sync to the master token either for a specifc token or for all Bump'd tokens.