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

Macro for GroupInitiative

I am new to the GroupInitiative API script and macros. I tried to to create a macro to roll group initiative and then sort the Turn Order. In the macro I put the following in the macro actions and clicked on Save Changes !group-init !group-init --sort I select tokens on the map and then run the macro. The characters are added to the Turn Order, but they are not sorted (unless the rolls put them in order naturally). Should this work or what am I missing? Thanks!
1718410102
The Aaron
Roll20 Production Team
API Scripter
The problem is that determining the initiative is an asynchronous action.  That means the order that things get executed is more like: !group-init  <start rolling turns> !group-init --sort <sort empty turn order> <first roll comes back> <third roll comes back> <second roll comes back> <...> <last roll comes back> <add turns to turn order> To get around that you either have to wait to sort until after you've added everyone (I have two macro buttons), or enable Preserve First on Sorted Add, and it should sort things when you add them to the turn order. 
Thank you for the response. I definitely was thinking of each command completing synchronously. I think I will also use two macros.