
GroupInitiative
Update v0.9.34 -- Added an option to preserve the first token turn when auto-sorting the turn order on token add. (Thanks andrea d.)
You can set it in the help menu or toggle it with:
!group-init-config --toggle-preserve-first
Update v0.9.33 -- Fixed token_bar, token_bar_max and token_aura options to work when tokens don't represent a character. Additionally, I've updated GroupInitiative to create a Help: GroupInitiative handout the same way TokenMod and some of my other scripts are. By default, it is only viewable by the GM. To support that, I overhauled the help quite a bit.
I've finally removed Dexterity as the default Bonus Stat Group and replaced it with a system that prompts you if you don't have something configured yet:
If you have a standard configuration for a released character sheet, let me know what it is and I'll get it added into the list.
Update v0.9.32 -- Fixed token_bar, token_bar_max and token_aura options (Thanks Lockbox313)
Update v0.9.31 -- Added support for passing token_ids using the --ids argument (Thanks Victor B. )
You can now pass an ID (if you are the GM or the API) using the --ids argument:
!group-init --ids @{target|token_id}
Additionally, I've added an external interface for scripts to request that tokens get rolled based on an array of token_ids:
GroupInitiative.RollForTokenIDs( <Array of IDs> [, Options ] );
- <Array of IDs> is an array containing Token IDs
- Options is an optional object with various properties set. Currently, the only supported property is:
- manualBonus -- a floating point number which is applied as if supplied to the --bonus argument.
Here's a sample script using it:
/* global GroupInitiative */ on('ready', ()=>{ const handleTurnOrderChange = (/* obj */ /*, prev */ ) => { sendChat('',`/w gm Turnorder Changed!`); }; let giRoll = () => sendChat('',`/w gm <code>GroupInitiative.RollForTokenIDs()</code> is not supported.`); if('undefined' !== typeof GroupInitiative && GroupInitiative.ObserveTurnOrderChange){ GroupInitiative.ObserveTurnOrderChange(handleTurnOrderChange); } if('undefined' !== typeof GroupInitiative && GroupInitiative.RollForTokenIDs){ giRoll = GroupInitiative.RollForTokenIDs; } on('chat:message', (msg) => { if('api' === msg.type && /!test-gir/i.test(msg.content)){ let cmds = msg.content.split(/\s+/); giRoll( (msg.selected||[]).map(s=>s._id), { manualBonus: cmds[1]||0 } ); } }); });
Update v0.9.30 -- Added Dice Modifiers (Thanks The Scout)
You can use this setting to append any number of things to the dice roll for initiative. Exploding, rerolls, minimums, etc. Pretty much anything that can go directly after the number of sides on the die. There isn't any error checking on what you put in here currently, so play nice!
Update v0.9.28 -- Added --toggle-turnorder command which just opens and closes the turnorder. (Thanks Cutter )
Update v0.9.27 -- Added logic to attempt to fix inline rolls that will crash the API. (Thanks Dougansf )
Update v0.9.26 -- Fixed bug where 0 was sorted strangely. (Thanks Maetco)
Update v0.9.25 -- Fixed bug causing '(stat || "").replace is not a function' error. (Thanks eastwood)
Update v0.9.24 -- Adjusted bonus calculation to deal with @{selected} and &{tracker} references (Thanks Thorsten B.)
Update v0.9.23 -- Add current and previous objects to the Notification. (Thanks Lucian)
Update v0.9.22 -- Added better handling for empty stats, hoping to fix empty character sheet attributes at creation time. (Thanks Nibrodooh )
Update v0.9.21 -- Case Sensitivity, sorting improvements and the Initiative Stack System.
For full commands, see then previous threads or the in-game help.
New & Updated Commands
- --add-group --<adjustment> ... -- All adjustments are now case-insensitive. You can use --bare, --Bare -- BaRe, etc. Added an adjustment type of --negative which applies the inverse of the value of an attribute.
- --sort -- Applies the configured sort method to the current list.
- --clear -- Removes all entries from the turn order.
- --adjust-current <value> [minimum] -- Adjusts the current turn by somevalue, with an optional minimum value.
- --stack [stack command] -- This is a big addition to GroupInitiative. The stack commands let you store the state of the initiative and restore it at a later point. Here's a list of the possible stack commands:
- list -- List all of the stored turn orders. This is the default command if you don't supply one.
- clear -- Clear all the stored turn orders.
- copy [label] -- Copy the current turn order to the stack. Anything after the command will be used for naming it in the stack. You can also use the dup instead of copy.
- push [label] -- Puts a copy of the current turn order on the stack and clears the turn order. Anything after the command will be used for naming it in the stack.
- pop -- Replaces the current turn order with the last entry in the stack, removing it from the stack.
- apply -- Replaces the current turn order with the last entry in the stack, but leaving a copy in the stack.
- swap [label] -- Swaps the current turn order with the last entry in the stack. Anything after the command will be used for naming it in the stack.
- tail-swap [label] -- Swaps the current turn order with the first entry in the stack. Anything after the command will be used for naming it in the stack. You can also use tswap instead of tail-swap.
- merge -- Removes the last entry in the stack and adds it to the current turn order, then sorts the new turn order with the configured sort method.
- apply-merge -- Just like merge, but leaves the stack unchanged.
- rotate [label] -- Pushes the current turn order onto the end of the stack, then removes the first entry in the stack and replaces the turn order with it. Anything after the command will be used for naming it in the stack. You can also use rot instead of rotate.
- reverse-rotate [label] -- Just like rotate, but puts the current turn order on the front of the stack and pulls off the end of the stack. Anything after the command will be used for naming it in the stack. You can also use rrot instead of reverse-rotate.
Examples
The stack stuff is very powerful, but not as polished as I would like (I actually released it tonight by accident, but there ya go!).
Save a copy of the Turn Order:
!group-init --stack dup Backup Turn Order at round 5
!group-init --stack
!group-init --stack pop
Saving again, but this time clearing the turn order by pushing:
!group-init --stack push Saving again
Now with sort descending set (was sort ascending when I pushed),
I'll use apply-merge to build a new turn order with what's stored, but leaving the copy on the stack:
!group-init --stack apply-merge
Now, swapping the current turn order for the saved one:
!group-init --stack swap
(I didn't name that one, so it got a generic title of {8 records} )
Will store custom turns and their auto change parameters as well (I named this one "A custom Turn").
Well, that's about all the examples I've got in me. Try it out a bit and let me know what you come up with!
Github: https://github.com/shdwjk/Roll20API/blob/master/Gr...
Previous Forum Post: https://app.roll20.net/forum/permalink/3975602/