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]

1431900269
vÍnce
Pro
Sheet Author
When you added the --bonus option it was a way for me to sneak it in there for individuals. :-) I made a feeble attempt at hacking your script last summer to include the init bonus as an added decimal, but failed miserably. I am not a programmer.
1431901467

Edited 1431901483
Gen Kitty
Forum Champion
'Initiative normally' doesn't jive with 'an initiative attribute that is unique to each token', so you're just confusing me further :> I mean, give me some names of your attributes? Explain *why* each token has a differently named attribute for init? (I don't use GroupInit for my PCs, only for the NPCs and the NPCs don't get the benefit of decimals to break ties, because they're NPCs so I haven't had to poke at the decimal part of things, but I have no idea why decimals would even be related to uniquely named attributes.)
1431904013
The Aaron
Pro
API Scripter
Update: v0.8.9 - Added --Tie-Breaker option which adds an attribute *0.01 as a tie breaker. !group-init --add-group --Tie-Breaker dexterity Git: <a href="https://github.com/shdwjk/Roll20API/blob/master/Gr" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Gr</a>...
1431904741
vÍnce
Pro
Sheet Author
Vince said: Use case. I like adding (+ (0.01 * @{selected|init})) to my PF initiative macro rolls as a tie-breaker. [[((1d20 + @{selected|init}) + ?{Modifier?|0} + (0.01 * @{selected|init})) &{tracker}]] So I wanted to do the same with groupinitiative (using Individual-Roll, Bare and the attribute init) !group-init --bonus [[ ?{Modifier?|0} + (0.01 * @{selected|init}) ]] @{init} is the attribute taken the PF sheet. @{init} = (@{DEX-mod} + [[@{init-misc}]] + [[@{init-trait}]] - [[@{condition-deafened}]]) This is the little addition that adds the init mod total as a decimal to help with ties (0.01 * @{selected|init}) Works fine for our group. In the past I've used group-init as a quick and easy method to select my mob and add them to the tracker. With the addition of the --bonus I was able to also add in the the decimal trick. Contrary to the name, I like using Groupinitiative to roll init and add individual npc's/monsters to the tracker. I also like the ability to mass select tokens. This is VERY appealing. I would like the --bonus to be calculated per token(my npc tokens are linked to sheets/attributes and use @{init}) instead of just adding it as a "blanket" bonus to all token's I have selected. IMO, each token that gets it's individual dice roll, should also get it's individual bonus. Unless of course a GM wants to roll once for the mob, ie "Group Initiative". Which, I also do on occasion to help speed things up.
1431904939
vÍnce
Pro
Sheet Author
The Aaron said: Update: v0.8.9 - Added --Tie-Breaker option which adds an attribute *0.01 as a tie breaker. !group-init --add-group --Tie-Breaker dexterity Git: <a href="https://github.com/shdwjk/Roll20API/blob/master/Gr" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Gr</a>... Your compulsion to accommodate is beyond compare Aaron. Cheers
1431905258
The Aaron
Pro
API Scripter
What's good for the goose is good for the gander. =D Let me know if that works for you. =D
1431908360
Gen Kitty
Forum Champion
Ok. I misunderstood. What i thought you meant was that if you had three monsters to add to the init tracker, one might have its init mod stored under 'init' and another under 'initiative' and the last has it named 'bob' for some reason. :&gt;
1431910756
vÍnce
Pro
Sheet Author
NP GenKitty. Aaron's scripts have gotten so good we have to ask for "over-the-top" requests just to keep him busy. :-)
1431917791
vÍnce
Pro
Sheet Author
I'm probably doing this wrong (often do) on the PF sheet @{init} is added to a d20 for initiative and as mentioned above I want to add the init attribute as a decimal(tie-breaker), so I created the group !group-init --add-group --Bare init --Tie-Breaker init however, nothing is being added to the initiative roll when I run the script. As a test I made @{init}=100 so I could discern if was added. I also tried just a init group !group-init --add-group --Bare init again, nothing is being added to the roll. Suggestions?
1431918013
The Aaron
Pro
API Scripter
PM invite?
1431918112
vÍnce
Pro
Sheet Author
Coming
1432001875
vÍnce
Pro
Sheet Author
Since the PF sheet's @{init} consists of one big, ugly formula(auto-calc from multiple sheet attributes), it apparently makes groupinitiative very unhappy...
1432003663
The Aaron
Pro
API Scripter
But not for long... =D
The Aaron said: Update: v0.8.9 - Added --Tie-Breaker option which adds an attribute *0.01 as a tie breaker. !group-init --add-group --Tie-Breaker dexterity Git: <a href="https://github.com/shdwjk/Roll20API/blob/master/Gr" rel="nofollow">https://github.com/shdwjk/Roll20API/blob/master/Gr</a>... Very cool, so if I have two different tokens that end up with the same init value the higher Dex value is given the ability to go first? So would it be two separate lines or combine them like this? !group-init --add-group --Stat-DnD dexterity --Tie-Breaker dexterity
So Aaron any way to combine the Init-Assist script you wrote to me into the Group-Initative Script so that Group-Init handles everything? Prompts me for Values etc.? I assume it would need to if I wanted it to handle tie breakers for me yes?
1432058916
The Aaron
Pro
API Scripter
Yes, you can definitely add multiple different adjustment sets, you can even nest them: !group-init --add-group --Tie-Breaker --Stat-DnD dexterity --Bare initiative --Bare dexterity You should be able to use InitiativeAssitant with GroupInitative, the two are compatible as far as I know... =D
1432059209

Edited 1432060106
The Aaron said: Yes, you can definitely add multiple different adjustment sets, you can even nest them: !group-init --add-group --Tie-Breaker --Stat-DnD dexterity --Bare initiative --Bare dexterity You should be able to use InitiativeAssitant with GroupInitative, the two are compatible as far as I know... =D They totally are, I was simply thinking of Tie Breakers values being able to compare between the input methods. Ok so accomplish what I want I would use the top macro? !group-init --add-group --Stat-DnD dexterity --Tie-Breaker dexterity So Helda is a PC and has a Dexterity of 8 (-1) if you mouse over her inline roll it shows no modifiers were put in place. The rest of the dwarves have npc_dexterity of 11 (+0) and roll correctly. So its not pulling the value from Helda's Dexterity, sure its a matter of me doing something wrong, but I don't know what it is so I can correct it.
1432059401
The Aaron
Pro
API Scripter
Assuming defaults everywhere else, that would mean a character with a dexterity of 18 would roll for initiative: 1d20+4.18 Tip: if you want to see just the bonuses for creatures, you can set the roller to Constant-By-Stat, which will just give you the bonus for each selected.
What if you want to use different values for the creatures? See above, I edited my post, but you were to quick with your response :)
1432061100
The Aaron
Pro
API Scripter
That's why you can create multiple sets of rules. It will apply the first one that matches. In theory, if your first rule has npc_dexterity in it, it should be skipped for PCs as they don't have that attribute.
1432062163
Gen Kitty
Forum Champion
*eyes script* I suppose I should upgrade. I'm back at 0.8.3 -- We'll see how well I can actually use my namesake system :P :)
1432062328
The Aaron
Pro
API Scripter
Hahahah, if it's a task, you might wait a few days, I've got a nearly complete rewrite almost finished that I *SHOULD* be releasing tonight. I've got to go through the 3 remaining requests for this that you don't remember making, add support for Shadowrun (yup, it's coming!), test it, and then I'll release it. I would have done it last night, but I made the mistake of jumping in a session with Vince and he broke it up one side and down another.. spent several hours fixing it. =D
1432062937
Gen Kitty
Forum Champion
I *think* I know how I caused this error... I *think* trying to toggle the announcer caused this: /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 ^ Error: Firebase.update failed: First argument contains undefined in property 'initiativepage' at Error (&lt;anonymous&gt;) at Ba (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:49) at Ba (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) at Aa (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) at Ea (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403) at H.J.update (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318) at TrackedObj._doSave (
The Aaron said: That's why you can create multiple sets of rules. It will apply the first one that matches. In theory, if your first rule has npc_dexterity in it, it should be skipped for PCs as they don't have that attribute. Right, that is what I thought it would do, but It does not seem to be doing such. Helda does not have an npc_dexterity attirb so that should have been skipped but it doesn't look like it is, its just rolling with no modifier.
1432063234
Gen Kitty
Forum Champion
Hmph. I can toggle with buttons everything but !group-init --toggle-replace ? :P :)
1432063355

Edited 1432063441
Gen Kitty
Forum Champion
So I attempted to toggle toggle-replace and I crashed the script, again. (Yay, crash!!) /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 ^ Error: Firebase.update failed: First argument contains undefined in property 'initiativepage' at Error (&lt;anonymous&gt;) at Ba (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:9:49) at Ba (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:207) at Aa (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:8:462) at Ea (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:10:403) at H.J.update (/home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:146:318) at TrackedObj._doSave ( What's really annoying, i can't replicate the crashes :P
1432063869
Gen Kitty
Forum Champion
But in other news, I think it is slicker than owl snot that if you add inits to the tracker while unsorted, decide to sort, and then add MORE inits they ALL sort. Crashes aside, I like the updates!
1432064284
The Aaron
Pro
API Scripter
GenKitty said: Hmph. I can toggle with buttons everything but !group-init --toggle-replace ? :P :) Don't worry, I've fixed that in the new version. =D That first crash appears to be because it's trying to set the initiative page to undefined, which could happen if it thought it was rolling initiative but didn't have anything to roll for. Weird, but I put a fix in for that (default initialization of the pageid to false should fix that issue).
1432064308
The Aaron
Pro
API Scripter
Greg B. said: The Aaron said: That's why you can create multiple sets of rules. It will apply the first one that matches. In theory, if your first rule has npc_dexterity in it, it should be skipped for PCs as they don't have that attribute. Right, that is what I thought it would do, but It does not seem to be doing such. Helda does not have an npc_dexterity attirb so that should have been skipped but it doesn't look like it is, its just rolling with no modifier. I'll take a look at that tonight I guess. =D
Not sure if I am running into the same problem as others, but trying to set a "Bare" roll for npc_initiative_overall leads to no bonus being applied. This attribute is dexterity_mod + initiative. Will try to post better info once home and in front of the PC.
Ok, so to explain better. I am using Actoba's 5e sheet (default, non-shaped sheet). There is a value called initiative_overall. initiative_overall == @{dexterity_mod} + @{initiative}. @{initiative} is a simple numeric value, whereas @dexterity_mod == (floor((@{dexterity}-10)/2)). So ultimately initiative_overall is a number value derived from dexterity_mod + initiative. I run !group-init --add-group --Bare initiative_overall This properly shows the group being added, however I get no bonus when I run !group-init. If I change (or add) a group that using --Stat-DnD dexterity, this does show an appropriate bonus.
1432082872
The Aaron
Pro
API Scripter
Your woes will be alleviated shortly...
1432083352

Edited 1432083370
vÍnce
Pro
Sheet Author
Do I need to leak the "alpha" version Aaron? :-)
1432085778
The Aaron
Pro
API Scripter
Ha! Should be out tonight, you rat!!! :)
1432087166
vÍnce
Pro
Sheet Author
I've seen things...
1432099945
The Aaron
Pro
API Scripter
Update v0.9.0 -- This is a pretty massive change, so there may be some bugs (that Vince hasn't already found... =D ). First off, GroupInitiative is now using the dice engine to calculate rolls. This opens up the use of formula stats among other things. I had to remove the Bounded Stat adjustment, but I don't think anyone used that anyway. There are also a bunch of new configuration options in the help: For systems that use multiple dice for initiative, you can use the Initiative Dice Count to set the number of initiative dice to roll. For ShadowRun, you can now set an attribute to be used to determine the number of dice to roll. Look for Dice Count Attribute in the settings. This can be a simple formula, but it is a bit flakey so just be aware that it may crash your API. Once Nested Inline Rolls hit the API, it will be come more stable. Characters without that attribute (or where that attribute is a 0) will use the Initiative Die Count to determine the number of dice to roll. You can now use attributes that have formulas in them as part of your Bonus Stat Groups Anyway, Start letting me know if you find problems and I'll do my best to fix them!
1432100456
vÍnce
Pro
Sheet Author
small issue Aaron.
1432100501
vÍnce
Pro
Sheet Author
when is v0.9.1 coming? :-P Awesome man. This is great.
1432100607
The Aaron
Pro
API Scripter
Same issue? With the out of order stuff? I'm in your campaign right now...
1432101679
The Aaron
Pro
API Scripter
Update v0.9.1 -- Fixed a crash bug that had to do with Dice Count Attributes. (thanks Vince) Ok.. fixed.. =D
1432101748
The Aaron
Pro
API Scripter
Vince said: when is v0.9.1 coming? :-P Awesome man. This is great. So, 19 minutes.... =D
1432102036
Gen Kitty
Forum Champion
My version works just fine, thank you ^_^ (Pssst, your help text, ingame, still has referenced to Bounded)
1432102111
The Aaron
Pro
API Scripter
Greg B. said: The Aaron said: That's why you can create multiple sets of rules. It will apply the first one that matches. In theory, if your first rule has npc_dexterity in it, it should be skipped for PCs as they don't have that attribute. Right, that is what I thought it would do, but It does not seem to be doing such. Helda does not have an npc_dexterity attirb so that should have been skipped but it doesn't look like it is, its just rolling with no modifier. Ok, figured out what this issue is. It has to do with how getAttrByName works. Since switching to using it, there is never a point where it fails to find an attribute, as it will just return '0' for an attribute it doesn't find. =/ I'll bring that up to the powers that be, but I'm not sure we'll get a good solution to that. You might be able to just specify everything on one rule, and it might just work out. Worst case, I can probably adjust the way the groups work such that there is a key attribute that is checked to determine if a group applies, like only do this for characters with the npc attribute set to 1, or something. I'll give it some thought.
1432102214
The Aaron
Pro
API Scripter
GenKitty said: My version works just fine, thank you ^_^ (Pssst, your help text, ingame, still has referenced to Bounded) Yeah, but it says deprecated, right? I do need to clean it out of the examples...
1432103473
Gen Kitty
Forum Champion
I went back to check; you're right.
For Shadow r un, you can now set an attribute to be used to determine the number of dice to roll. Look for Dice Count Attribute in the settings. This can be a simple formula, but it is a bit flakey so just be aware that it may crash your API. Once Nested Inline Rolls hit the API, it will be come more stable. Characters without that attribute (or where that attribute is a 0) will use the Initiative Die Count to determine the number of dice to roll. Thank you man!
Nope, not working for me. Getting the following error: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: /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.
1432128396
The Aaron
Pro
API Scripter
Gozer, what have you got configured?
No bonus stats, Individual roll, ascending, Die size =6 , Initiative Die count = 1, Dice count attribute disabled, max decimal places = 2, Auto Open = on, Replace roll = on, Announce = visible.
Same as Gozer. This is what I see in the API Console. "Error: No attribute or sheet field found for character_id -JmEOgoiOyH-jIxCZqnd named " /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, Roller is currently Individual-Roll . Least-All-Roll Mean-All-Roll Individual-Roll Constant-By-Stat Sort Options is currently Descending . None Ascending Descending Initiative Die size is currently 20 Set Die Size Initiative Dice Count is currently 1 Set Dice Count Dice Count Attribute: DISABLED Set Attribute Max decimal places 2 Set Max Decimal Auto Open Init is currently Off Toggle Replace Roll is currently On Toggle Sets whether initative scores for selected tokens replace their current scores. Announcer is currently Partial .