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

Can GroupInititive sort Alphabetically?

1676809513

Edited 1677800679
I am using the Pathfinder for Roll20 sheet. GroupInitiative will not sort the Turn Order properly when --tiebreaker Option is used. It does seem to work randomly at times, but it mostly doesn't sort. I have added a Group for Pathfinder 1e, using this: !group-init --del-group 1 !group-init --add-group --bare initiative|current --tie-Breaker initiative|current !group-init-config --set-dice-count|1 !group-init-config --set-max-decimal|2 !group-init-config --set-roller|Individual-Roll !group-init-config --sort-option|Descending !group-init-config --toggle-replace-roll The tie-breaker adds 2 decimal places to the individual initiatives, but the descending sort sorts the initiatives as if it were text: Henry <span class="userscript-userscript-inlinerollresult userscript-showtip userscript-tipsy" style="min-width: 1em ; display: inline-block ; border: 2px solid #fef68e ; background-color: #fef68e ; color: #404040 ; font-weight: bold ; padding: 0px 3px ; cursor: help" title=" 10 [init] + 4.04 [bonus] ">14.04 Gregory <span class="userscript-userscript-inlinerollresult userscript-showtip userscript-tipsy" style="min-width: 1em ; display: inline-block ; border: 2px solid #fef68e ; background-color: #fef68e ; color: #404040 ; font-weight: bold ; padding: 0px 3px ; cursor: help" title=" 10 [init] + 2.02 [bonus] ">12.02 Octavia 20.04 Lyrum <span class="userscript-userscript-inlinerollresult userscript-showtip userscript-tipsy" style="min-width: 1em ; display: inline-block ; border: 2px solid #fef68e ; background-color: #fef68e ; color: #404040 ; font-weight: bold ; padding: 0px 3px ; cursor: help" title=" 6 [init] + 3.03 [bonus] ">9.03 Brufteng <span class="userscript-userscript-inlinerollresult userscript-showtip userscript-tipsy" style="min-width: 1em ; display: inline-block ; border: 2px solid #fef68e ; background-color: #fef68e ; color: #404040 ; font-weight: bold ; padding: 0px 3px ; cursor: help" title=" 7 [init] + 3.03 [bonus] ">10.03 Antonia <span class="userscript-userscript-inlinerollresult userscript-showtip userscript-tipsy" style="min-width: 1em ; display: inline-block ; border: 2px solid #fef68e ; background-color: #fef68e ; color: #404040 ; font-weight: bold ; padding: 0px 3px ; cursor: help" title=" 5 [init] + 6.06 [bonus] ">11.06 Dagoth Ur <span class="userscript-userscript-inlinerollresult userscript-showtip userscript-tipsy" style="min-width: 1em ; display: inline-block ; border: 2px solid #fef68e ; background-color: #fef68e ; color: #404040 ; font-weight: bold ; padding: 0px 3px ; cursor: help" title=" 2 [init] + 2.02 [bonus] ">4.02 But the the result is unsorted: I can sort the Turn Order by manually selecting Alphabetically Z-A And I get what I want:
1676817476
The Aaron
Roll20 Production Team
API Scripter
Hmm. There's a setting that preserves the current starting turn. Do you have that setting enabled?&nbsp;
Yes, sir.&nbsp; It is currently: Preserve First on Sorted Add This option causes GroupInitiative to preserve the first Turn Order entry when sorting the Turn Order after adding creatures. Disable Preserve First on Sorted Add is currently On .
I turned off Preserve First on Sorted Add and it seems to work. I use a Macro Bar button to call GroupInit: !group-init I think I will add another button, Called InitAdd. Can I turn Preserve First on Sorted Add On with a command, call !Group-Init, then turn Preserve First on Sorted Add back Off in a macro?
1676829750
The Aaron
Roll20 Production Team
API Scripter
Yes. If you click the button and then push up from within the chat, you'll see the command.&nbsp;
Never mind, I found it!&nbsp; Instead of calling !Group-init call #init So I added an InitAdd macro button with this code: !group-init-config --toggle-preserve-first !Group-init !group-init-config --toggle-preserve-first My idea was that toggle-preserve-first is initially off: select additional creature(s) to add to initiative call toggle-preserve-first to enable it call GroupInit to add the new creature(s) call call toggle-preserve-first to disable it again. But no creatures get added, although toggle-preserve-first is disabled then enabled in the chat.
Is there a way to get the current count of any creatures on the Turn Tracker? My idea is query the Turn Tracker for a list of tokens.&nbsp; If it's Zero, then regular Init, but if it's got tokens on it, then use the InitAdd.
1677074264
The Aaron
Roll20 Production Team
API Scripter
There isn't a way to query that without a special purpose script.&nbsp;
1677078196

Edited 1677078245
timmaugh
Pro
API Scripter
You can get that same effect using Fetch... it doesn't return the number of entries in the Tracker, but since you're just looking for the presence of *any* token, you could use this trick... @(tracker.token_name[none]) That will read the current turn in the tracker and return the token name if there is an entry in the order, or it will return "none" if there is none. Then you can pair that with APILogic to run a conditional check, and ZeroFrame (you'll need the version in beta ) to handle the final commands.&nbsp; I can't be sure of the exact syntax because you haven't shared your full setup, but it would generally be something like: !{&amp;if @(tracker.token_name[none]) = none}#\(Init){&amp;else}#\(InitAdd){&amp;end} With Fetch, ZeroFrame (beta), and APILogic installed, Fetch will first get the tracker info, then APIL will evaluate the return. The Fetch constructions pulling your macro text in are deferred (with a ZeroFrame backslash) so that they don't resolve until after the conditional is evaluated. The next step would be to batch-up your InitAdd macro (any result that would have multiple command lines). Your macro might have changed in the meantime, but just going just off what you posted, above, that would make your InitAdd macro look more like: !{{ &nbsp; !group-init-config --toggle-preserve-first &nbsp; !group-init &nbsp; !group-init-config --toggle-preserve-first }} I could explain more of the "why" or the "what this does", but this is typically where I begin to sound like the teacher from Peanuts. You have enough at this point to make the change and see if it works. SCRIPTS REQUIRED: GroupInit, Fetch (one-click), ZeroFrame v1.0.13b1 (beta) , APILogic (one-click)
So I found a feature with GroupInitiative. If it matters, I am running Paizo Pathfinder 1e with the Pathfinder by Roll20 character sheet. I have&nbsp; Sort Descending &nbsp;and&nbsp; Preserve First on Sorted Add&nbsp; turned on. I have a macro button called 'Init 'that contains this: !group-init !group-init --sort and it works the way I want it to, right up until it doesn't. I select 3 tokens and click the Init button.&nbsp; Works perfectly!&nbsp; Three tokens added, then sorted Descending. I advance the turn order, then I add another two tokens. &nbsp; Still Good.&nbsp; They are added and the turn order is preserved I click on a token that is already present in the Turn Tracker (Gregory) and: Alas, I lost my Turn Order!&nbsp; It's sorted descending.&nbsp; It happens whether I add an existing PC or NPC. If I add a token to the turn order that is already there, I want the turn order preserved, so nothing should happen. How can I make it so the Turn Order is Preserved no matter what?
1677709550
The Aaron
Roll20 Production Team
API Scripter
You you say " I click on a token that is already present in the Turn Tracker " are you literally just selecting it with the mouse, or do you then run some command or macro? Do you have Preserve First on Sorted Add enabled?
Just literally selecting it with a mouse.&nbsp; Since the token is already in the Turn Tracker, it sorts the Turn Order. I do have Preserve First on Sorted Add enabled.
Ah!&nbsp; I enabled Replace Roll , and that works great! The Turn Order is preserved with that On .
1677730805
The Aaron
Roll20 Production Team
API Scripter
Ok, great!