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 .
×
May your rolls be chill this holiday season!
Create a free account

Disable button without prerequisite available

I'm looking to disable an ability or button when a prerequisite is not available on the character sheet. For example, a PC may be able to Parry a blow, but to do so the button should only work if the Parrying Stance had been previously declared (a check box) or the weapon is in the Off Hand. I'm thinking that the button may be available in a repeating weapons list for all weapons. However, when used and one of the above conditions is not met then the roll would state a friendly message. I think there will be desire to tie the condition "Parrying Stance" to the API somehow so that it clears after use until declared again. All said, I think this all possible in the Script API, but a) the forum search is mostly bust on examples and b) I'm not sure where to look in the Character Sheet repo for examples using the API. Any links to posts or examples in existing character sheets would be great
1424105192
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
An idea is to use a check box as a on\off switch. The check box defaults to a zero when off so you could use it as a boolian multiplier. It wouldn't need the API.
@Steve K. Thanks. That's what I'm doing now, checked or unchecked, adds 10 or 0 to the test, respectively. It's not the same as a function to enforce the rule: A character can attempt to parry a successful attack, either by using the parrying stance action or by taking advantage of a weapon in his secondary hand , but he must have a weapon ready and be aware of the attack. A Weapon Skill Test is made to parry the blow...Parrying requires no special skill or talent to attempt. It’s a half action to enter a parrying stance, but if you have a weapon in your secondary hand you can parry as a free action. I'm looking for something more. Still combing through the many other sheets and API directory.
1424110381

Edited 1424111274
Coal Powered Puppet
Pro
Sheet Author
I know no API, but- provided its a set of number- tie the selected attribute to a checkbox and have it multiplied by 0 or 1. Like...say the Parrying Stance is +10% to weapon skill, and Dodge is a prerequisite of Parry stance. Dodge could have a checkbox (value="1"), and the Parry stance could have a value of "(10%) x @{dodge}". This doesn't disable the button, of course, but it does return the a lowered result. I'm too tired to figure out the formula, but I'm pretty sure you can get the forumla to return a value of "0" you don't have the right boxes checked. Wait, isn't there a "read-only on check" option, somewhere? I'll see if I can find it. Edit: Maybe ? It requires java, which I think API is kin to.
1424111915
Stephen Koontz
Forum Champion
Marketplace Creator
Sheet Author
API Scripter
Compendium Curator
Timothy, if you're set on API managed rolls you should take your request to the API forum where I'm sure lots of helpful people will offer you code snippits and examples.