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

[Request] Grab roll result and multiply it by attribute, then send new result to chat (leaves [[(10d20)/10]] roll result, adds [[(10d20/10)*X]] roll result)

I have no idea how to do this. I've looked for scripts that might have the functionality and I've tried looking at the Wiki and various examples, but it all just makes my head spin. I don't know Javascript well enough to interpret much of the code, much less write it myself. I'm running a game in which we're using (10d20)/10 as a method of centering/weighing the dice rolls toward a result of 10. The DC system is then based on an opposed roll, or an assumed roll result of 10. The critical part of the system is that the roll results are multiplied by a percentage, which is stored as an attribute (e.g. (@{Tyrion|Concentration})). However, multiplying the (10d20)/10 result by a percentage as complex as something like 0.26471 makes it difficult for the player to know what they rolled, which makes it hard to tell when they should use a Luck Point. So, I'd like to have an API script that collects (10d20)/10 roll results and multiplies them by the attribute, and then outputs the results (rounded, not base, ceil, or floor) separately from the original (10d20)/10 result output, such that a player can see both the total they rolled out of 20 (e.g. 10), and the multiplied+rounded result (e.g. 3). At the moment, the method I have of doing that is to have the player roll (10d20)/10, then to use a very long and complicated macro to input that result into a query, choose the relevant stat for the relevant character, and output that result to the chat. It's certainly doable, but it would save a lot of time and prevent a lot of mis-clicks and mis-types if I had a script that automatically did that work for me. Ideally, I'd like a script that would use syntax like this: !result-multiplier --multiply [[(10d10)/10]] Tyrion Concentration Again, I have no idea if that, or something like it, is possible. I'm just trying to find out my options, and see if this is so easy for someone that they can just modifying some similar code that already exists but that I don't know about. Thanks for your responses!
1464339692

Edited 1464339733
Silvyre
Forum Champion
Would something like this work as a workaround? /r round([[10d20 / 10]] * @{Concentration})
1464340574

Edited 1464340703
Silvyre said: Would something like this work as a workaround? /r round([[10d20 / 10]] * @{Concentration}) That gets me 1/2 of the equation. It doesn't allow the player to see what their result out of 20 is (e.g. 10.2). I really just wish roll20 had a way of storing a roll result as a variable. That way I could just call it and re-use it in a macro like ~{save1|[[round([[10d20 / 10]])]]}    //where ~{x|y} stores result "y" as an attribute "x" [[@{selected|save1}]] [[@{selected|save1} * @{selected|Concentration}]]
1464341035
Silvyre
Forum Champion
aɪːɛs̆ said: Silvyre said: /r round([[10d20 / 10]] * @{Concentration}) That gets me 1/2 of the equation. It doesn't allow the player to see what their result out of 20 is (e.g. 10.2). This is what it looks like in action:
1464341387

Edited 1464341546
Oh man. I'm so used to using templates that I didn't even remember what using the basic roll function looks like. Thanks!
1464341471

Edited 1464341625
Silvyre
Forum Champion
You're welcome! Additionally, here's a macro using PowerCards that might do what you'd like: !power {{ --name|Sample Macro --Roll result:| [! [^R] !] --Calculation:| [[ round([$R] {10d20 / 10} * @{Concentration}) ]] }}
1464341649

Edited 1464341935
Hmm. I'll mess around with PowerCards and see what I can do. Thanks again! :)
1464364703
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Also, as a note, you can always hover over the output of anything in [[]] to see what the results of the specific rolls are