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

[Question] How can I add a modifier via API that executes a character ability?

I have a character Giant with the ability Attack-Melee with the following/w gm @{Name} Attack-Melee: [[floor(@{Str}/2-5)+@{Att-Melee-Base}+1d20]] I have an API call sendChat("API","/w gm %{Giant|Attack-Melee}"); When the API call executes everything works as desired. But now within the API call I want to add a modifier. Something like sendChat("API","/w gm %{Giant|Attack-Melee}" + modifier); The value of modifier is not added to the roll. Is there a way to do this? Thanks
1381637469
Lithl
Pro
Sheet Author
API Scripter
var modifier = ...; // Presumably, this will come from the msg.content of the API call var giant = findObjs({ _type: 'character', name: 'Giant' })[0]; var giant_str = fidnObjs({ _type: 'attribute', name: 'Str', _characterid: giant.id })[0]; var giant_amb = findObjs({ _type: 'attribute', name: 'Att-Melee-Base', _characterid: giant.id })[0]; sendChat('API', '/w gm ' + giant.get('name') + ' Attack-Melee: [[floor(' + giant_str.get('current') + '/2-5)+' + giant_amb.get('current') + '+1d20+' + modifier + ']]');
So basically I would have to build the entire formula in the API. There's no way to use the existing Char Sheet macro? Thanks.
1381658201
Lithl
Pro
Sheet Author
API Scripter
You could also modify the ability to simply use roll queries, but I assumed you wanted an API solution. /w gm @{Name} Attack-Melee: [[floor(@{Str}/2-5)+@{Att-Melee-Base}+1d20+?{Modifier|0}]] Every time you execute the ability, you'll be asked for the modifier in a popup window. The popup will have a default value of 0 filled in.