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 .
×
Create a free account

Turnorder change events, and token removal

1439505336

Edited 1439505748
If you have a token on the turn-order, then delete it (say it was slain). The turn order for the client will update but the API server will not receive the turn-order changed event. When you advance the turn-order, you get two events back-to-back as the API server plays catch-up. This isn't really an issue except if you have a script that's watching the top of the tracker. If you delete the token currently at the head of the tracker manually, as no turn-order event is fired, nothing updates to account for the current 'turn' which is the new head of the turn-order. Does this happen to anyone else? I do admit it's a niche case for scripts tracking initiative. I could circumvent it, but then I'd have to account that on the next turn advancement the event is old and should be ignored before coming back in sync on the second event (of the double change events). EDIT: I also believe that Campaign.get("turnorder") still returns the old turnorder with the deleted item's id still within, prior to the deletion pending on however it's internally tracked.
1439508455
The Aaron
Roll20 Production Team
API Scripter
Are you watching the 'change:campaign:turnorder', or 'change:campaign' ?  I'm seeing an event for removing the top item in the turnorder for the latter with my debugging script, and my TurnMarker script listens for the former and seems to be getting the event. I have observed some rare cases where some events are not occurring in some corrupted campaigns, the one I'm thinking of is an older one.
1439509951

Edited 1439510002
The Aaron said: Are you watching the 'change:campaign:turnorder', or 'change:campaign' ?  I'm seeing an event for removing the top item in the turnorder for the latter with my debugging script, and my TurnMarker script listens for the former and seems to be getting the event. change:campaign:turnorder I get the event but only after advancing the turn, not after an item is deleted. I'm not referring to deleting the item from the turn order, but deleting the token on the table top that is connected to the turn order item at the top.
1439512964
The Aaron
Roll20 Production Team
API Scripter
Ah, ok.  I'll give that a try and sew what events I see.
1439513235
The Aaron
Roll20 Production Team
API Scripter
Ok. confirmed.  I'm seeing that same behavior.  Weird.