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

Dropdown Values for Rolling

March 23 (7 years ago)

Edited March 23 (7 years ago)
I was wondering how to assign specific values to dropdown fields. It's a bit difficult for me to vocalize so I added an illustration below.


Basically I am trying to have the bottom dropdown area pull data from "Attributes" and "Skills" and then roll the results into the Roll20 chat window. I know how to assign values with things such as name="strength1" or name="daggers1" but beyond labeling fields, i don't really know anything about them interacting with one another.
March 23 (7 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator
This sheet have an example of what you are explaining.
Found under "Dice Pools"
March 23 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
To further explain, in case the sheet is intimidating.

For each dropdown, you need an input something like this:
<select name="attr_RollAttribute" > 
	<option value="0" selected></option> 
	<option value="@{Strength}" >Strength</option> 
	<option value="@{Agility}" >Agility</option> 
	<option value="@{Intellect}" >Intellect</option> 
	<option value="@{Wits}" >Wits</option> 
</select>
Assuming each of the boxes were named RollAttribute, RollSkill, and RollModifiers, that Roll button would be something like (substitute 1d20+ with whatever you need to make your system's roll work):
<button type='roll' name='roll_RollButton' value='/roll 1d20 + @{RollAttribute}+@{RollSkill}+@{RollModifiers}'></button>
March 23 (7 years ago)

Edited March 23 (7 years ago)
That seems perfect Andrea. I copied the code over and saw that it worked in my sheet. Now I just need to fiddle with some of the settings and I feel it will work. I'll follow up with my results. :D

Also thank you for clarity GG (I posted right after you). It looks like a bit of a headscratcher for my skill level. I'm sure i'll figure it out with a bit of trial and error. I appreciate you offering clarity. It will help me figure this puzzle out.
March 23 (7 years ago)

Edited March 23 (7 years ago)
So the name= for my attributes are:
name=attr_str
name=attr_agi
name=attr_int

Here's the setup that I have from GG.



I'm not sure if i'm supposed to change the @(rollattribute) to @(rollattr_str)
or if I have to change the @(Strength) to (@attr_str)

EDIT: Nevermind. I think i'm figuring it out. I just messed up some things.
March 23 (7 years ago)
Kirsty
Pro
Sheet Author
Danny, you need to change the names to whatever you called them in your html. So you need to use @{RollAttribute} to select the attribute you've chosen with your select field.

If you've got a field called attr_Strength, then you should be using @{Strength} for the drop down list. If you called it attr_str then you would call it using @{str}.
March 23 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
In html, attribute names are always prefixed with attr, but when calling them using roll20 functions (like @{}, you drop the attr_ part

Your code should look like this:
<select name="attr_RollAttribute" > 
	<option value="0" selected></option> 
	<option value="@{str}" >Strength</option> 
	<option value="@{agi}" >Agility</option> 
	<option value="@{int}" >Intellect</option> 
	<option value="@{wit}" >Wits</option> 
</select>
(assuming the Wits attribute is created with attr_wit)
March 23 (7 years ago)

Edited March 23 (7 years ago)
I got the attribute field working and it rolls in roll20 perfectly. However the skills and modifiers fields don't seem to work no matter how I tweak them.

Here's my current dropdown setup:

And a snippet of the alchemy skill



I'm guessing the issue is that something such as attr_str has a unique value as an attribute but my skills don't? I'm a bit vexed.

March 23 (7 years ago)

Edited March 23 (7 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator
Your Socializing attribute have an extra bracket.

And you might want to change the alchemy skill type to number:
<input type="number" name="attr_alch" value="3">
Ah thanks. I missed that.

If I just roll strength, it rolls it perfectly fine.

However, if I roll it with Strength + Alchemy roll20 gives me a text notification that says:
No attribute was found for @{Test Sheet|alch}
March 23 (7 years ago)

Edited March 23 (7 years ago)
Andreas J.
Forum Champion
Sheet Author
Translator
And place "attr_" in front of the name, all attributes need that prefix

For each tag, you must include a <code>name</code> attribute which begins with "attr_" and defines the unique attribute name for this field.
That fixes it perfectly Andrea. Thanks :D
March 23 (7 years ago)
GiGs
Pro
Sheet Author
API Scripter
Your roll modifiers don't need the @{}. You only need that to get the value of an attribute.
<select name="attr_RollModifiers" > 
	<option value="3" >+3</option> 
	<option value="2" >+2</option> 
	<option value="1" >+1</option> 
	<option value="0" selected>0</option> 
	<option value="-1" >-1</option> 
	<option value="-2" >-2</option> 
	<option value="-3" >-3</option> 


</select>
Note the positive values dont have "+". Since when the button calls them it would lead to having two +'s: @{RollAtrribute}+@{RollSkill}+@(RollModifiers) would lead to something like 3+0++2 if the modifier was stored as +2. Negative numbers are perfectly fine since 3 + -2 is a valid arithemtic operation, but 3 + +2 probably would throw an error.

By the way, there's really no good reason to use short names like "alch" and "phy". You can create attributes using the full name, which is generally better for people using your sheet since it's easier to guess what the attribute is called when they want to make their own macro.