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

Problem with roll formula

1475523783
Tomaxx
Sheet Author
Hi everyone, I'm working on a sheet for Blue Planet v2 and have problems with the syntax of skill rolls. Three factors come into play: Attributes, like Build, Fitness, Agility, etc. Abilities, which are in fact the names of skillgroups, and take the value 1, 2, or 3, which is the number of dice to roll for all dependent skills. The skills themselves, which have a score, like 0, 1, 2, etc. The difficulty is that much like in WoD games, the Attribute associated with the skill roll is chosen for each roll, dependent on the situation. Skills are not dependent on a single attribute. However, skills are always dependent on the same ability. The basic formula is:  Roll @{Ability} d10, keep lowest 1, < (@{Selected attribute} + @{Skill score}) = success I have two variations of the formula, neither works as intended. For the test I just used the first two Attributes, build and fitness. Btw the @{ADMINISTRATION} bit works correctly, returning 1, 2 , or 3 as is set in the ability "Administration". <button type='roll' value="/roll @{ADMINISTRATION}d10kl1<[[?(Choose an attribute:|"Build",@{BUILD}|"Fitness",@{FITNESS})+@{BUREAUCRACY} ]] " name="roll_bureaucracy"></button> This returns in the chat: Tomaxx (GM):rolling 3d10kl1<[[?(Choose an attribute:| 3 = 3 <button type='roll' value="/roll @{ADMINISTRATION}d10kl1<[[?(Choose an attribute:|Build, @{BUILD}|Fitness, @{FITNESS})+@{BUREAUCRACY} ]] " name="roll_bureaucracy"></button>  This returns an error message: SyntaxError: Expected "(", ".", "[", "abs(", "ceil(", "d", "floor(", "round(", "t", "{", [ |\t], [+|\-] or [0-9] but "?" found. I'd be very grateful for help with a correct formula for the Attribute selection part. Thanks in advance :)
Your Roll Query is using parentheses instead of curly braces.
1475525229

Edited 1475525658
Tomaxx
Sheet Author
That worked with the second formula. Thanks a million for your very prompt reply Silvyre :)
1475942018

Edited 1475942045
Tomaxx
Sheet Author
Hi everyone, I have a followup question on this roll formula. Generally it works just as intended, but I am nitpicking on the presentation of the roll in the chat column. Here is the code:              <button type='roll' value="/roll @{administration}d10kl1<[[?{Choose an attribute | Build, @{build} | Fitness, @{fitness} | Agility, @{agility} |                     Dexterity, @{dexterity} | Awareness, @{awareness} | Awareness-Chemical, @{chemical} | Awareness-Hearing, @{hearing} |                     Awareness-Intuition, @{intuition} | Awareness-Touch, @{touch} | Awareness-Vision, @{vision} | Intellect, @{intellect} |                     Presence, @{presence} | Will, @{will} | Endurance, @{endurance} | Reflexes, @{reflexes} | Strength, @{strength} |                     Toughness, @{toughness} }+@{bureaucracy} ]] Bureaucracy" name="roll_bureaucracy"></button> This displays: Tomaxx (GM): rolling 3d10kl1<3 Bureaucracy (10 + 8 + 5) = 0 Successes This is absolutely correct. The name of the skill being tested is "Bureacracy" and it displays because it is hand written in the roll formula. What I would like to do is also display the name of the attribute chosen from the drop-down list. For example if the attribute selected was "Intellect", I'd like the chat to display something like this:   Tomaxx (GM): rolling 3d10kl1<3 Intellect + Bureaucracy (10 + 8 + 5) = 0 Successes Is there any way I can do this? I'm stuck because the attribute select thingy is not an attribute I can call with @{attributename}.
1475949708

Edited 1475950015
Try this out (uses Inline Labels ):              <button type='roll' value="/roll @{administration}d10kl1<[[ ?{Choose an attribute | Build, @{build} [Build] | Fitness, @{fitness} [Fitness] | Agility, @{agility} [Agility] |                     Dexterity, @{dexterity} [Dexterity] | Awareness, @{awareness} [Awareness] | Awareness-Chemical, @{chemical} [Awareness-Chemical] | Awareness-Hearing, @{hearing} [Awareness-Hearing] |                     Awareness-Intuition, @{intuition} [Awareness-Intuition] | Awareness-Touch, @{touch} [Awareness-Touch] | Awareness-Vision, @{vision} [Awareness-Vision] | Intellect, @{intellect} [Intellect] |                     Presence, @{presence} [Presence] | Will, @{will} [Will] | Endurance, @{endurance} [Endurance] | Reflexes, @{reflexes} [Reflexes] | Strength, @{strength} [Strength] |                     Toughness, @{toughness} [Toughness] } + @{bureaucracy} [Bureaucracy] ]] [ ?{Choose an attribute } + @{bureaucracy} [Bureaucracy] ]" name="roll_bureaucracy"></button>
1476041929
Tomaxx
Sheet Author
Hi Silvyre, Thanks for your answer. The inline labels are pretty cool, I'll use them from now on :) The code you proposed works. In the mouseover the roll result I get a nice "Rolling 4 [Build] + 3 [Bureaucracy] = 4+3". However before the roll I get two popups, one where I choose the attribute from a list (normal), then a second popup, also called "Choose an attribute" where I have to input the attribute name by typing it in. This works, but isn't very ergonomical.  In this example I purposely misspelled Build inputting it by hand:         Is there a way to simply display the text of the rollover in the white line? Something like "rolling 3d10kl1<7  [ 4 [Build] + 3 [Bureaucracy] ]" ? A friend suggested to use rolltemplates to solve this problem, and with his help I'm trying to figure those out as well. Thanks again for your help!
1476046180

Edited 1480902218
Whoops, it looks like Roll Queries named with a trailing space behave strangely. Try this out:              <button type='roll' value="/roll @{administration}d10kl1<[[ ?{ Choose an attribute | Build, @{build} [Build] | Fitness, @{fitness} [Fitness] | Agility, @{agility} [Agility] |                     Dexterity, @{dexterity} [Dexterity] | Awareness, @{awareness} [Awareness] | Awareness-Chemical, @{chemical} [Awareness-Chemical] | Awareness-Hearing, @{hearing} [Awareness-Hearing] |                     Awareness-Intuition, @{intuition} [Awareness-Intuition] | Awareness-Touch, @{touch} [Awareness-Touch] | Awareness-Vision, @{vision} [Awareness-Vision] | Intellect, @{intellect} [Intellect] |                     Presence, @{presence} [Presence] | Will, @{will} [Will] | Endurance, @{endurance} [Endurance] | Reflexes, @{reflexes} [Reflexes] | Strength, @{strength} [Strength] |                     Toughness, @{toughness} [Toughness] } + @{bureaucracy} [Bureaucracy] ]] [ ?{ Choose an attribute } + @{bureaucracy} [Bureaucracy] ]" name="roll_bureaucracy"></button>
1476110069
Tomaxx
Sheet Author
Hehe we're getting there. I only removed the two trailing spaces, so my code looks like this:             <button type='roll' value="/roll @{administration}d10kl1<[[ ?{Choose an attribute| Build, @{build} [Build] | Fitness, @{fitness} [Fitness] | Agility, @{agility} [Agility] |                     Dexterity, @{dexterity} [Dexterity] | Awareness, @{awareness} [Awareness] | Awareness-Chemical, @{chemical} [Awareness-Chemical] | Awareness-Hearing, @{hearing} [Awareness-Hearing] |                     Awareness-Intuition, @{intuition} [Awareness-Intuition] | Awareness-Touch, @{touch} [Awareness-Touch] | Awareness-Vision, @{vision} [Awareness-Vision] | Intellect, @{intellect} [Intellect] |                     Presence, @{presence} [Presence] | Will, @{will} [Will] | Endurance, @{endurance} [Endurance] | Reflexes, @{reflexes} [Reflexes] | Strength, @{strength} [Strength] |                     Toughness, @{toughness} [Toughness] } + @{bureaucracy} [Bureaucracy] ]] [ ?{Choose an attribute} + @{bureaucracy} [Bureaucracy] ] </button> " name="roll_bureaucracy"></button>        Here is the result: Now the display and the mouseover are working as intended, but for some reason the formula adds a +2 successes, which is in fact the value of @{bureacracy}. It did not do this before. The roll should return either 0 or 1 successes.
1476133692

Edited 1476133918
Tomaxx said: Now the display and the mouseover are working as intended, but for some reason the formula adds a +2 successes, which is in fact the value of @{bureacracy}. Ah, it appears that it's not possible to nest inline labels. No matter; we can just replace "[ ?{Choose an attribute} + @{bureaucracy} [Bureaucracy] ]" with something like "|| ?{Choose an attribute} + @{bureaucracy} [Bureaucracy]" When the parser encounters invalid roll syntax (e.g. "||" when it expects something like +), it ignores it and anything following it, which we can take advantage of.
1476166547
Tomaxx
Sheet Author
Hi again, Now it displays correctly :) Thank you very much for your help Silvyre!
You're very welcome! Good luck with your sheet!
1476214529

Edited 1476249996
Tomaxx
Sheet Author
Thanks Silvyre :) Btw, for those who were wondering, Build + Bureacracy is a very valid roll for cutting in line at the DMV!