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

Help improving this macro?

I managed to write a macro that will let me select a token, hit the macro button, get cued to pick another macro from the drop-down, and roll it in secret. This was made for Pathfinder 2e, and I'll call this macro "Secret" going forward. /w gm ?{Which macro?|Perception,#PERCEPTION |Acrobatics,#ACROBATICS |Arcana,#ARCANA |Athletics,#ATHLETICS |Crafting,#CRAFTING |Deception,#DECEPTION |Diplomacy,#DIPLOMACY |Intimidation,#INTIMIDATION |Medicine,#MEDICINE |Nature,#NATURE |Occultism,#OCCULTISM |Performance,#PERFORMANCE |Religion,#RELIGION |Society,#SOCIETY |Stealth,#STEALTH |Survival,#SURVIVAL |Thievery,#THIEVERY } While the macros that "Secret" calls all look like some variation of this. @{selected|token_name} looks and listens for [[1d20+(@{selected|Perception})]] on perception! While it does work I wanted to incorporate a way for it to also ask me for a bonus/penalty. + ?{Misc. Attack Bonus/Penalty?|0} But if I try and throw that into any of the macros that "Secret" calls, it gets confused (if I'm reading the wiki right, roll20 isn't smart enough to separate too many of these { or } ???). While I could just bite the bullet and throw all of those macros into my shortcut bar, I would like to avoid cluttering my interface if at all possible. Is there a way to make one macro that asks me for an attribute/macro and then ask me for a bonus to add or subtract?
1663773565
timmaugh
Pro
API Scripter
You're right to suspect the nested brackets. The query parser is looking for any of the control characters for a query (vertical pipe, comma, right bracket), to move it along in its parsing. It isn't smart enough to detect that *this* bracket is a part of *that* template structure, and so shouldn't impact the query parsing. That's where other solutions (like HTML replacements, Chat menus, or Mod Scripts) come in. To start, all of the queries you want to answer have to be in the top level of the macro. This is because those are only detected at the start, not after each macro has been expanded into your command line. Output Buttons You can output the macro you want to run as a button. It works because pressing the button launches a *new* message, where the Roll20 interface has a chance to detect the queries and present them to you. So you could do something like this: /w gm ?{Which macro?|Perception,[Perception](!
#PERCEPTION )|Acrobatics,[Acrobatics] (!
#ACROBATICS ) } (I'll leave it to you to add in the others, if this is what you want to do.) That hides the # character in an HTML code so that the macro-call isn't detected (and the macro isn't expanded). The above command gives you the initial choice, then outputs a button for the chosen macro in the chat window. Clicking that button will execute the macro you originally chose. Chat Menu This isn't too far from a chat menu... where instead of outputting the single button from a query, you output the menu of buttons and choose the one you want to run. The wiki has good information on this option. Mod Script I see you have the Plus tag beside your profile, but if scripts are available in your game, scripts can help. Fetch can retrieve a macro's verbiage "late" (ie, after queries have run), so it won't break the parser.
Yes! Thank you! I had some trouble with the HTML initially but the section you pointed me to in the wiki for chat menus pointed out how useful it is to make a blank character for the sole purpose of holding macros. And now I've got the macro I've always wanted! Thank you very much!
1663783550
timmaugh
Pro
API Scripter
Excellent! Glad you got it working!