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

passing along difficulty

We're playtesting a new system, with dice that vary based on levels and skills. For a character, I have a token action for each of their classes that determines for the player which dice to roll, based on skills from the drop-down menu. I'm using in-line rolls, and have the html equivilent thing figured out. The player is also prompted for a difficulty before resolving the action, so that the margin is the output in chat. Everything works perfectly for one player's input. What I want to know is: as GM, can I establish the difficulty as needed beforehand, so that the player doesn't know it before they decide to act? I believe a macro loses variables upon completion. I'm not sure if a macro can query me and then the player. I can create a dummy character and reference an attribute that I change based on difficulty so that their ability can reference that, but it requires I have the sheet open for every player action, which is a pain. I have Pro, but wouldn't know where to begin in making an api that does this. Thanks.
1628286252
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You can use the ChatSetAttr API script to create a macro that sets a value to a specific sheet and attribute. If you keep that macro on a button, you can change it with a click before asking for any roll. I have noticed issues with the script referencing a name lately, so you may need to know the sheet's character ID. To find the charid, select a token representing the character (lets call it Utility, and the attribute, Unimod) and run: @{selected|character_id} this will return the id. Copy it (including the dash at the beginning), and use a macro like: !setattr --charid -1234567890123456789 --Unimod|?{Modifier|0} replacing the charid with the one you copied. By making the default zero, you can re-set it just by hitting the macro button and pressing return. The skill rolls will need to have the modifier built into the roll like: [[1d20 + @{Utility|Unimod}]] I haven't tested this, so it might need some fine tuning to deal with negative values, but it should get you started.
It works perfectly. Thanks!