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 .
×

Help with simple roll button

Hi everyone, im starting to use Apis/macros on my game, and im developing one for a player in my table.. So far this is what i got: !power {{  --name|Eldtrich Blast  --leftsub|Ranged Spell Attack  --rightsub|60 ft Range  --Attack:|[[ [$Atk] 1d20 + @{spell_attack_bonus} ]]  --button type='roll'  }} im stuck as you can figure, on the button type for him to roll the damage. I dont want the damage to roll unless i say it hits, and i also dont want the players to see the AC. On the character sheet for the 5e ogl, once you use from the SHeet, it rolls the attack, but you have to click on the chat (eldtirch blast) for the damage, i want to do the same thing but "prettier". Thanks for the help!
1594770562

Edited 1594837416
timmaugh
Roll20 Production Team
API Scripter
I'm sure the big guns will be along with better suggestions, but the solution depends a little on how much you want to automatically interact with the character sheet. For instance, you could build a secondary "apply" side to your script and construct the call to it based on your roll outcome. The code that constructs the second call could investigate various to-hit and defensive (armor) values from the target sheet, and incorporate them in the call. Then output that call as a whispered API button to the GM (you). You'd push it to say the attack "hit". Depending how deep you wanted to go, it could prompt you with the data it interrogated from the sheet, letting you overwrite any as necessary. Let's say your script listened for an invocation of "gmapply" and it produced a roll from which you scrape whatever you need (let's say that's the number 16 and a critical). It targeted Lt. Jiggy Jar Jar Doo,. The API call might look like: !gmapply --Lt. Jiggy Jar Jar Doo --damage#16|1 ...and the text of the button could report the to hit roll against the Lt.'s defensive to-hit, to let you judge. When you push the button, the script goes to Lt. 3J Doo's sheet to find the applicable defenses and subtracts them appropriately from the attack. I'm working on a script right now that does a lot of this sort of api button feedback, so if you go this direction, I'll try to help as much as I can... But, like I said, there will probably come along better suggestions, too. =)
Thanks for your response, this is what i did so far: !power {{  --name|Eldtrich Blast  --leftsub|Ranged Spell Attack  --rightsub|120 ft Range  --Attack:|[[ [$Atk] 1d20 + @{spell_attack_bonus} ]]  --Damage:|[[ [$Dmg] 1d10 + @{charisma_mod} ]]  --soundfx|_audio,play,nomenu|eldritch blast  --vfx_opt|@{selected|token_id} @{target|token_id} beam-magic  --[Take This!](!
#Damage  )   }} and separateldy i created a Macro called Damage, like this: !alter --target|@{target|token_id} --bar|3 --amount|-?{Damage Dealt|0}  ******************* I use bar 3 as HP.  it worked fine, but i do have to manually input the damage the eldritch blast dealt,  now, im trying to use it together with Token Mod to change the mod to dead if the hp of the enemies gets to 0 or under
1594784518

Edited 1594784581
timmaugh
Roll20 Production Team
API Scripter
Are you handling the coding of this, or just using prebuilt scripts like TokenMod? There's a lot that the API can do if you've got your hands in the source code. If you're looking for a macro solution, that will be harder -- for me, anyway. Maybe someone else will have a better idea. But if you're programming the code behind the initial attack, it should be straight forward enough to keep the results around until you can output the button with the pre-populated data for the "apply".
im using the prebuilt apis, tokenmod, and what not
1595112458

Edited 1595112576
David M.
Pro
API Scripter
By waiting to roll damage until you say so, is it because you want to retain the ability to "fudge" the AC of the target, or do you just not want to clutter up the chat with extraneous damage rolls? With PowerCards, the typical way to output damage only on a hit would be to use the built-in conditional syntax. So something like: !power {{ --name|Eldtrich Blast --leftsub|Ranged Spell Attack --rightsub|120 ft Range --Attack:|[[ [$Atk] 1d20 + @{selected|spell_attack_bonus} ]] --?? $Atk.total >= @{target|AC} ?? Damage:| [[ 1d10 + @{selected|charisma_mod} ]] --?? $Atk.base == 20 ?? Crit Damage:| [[ 1d10[CRIT] ]] }} I used @{selected} above but you get the idea. Since the target AC is inside the conditional expression, the player will never see the exact AC number.  Three output examples against a target of AC=12. The first hits so then displays damage. The second misses so no damage displayed. The third crits and rolls an extra 1d10 crit damage. You could also roll up the hit and critical damage into a single line if you want to save chat space or just want it to do the overall math for you. Mouseover will still give you the breakdown. See below. If the attack hits but the base die roll was not a 20, the first Damage line displays. If the base roll was equal to 20, then the second damage line is instead displayed, returning a total (hit + crit) damage value. !power {{ --name|Eldtrich Blast --leftsub|Ranged Spell Attack --rightsub|120 ft Range --Attack:|[[ [$Atk] 10d20kh1 + @{selected|spell_attack_bonus} ]] --?? $Atk.total >= @{target|AC} AND $Atk.base <> 20 ?? Damage:| [[ 1d10 + @{selected|charisma_mod} ]] --?? $Atk.base == 20 ?? Damage:| [[ 1d10 + @{selected|charisma_mod} + 1d10[CRIT] ]] }} Now, if your goal is to maintain "fudge-ability" on the target AC, then I think you are already on the right track with the api button. 
@david, thanks for your help, mine is looking pretty similiar!