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

Input to Variable In Macro?

1585516771

Edited 1585516882
Hello! Looked around for an answer to what feels like it should be a simple question, but I can't figure it out. >.> I want to use an input prompt to get a value, then output a bunch of calculations based on that value in the chat window, like so: Input Value: CR ( 4 ) On the Fly Challenge Numbers Quick Skill DC (10 + 1/2 CR) = 12 Attack Bonus (2 + 1/3 CR) = +3 Damage (1d10 * CR) = 4d10 Hit Points (20 * CR) = 80 ____ So far I've gotten as far as &{template:npcaction} {{rname=On the Fly Challenge}} {{description=The CR is ?{CR|0}}} And I have no idea how store or call "CR" or even if it's possible. Can someone point me to the manual entry for this? XD Thanks!
1585518373
The Aaron
Roll20 Production Team
API Scripter
Sure!  You're halfway there. With a Roll Query, anywhere the label is used in subsequent Roll Queries, it just gets replaced where the value. Note that you only need to add arguments on the first Roll Query: Quick Skill DC: [[10 + (?{CR|4}*.5)]] Attack Bonus: [[2 + floor(?{CR}/3)]] Damage: [[ ?{CR}d10]] Hit Points: [[20*?{CR}]]
The Aaron said: Sure!  You're halfway there. With a Roll Query, anywhere the label is used in subsequent Roll Queries, it just gets replaced where the value. Note that you only need to add arguments on the first Roll Query: Quick Skill DC: [[10 + (?{CR|4}*.5)]] Attack Bonus: [[2 + floor(?{CR}/3)]] Damage: [[ ?{CR}d10]] Hit Points: [[20*?{CR}]] Very cool, thanks! :D