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

API/Macro Help Requested for Lay on Hands (Using ChatSetAttr & Power Cards API)

Hello all,     Let me start off by saying I had to take Beginner & Intermediate C++ in college, and barely passed both. When it comes to coding, I'm pretty dumb. I've been scouring forums, reddit posts, etc; for a good macro to pair well with the Paladin's Lay on Hands ability. Here is my WIP so far: !alter --target|@{target|token_id} --bar|1 --amount|?{How much do you want to heal?|1,1|2,2 |3,3 |4,4|5,5|6,6 |7,7 |8,8|9,9|10,10} &{template:default} {{name=Lay on Hands Pool}} !modattr --silent --charid @{target|character_id} --class_resource|-{{Pool Lost=[[|1,1|2,2 |3,3 |4,4|5,5|6,6 |7,7 |8,8|9,9|10,10]]}} --class_resource|{{Pool Lost=Lay on Hands Pool decreases by [[-1]]}}!!! {{description=Text}} The adding of health from the pool works a treat, I limited to 10 because I'm just starting to DM on here and my Paladin is only level 2, atm. Just got a Pro sub gifted from a player and I'm trying to get as much sorted before my next session as possible in regards to having attacks & abilities nicer with Power Cards.  I am not sure how, or if I can call the option that gets selected from the |?{How much do you want to heal?|1,1|2,2 |3,3 |4,4|5,5|6,6 |7,7 |8,8|9,9|10,10}  to be subtracted from the class_resource. Could someone with a brain please take a look at this and offer some sage advice? :c
Which character sheet are you using? Another player asked for help just yesterday for a D&amp;D 5E by Roll20 character sheet:&nbsp; <a href="https://app.roll20.net/forum/post/9640227/healling-hands-macro-and-api/?pageforid=9644627#post-9644627" rel="nofollow">https://app.roll20.net/forum/post/9640227/healling-hands-macro-and-api/?pageforid=9644627#post-9644627</a> The macro I shared only uses ChatSetAttr as I haven't used Powercards much. Whenever you use a query, if the inputs are the same as the outputs, you don't need to include the outputs. Spaces are also important (include them on all options or none of them). So: ?{How much do you want to heal?|1,1|2,2 |3,3 |4,4|5,5|6,6 |7,7 |8,8|9,9|10,10} Can just be: ?{How much do you want to heal?|1|2|3|4|5|6|7|8|9|10} If you don't include any inputs or outputs, or only a single input/output, then instead of a dropdown menu the query will generate a text input field. So you can simply use: ?{How much do you want to heal?} And you will get a box you can put any number into. Or if you make the query like this: ?{How much do you want to heal?|@{selected|class_resource}} You'll get an input box that is pre-filled with your remaining Lay on Hands points (but can be changed to whatever you want). If you reuse the same query, any subsequent queries will reuse the output -- you cannot use the same query with different outputs in a single macro . So you can reuse&nbsp; ?{How much do you want to heal?} &nbsp;and the same output will be generated each time. This macro should work. You'll have to select your token before running the macro, and you'll have to click on the token you want to heal (which can be yourself). &amp;{template:default} {{name=Lay on Hands Pool}} {{Pool Lost=Lay on Hands Pool decreases by ?{How much do you want to heal?|@{selected|class_resource}}} !modattr --silent --name @{target|Who is Healed|token_name} --hp|+?{How much do you want to heal?} !modattr --silent --name @{selected|token_name} --class_resource|-?{How much do you want to heal?}
Not sure what happened to my other reply, but I don't see it. In case it really didn't go through here's an abbreviated version. Your macro was infinitely better that what I tried to cobble together in 3 hours and you probably had it done in 5 minutes. Thank you so much for taking the time to reply to my post, it really is appreciated and apologies for having a redundant post clogging up the forums. You're the best and thanks for the lessons/ breakdown of my mistakes &amp; helping me learn the language of the macros/APIs better. Happy (almost) New Year &amp; Cheers!
I've found the best way to learn something is to try to teach it to someone else! I mentioned it in the other thread, but you can simplify (reduce a click) if the macro is always used with the same player by substituting 'selected' with the character/token name.&nbsp; Though if it's a macro on the character sheet being shown as a token action it won't matter either way.&nbsp;