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

Querying Macros?

Is it possible to query a macro? For example: Damage=#?{Damage Macro Name?|Dagger} Where "Dagger" is the name of a macro I have already created for the campaign, which rolls damage for that weapon. Another would be "Sword-Short", for example. I'm wanting to make this a part of a universal attack/damage macro where the player would input the weapon name, and this part of the macro would roll the damage, calling a separate macro I've made. Hopefully this explanation isn't too confusing. :)
1426267871

Edited 1426268220
You can call Macros and Abilities by prefacing them with the pound symbal # ie: "longsword" macro: [[1d20cs19+3]] vs AC [[1d8+3]] Dmg If Crit, + addt'l[[1d8+3]] Dmg "Attack" macro: /me swings at something #longsword However, what you cannot do is use a Roll Query to ask for the name of a macro to call. The order of operations would have it only return the raw text and not call the macro. The closest you might be able to come to that is using boolean flags as something of a 'selection' when rolling. ie: /me swings at something Hit: [[1d20 + (?{LongSword? 1=yes 0=no|0} * (+3) ) + (?{ShortSword? 1=yes 0=no|0} * (+3) ) ]] Dmg: [[ (?{LongSword? 1=yes 0=no|0} * (1d8+3) ) + (?{ShortSword? 1=yes 0=no|0} * (1d8+3) ) ]] This can get annoying over time though as you'd be prompted twice to enter a 1 or 0 every time you hit the macro
Hm, that's what I was afraid of. Thanks!
Aaaand, it looks like you also can't call macros from within the default roll template. Correct?
1426271259

Edited 1426275178
Haven't tried, but I'd guess not since there's helper functions that have to be defined in the template. The DefaultTemplate is special in that it just accepts whatever you feed it for propertynames and values and outputs it.
1426274650
Lithl
Pro
Sheet Author
API Scripter
Yes, you can use macros with the default template. I just tried the following: &{template:default} {{name=test}} {{foo=#Attack }} Where the "Attack" macro was simply [[d20+5]] . Note that the space following the macro name is required (otherwise you just get the text "#Attack" in the template output). You cannot, however, use macros which contain multiple lines. If you try to do so, all properties before the macro (and the first line of the macro) except for "name" will fail to show up, then the second (or more) lines of the macro will render after the template body, followed by the text of any properties that you tried to use after the macro. Interestingly, you can use macros to fill out the template call. If you have a macro named "Foo" containing the text {{foo=bar}} and you call: &{template:default} {{name=test}} #Foo You will get a row in the template output with " foo bar"