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

[Script] GroupInitiative -- Calculate the Initiative for all selected tokens [New Thread]

1450039948
The Aaron
Pro
API Scripter
There is a bug in the API dice parser that causes it to fail like this because of space use in the formula. I was hoping they'd fix this bug soon, but it's been hanging on for a while.  I've not heard of this being an issues with the pathfinder sheet, but you might check that you don't have leading spaces in any of the stats used for initiative. 
1450066849
vÍnce
Pro
Sheet Author
Not sure if this helps... I use this for PF without errors.
1450067555

Edited 1450067754
I looked for any stray spaces in any of the character sheets I've tested for this script, no luck so far. To make sure I didn't miss anything, I also made a brand-new character sheet and tested it out. It still returns the same error unfortunately. On the other hand, I seem to have narrowed down the culprit to the recently-added Buffs section. Currently, it looks like the sheet calculates the Dexterity ability score this way: @{DEX-base} + @{DEX-enhance} + @{DEX-misc} + @{buff_DEX-total} + @{DEX-drain} When I try this out with the script, it breaks and returns the same error that I keep getting. However, when I remove the @{buff_DEX-total}, it works fine and calculates my total Dex just fine. Edit: Vince, I gave that a shot. Sadly still doesn't seem to work. Same error.
1450067792
The Aaron
Pro
API Scripter
Hmm. I'll see if I can duplicate that tomorrow. 
1450080533
vÍnce
Pro
Sheet Author
Yeah, I just realized that my screen shot is for a custom sheet with very old code.   Do you get a result from @{selected|buff_DEX-total} in chat?  I noticed that if there's anything wrong with the buffs array (usually a syntax error in the macro-text field) will cause other rolls and/or auto-calc attributes that include the buff to error out.  
Yup: ((0(0)) + (0(0)) + (0(0)) + (0(0)) + (0(0)) + (0(0)) + (0(0)) + (0(0)) + (0(0)) + (0(0))) On a sidenote, ignoring everything else and using --addgroup --Bare buff_DEX-total produces a slightly different error than before: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but ")" found.
1450140773
vÍnce
Pro
Sheet Author
As soon as the Dev's push the next update to the main server, the PF sheet will be using javascript (sheet workers) to handle all auto-calculated attributes, including buffs. &nbsp;So it's possible this could be a non-issue with the update. &nbsp;I'm not sure because Chris has handled the js conversion. You could try running a test on the dev server with the latest build of the sheet ( <a href="https://github.com/Roll20/roll20-character-sheets/" rel="nofollow">https://github.com/Roll20/roll20-character-sheets/</a>... ) to see if it's still going to give group init problems.
1450145466
vÍnce
Pro
Sheet Author
I just tried group-initiative with the latest sheet build (see above), and everything seems to work great. &nbsp;No errors. !group-init --add-group --Bare init --Tie-Breaker init|current
1450146295
The Aaron
Pro
API Scripter
Ok. I'll hold off on the duplication attempt until tomorrow. &nbsp;Vince, have you tried your usual cadre of crazy commands with the new character sheet to make sure you haven't found more bugs in my scripts? &nbsp;=D
1450147907
vÍnce
Pro
Sheet Author
The Aaron said: Ok. I'll hold off on the duplication attempt until tomorrow. &nbsp;Vince, have you tried your usual cadre of crazy commands with the new character sheet to make sure you haven't found more bugs in my scripts? &nbsp;=D I haven't... real-life and character sheets have been eating up too much time. &nbsp;Friends have decided to give 5e a trial run, so I hope to "stress test" your scripts real soon. &nbsp;;-P
1450151487
The Aaron
Pro
API Scripter
Excellent! &nbsp;5e is my favorite version. :)
1450206289

Edited 1450206320
Tested it out on the dev server as Vince suggested, and it works perfectly on my end as well. Now I gotta wait until the update is released so I can start using this script with creatures using the character sheet. Thanks a bunch for the help guys!
1450211065
The Aaron
Pro
API Scripter
That should be released live now, if you want to give it a go.
I don't know why, but in my Iron Kingdoms game, the Group Initiative take a very long time; sometime up to five minutes. &nbsp;Usually, it just fails if I have more than a dozen tokens selected. &nbsp; I had to do the following adjustments (in the in-chat-dialogue) 2 dice d6 dice bare attribute added to the roll is called&nbsp;@{initiative} (labeled "initiative" in the in-chat-command area) bare attribute added to the roll is called @{Preternatural_Awareness-switch} (labeled "Preternatural_Awareness-switch" in the in-chat-command area); this was added after-the-fact, but was promoted to top level. ...what am I doing wrong?
1450824416
The Aaron
Pro
API Scripter
Are you using the latest version?
I pulled from github today, so I think so.
1450826882
The Aaron
Pro
API Scripter
Hmm.. If you want to PM me an invite, I can jump in and do some testing...
Link sent
1450988871
The Aaron
Pro
API Scripter
Update v0.9.13 -- Fixed bug where having 10+ enemies could result in the wrong bonus being applied. (Thanks Jurph !)
Hooray! Wait, does this fix my issue? &nbsp;I will check!
1450989223
The Aaron
Pro
API Scripter
Unfortunately, it probably won't fix that. =/ &nbsp;I think the issue in your case is too many rolls for for the API to handle. &nbsp;Still testing that one.
1450989363

Edited 1450994887
Coal Powered Puppet
Pro
Sheet Author
I can still dream.... No, it doesn't fix it. &nbsp;But the rolls are better, so there is that.
1450990796
The Aaron
Pro
API Scripter
I just reviewed the character sheet for you game. &nbsp;The way it is set up ends up having 3 nested inline rolls, 2 of which requires at least 2 nested attribute lookups (2 deep). That's likely going to be too much for the API to do all at once (it fires off a separate sendChat() in parallel for each token to roll the results). &nbsp;I could likely make you a custom version that would do them in series instead, but I don't know that it would work any better. &nbsp;=/
1450991546
The Aaron
Pro
API Scripter
Ok, I tried that. &nbsp;It's still slow, but it does finish running without crashing! &nbsp;I left it in your API with the name GroupInitiative-SerialRolls. While there might be a way to make those rolls faster, it would be sizable system (Analyze actual rolls, cache minimal dynamic rolls and adjustments to avoid the cost of inline rolls and attribute lookups, event tracking for changes to the stats to rebuild the formula, etc..) which I don't think I can commit to right now. =(
1450994846

Edited 1450994873
Coal Powered Puppet
Pro
Sheet Author
I was going to tell you not to worry about it. &nbsp;Actually, going to tell you now: don't worry about it. &nbsp;It wold be nice, but there are much better things to do. &nbsp;And no worries about the Silhouette Core dice; its easy just to look at the rolls (at least, as far as I am concerned).
1450997736
The Aaron
Pro
API Scripter
Ok! &nbsp;The version I left in your game does work, so depending on how you need to use it, it should be fine. Just a little slow. :) I'll mark SC off my immediate list, though I'll likely finish it at some point. :)
Hi Aaron! I'm having a weird issue occur with GroupInit.&nbsp; I'll select a group of NPCs and then issue the command to calculate their initiatives, but I get some wild numbers coming back.&nbsp; Like a Kobold getting a result of 25 (a normal Kobold only has a +2 DEX bonus)??&nbsp; Even a result of 22 for an NPC that I know has no DEX bonus.&nbsp; Since NPCs do not get proficiency bounses, I just don't see how these numbers are possible.&nbsp; I've had to result to manually rolling for each in the middle of sessions because my players cried foul (and rightly so).&nbsp; I know its probably something I've got misconfigured, but I'm stumped.&nbsp; Any idea on what may be going on here? Thanks!
Craig L. said: Hi Aaron! I'm having a weird issue occur with GroupInit.&nbsp; I'll select a group of NPCs and then issue the command to calculate their initiatives, but I get some wild numbers coming back.&nbsp; Like a Kobold getting a result of 25 (a normal Kobold only has a +2 DEX bonus)??&nbsp; Even a result of 22 for an NPC that I know has no DEX bonus.&nbsp; Since NPCs do not get proficiency bounses, I just don't see how these numbers are possible.&nbsp; I've had to result to manually rolling for each in the middle of sessions because my players cried foul (and rightly so).&nbsp; I know its probably something I've got misconfigured, but I'm stumped.&nbsp; Any idea on what may be going on here? Thanks! DId you set a Bonus Stat Group?
1452192985
vÍnce
Pro
Sheet Author
Posting a screen cap can help others see what your settings are as well. &nbsp; BTW: &nbsp;Love that avatar David. &nbsp;;-P example: here's my settings for groupinitiative
1452193411
The Aaron
Pro
API Scripter
That does sound weird. &nbsp;I second the request for configs. &nbsp;Also, do you get aberrant behavior with a single token selected? &nbsp;If you turn on the Announcer and hover over the results, do they reflect the strange numbers?
1452194334
vÍnce
Pro
Sheet Author
Tiny future suggestion: I know the version info is at the top of the help/info screen, but it might be nice to include it at the bottom as well... small and indiscreet. &nbsp;I have to nit-pick, otherwise there's nothing left to do on your scripts Aaron. &nbsp;;-P
1452219277
The Aaron
Pro
API Scripter
It is in the API Log window... =D
1452220928
vÍnce
Pro
Sheet Author
What, I have to look at another screen.? &nbsp;;-P
1452285816

Edited 1452285862
Thanks for the responses.&nbsp; Here are my current settings.
1452287132
The Aaron
Pro
API Scripter
Ok. &nbsp;The issue is you have only the default group setup (which happens to be 'dexterity'). &nbsp;This default is vestigial, from the days before character sheets. &nbsp;Back then, you literally didn't have any attributes and had to manually set them up yourself. I should really take out the default. Anyway, so I bet your kobold has a dexterity and it is at least a 5. &nbsp;=D &nbsp;What's happening is it is rolling a d20 and adding the value of dexterity to it. &nbsp;That's why you're getting large numbers. You'll want to remove that default group: !group-init --del-group 1 Then add something that makes sense. &nbsp;Anymore, that means finding the initiative field on your character sheet (right click the field, view source, copy the name of the input, stripping attr_ off the front of it) and use that. &nbsp;If you're running a custom game system or not using character sheets, there are some options. Assuming your init mod is named 'init_total', you'd then add it as a group with: !group-init --add-group --Bare init_total You'd only need to do this once to setup the configuration. So, to proceed, what do you use for a character sheet or do you use something else?
1453645119

Edited 1453645135
Thanks for the response, Aaron.&nbsp; Sorry it took so long to get back to you.&nbsp; The last couple of weeks have been crazy and I haven't even been gaming.&nbsp; I thought it might be that, but wanted to get thoughts from the SMEs.&nbsp; ;-)&nbsp; I'm using a custom 5e sheet that I wrote myself.&nbsp; However, the attributes are pretty standard so what you have above should work just fine.&nbsp; As always, thanks a lot!
1453645835
The Aaron
Pro
API Scripter
No problem! &nbsp;If you are still having problems, definitely PM me an invite and GM me and I'll come sort it out with you. =D
1453650969

Edited 1453673572
I may be asking the impossible, but that seems to be your speciality :) Is there a way please, using the 5e (shaped) sheets, for PC's initiative roll to be entered manually following 'real dice' rolling as a query, eg 'rolledint&nbsp;?{rolledint?|0}' and add tiebreaker from the 5e sheet then NPC to take the&nbsp;initiative_overall|current + Tie-Breaker( initiative_overall|current )&nbsp;from the 5e sheet. And then the turn order to be opened and sorted?
1453681295
The Aaron
Pro
API Scripter
The API doesn't really have a way to prompt the user for input. &nbsp;About the best I could do is add a way of flagging manual rolls and have a button that will prompt for all of the manual rolls, which would be output to chat during a !group-init roll, and then would need to be clicked to be prompted for the numbers. Easier might be to have it put -- in for manual rolled characters and sort all -- to the top, allowing you to input them each as you roll them. &nbsp;That might be better too.. hmmm....
i had a feeling it would not that easy lol.
Aaron, I was playing around w/ this script today and found a couple of issues when trying to use the --reroll flag. The Replace Roll toggle overrules the --reroll flag. &nbsp;So if you have the Replace Roll option set to Off, you cannot use the --reroll option. &nbsp;Any chance this could get changed? When I try to use the reroll flag, the tracker disappears and I need to manually reopen it (but only if the Replace Roll option is Off, so it may fix itself if you resolve issue #1). Thanks for the wonderful script!
1454031468
The Aaron
Pro
API Scripter
Update v0.9.14 -- Fixed bug with --reroll not working if Replace Roll was off. (Thanks Three of Swords !) Both issues were resolved by fixing #1. &nbsp;=D
Great! &nbsp;I was planning on re-rolling every round in my new game, but I realized that might not work out well. I like to set spell durations (using the round calculator) in the Turn Order, and it would end up rerolling them as well.
1454272636
The Aaron
Pro
API Scripter
Update v0.9.15 -- Fixed bug with --reroll causing custom entries to be dropped off the Turn Order. (Thanks Three of Swords !) That should clear it up.. =D
I wish people I paid to do things for me were as prompt! So it works mostly fine, but there is one border case where your latest change will cause it to crash. If you rotate through the Turn Order list until the Custom entry is at the bottom of the list, then use !group-init --reroll the script crashes and returns "Cannot call method 'get' of undefined". This one was my fault. &nbsp;I forgot I had a different script that actually accessed the turn tracker. &nbsp;Aaron logged into my game and spotted the issue right away. So once again, Aaron saved the day!
1455060875
The Aaron
Pro
API Scripter
Update v0.9.16 -- Added --clear to remove all turns from the turn order. If Auto Open Init is enabled, it will also close the turn order window. (Thanks Lucian H. !)
Cool!