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

Need an "Auto Target-Number Checker"

1629436091

Edited 1629436287
OK... outside of creating an extra input number box that serves as a target number for a roll, does anyone have a suggestion (incl. a sheetworker) for a method to auto-insert a target number for a roll? Example... I know that I could create something like this to accomplish what I'm looking for: <div class="col-1-6 padr"> <input name="attr_rolltarget" class="ul" type="number" value="1"></div> ......... then add something like this to the button function: <div class="col-1-6 padr center help"> <button type="roll" style="font-weight: bold;" class="text-button" name="roll_check" value="&{template:RTGold} {{name=Some Check}} {{subtags=Random Info}} {{check=Result: [[ { d12 + @{some_mod} }cs>@{rolltarget} ]]}}"> Chk</button> </div> Does anyone have a sheetworker or other suggestion on how to do this without having to have the number input box (since this would only handle a portion of the system we use; see below)? The purpose of this system (if it helps) is that our game has an additional effects whenever a person rolls double (or higher) their target number. In other words... if they are rolling a d12+8 => 6 (tgt #), & they roll a 12 or greater (e.g. 2x the tgt number), their roll would receive a bonus effect. The effect is further amplified if their roll were to be an 18 or greater (e.g. 3x the tgt number).
1629453330
GiGs
Pro
Sheet Author
API Scripter
If the target number changes, but it stays the same over multiple rolls, then the best way to handle it is with an extra input box. It's information that needs to be stored on the character sheet. If it's a value that can change on every roll, then the normal query prompt like ?{Target Number?|6} should work (hopefully). This post makes me realise I haven't tested that with the new action button system. Also if you are testing for double or triple the target number, you probably want the target number entered in its own section of the rolltemplate: {{check=Result: [[ d12 + @{some_mod} ]]}} {{target=?{Target Number?|6} }} {{double=[[0]]}} {{triple=[[0]]}} and do your comparison within the sheet worker to find the double and triple effects, and report what happens on those. (You might not need the double and triple properties above, but I listed them to show you can create extra properties, which you can then use to hold extra computed values - it's a workaround so you can get more than one competed value for a roll.)
1629481836

Edited 1629483390
Yeah, I thought about using roll queries (& yeah, they work in buttons, if that's what you meant ~ haven't seen any info on "action buttons", so I may misunderstanding your comment there). I was hoping to do this without having to input the info. Using really crude examples, here's one method I had in mind (if it's possible): <input name="attr_doubleEffect" type="hidden" value="((@{maxrollvalue})*2)" readonly> <input name="attr_tripleEffect" type="hidden" value="((@{maxrollvalue})*3)" readonly> etc. Have hidden inputs store the value of a player's max, possible roll (a value that is stored via an input box on the sheet, or through auto-calcs ~ I'll get back to the auto-calc thought). Then use the attrs of those values above in a roll-template to show the values of the amplified effects. Method #2... use Roll20's syntax for identifying & highlighting critical rolls (which are the max roll of whatever dice combo you use) in a sheetworker, in combination with preset inputs ~ (& you'll have to forgive me for this one, as my JS is REALLY rusty, but you should get the gist of what I'm trying to do): if ((rollWasCrit)*2) then add 'the max roll value *2' to the hidden attr called '@{dRoll}' elseif ((rollWasCrit)*3) then add 'the max roll value *3' to the hidden attr called '@{tRoll}' elseif ((rollWasCrit)*4) then add 'the max roll value *4' to the hidden attr called '@{qRoll}' If the method above is even possible, I could just add each of the preset attrs to every roll-template I have, & it would simply populate those attrs with the relevant values when they're needed. If a query is the only way to do this, I guess my players will have to make do (e.g. I've tried queries on rolls before, & they didn't like having to constantly input numbers... this is why I'm trying to find a work-around, if one exists). **Edit** By pref. I'd like a way to auto-calc the max., nat roll a player can get (from the value they enter into a 'damage' input), & have the sheet add the total possible value to a readonly input. This way, I can work into the PC sheet in a variety of ways (plus.. the players can see the values they need to roll to get their bonuses).
After looking at the new roll parsing / action buttons, I'm thinking I might   be able to accomplish what I'm trying to do with that. In the mean-time, I'll take any advice on the info I gave above.
1629489710
GiGs
Pro
Sheet Author
API Scripter
With the new roll system, you shouldnt need to have attributes for 2x and 3x target. Just send the target, and you'll be able to calculate those totals in the sheet worker, which i think is what you were doing in your method 2. You wont be adding to a hidden attribute on the character sheet, but doing the calculation in the worker, and reporting whatever result it creates. It's hard to give more conrete details without knowing the specifics of your roll mechanic, but the only attribute you should need on the sheet is the basic target.
1629579301

Edited 1629579795
Thx for the help GiGs!! I think I've managed to get something worked out. I don't think that what I'm trying to do is possible with R20 (at least, not in the way I want to do it).  In addition to trying to create an inline "multiple crit checker", I also wanted the various results (e.g. 2x, 3x, etc.) to highlight the result with their own, custom colors. For anyone following this thread, here is what I've come up with: First... HERE is another thread on how to format inline rolls to look for multiple crit values (in my case, it's a little more complicated, but this thread gave me more ideas) Second, since I INCLUDE all dice-roll mods into the factors that handle my skill crits, HERE is a thread that expands on that idea Lastly... HERE is a thread on working with dice-roll result coloring (although, in my case, I found editing my custom template CSS was easier to accomplish what I was trying to do; but this thread may help someone else). In conclusion... what I came up with was a multi-part conclusion that I'll summarize below: Edited my CSS (the " inlinerollresult.fullcrit" parameters in each custom template I have) to make the dice-roll results the color I wanted them to be Tried 2 different ways to create the roll effect I was looking for (between these 2, I chose the latter): (1) Created a roll query with one of my custom roll templates (see an example of that HERE )........ (2) Created a global input box that the players can use to enter the target number for their current roll with (as per GiGs suggestion) Created two hidden attrs; one called @{dblRoll} (which doubles the tgt #), & one called @{tplRoll} (which triples the tgt #), both of which calc & stores those values in real time Created a basic roll button (using skill dice + all mods), & under the result (in the template), the values of the @{dblRoll} (bluish) & the values of the @{tplRoll} (purple) are listed in their own rows (with the text custom colored); & using the roll formula above, the result is also highlighted in the color I wanted for each result I don't have a screenshot handy to add to this post, but I'll grab one in a bit to show everyone what I was trying to do (sort of; this is a work-around to what I was trying to do, since it seems R20 can't specifically do what I wanted). The general format looks like this though: Skill Name ----------------------- Result: 15 vs 6 Dbl: 12 Tpl: 18 I'm working on getting it to look more like this, though: Skill Name ----------------------- Result: 15 vs 6 | 12 (2x) | 18 (3x)