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

new user GM; confused about writing Macros

I have a free account (so no API scripting for me), and I have bought the Marketplace module for Curse of Strahd (with the hardcover also sitting on my desk next to my computer) to run on Roll20 for my online group. I am entirely satisfied with the module, and learning how to utilize the various features of Roll20 to improve my ability to run a game online as fluidly as I could in person. I have prepared the PCs' character sheets using the "5th Edition OGL by Roll20" form, and it's wonderful for me how the automated mechanisms facilitate dice-rolling. Particularly the feature to always roll 2d20 in case of Advantage/Disadvantage. I am attempting to figure out how to write macros, and hitting a brick wall. The basic structure, of putting a complex dicebot command into a pushbutton is easy enough. But I can't figure out how to get a macro to do what I really want. Half of us have never played this edition of D&D before, and as a service to my players I want to prepare a set of six Macros to roll 2D20 and add the selected token's bonus relevent to a specific saving throw. Just like clicking on the saving throw's name on the character sheet; but without having to open the sheet and scroll to it first. My intention is that I can prep these six Macros for my game, then add them to the token action bars of all tokens in play when a monster's ability would call for that save. And then unclick the checkboxes which show those buttons when that monster is no longer a threat. Streamlining the interface at the players' end. Now, getting a roll of 1d20 + selected character's relevant save bonus should not be difficult. But as for setting it up to roll 2d20 just like the automated functions of the character sheet, I'm utterly at a loss. I suppose that I could use the function for assigning a specific character's ability to their token action bar, but I've no clue how one would do that either. And I'm pretty sure that I'd have to manually reset it for every PC in turn, rather than having a global application option on hand... Could somebody who, unlike me, knows what they're doing help me out here?
1498803310

Edited 1498808435
Loki
Sheet Author
Hi, OGIHR. The basis for your desired macro would build something like the following (but let me say that I've no idea about saving throws in D&D since I haven't played it for 10 years or so and did never play it in english - so my saving throw-names are completely random): /roll 2d20 + ?{Saving Throw|Willpower, @{selected|willpower} | Dodge, @{selected|dodge}} So, what does this small macro do? With a token currently selected it will roll 2d20 and lets the player who uses the macro decide whether he wants to add his willpower- or his dodge-value to the 2d20, based on the value "willpower" or "dodge" in the character sheet (if there were a value valled "money" in the character sheet you could also write something like "/me has @{selected|money} coins in his pocket" - it works with every attribute found in the character sheet). How do you get the names of the attributes in the character sheet? Well, in most cases they should be rather obvious (such as an attribute willpower will most likely have the name willpower), but to be sure, you can call any roll in the given character sheet that includes the given attribute (e.g. you want to know what is the name of willpower, you could just use the character sheet roll for willpower), than click in the textfield in the bottom-right corner of your campaign and hit the "arrow up" button. This will display the command you (the character sheet) did just roll and you can just read up the attribute's name. For toggling you have the macro menu with its option "In Bar" that you can activate for the given macros when the monster appears and deactivate it when its no longer a threat. I hope this helps a little bit, don't hesitate to ask further questions. Greetings!
1498804335

Edited 1498804591
Finding the variable-names to invoke isn't that difficult, for the sheet in question is pretty thoroughly documented on the Roll20 wiki. It's more the "grammar of punctuation marks" required by this particular programming language which left me baffled.  But, assuming that I understand you correctly, using the "up-arrow" button within the chat-entry field causes the system to instantly reproduce the code-string which had just been performed, despite that code-string having been triggered "behind the scenes" by the automated function within the character sheet.  If I am indeed understanding correctly, that should greatly facilitate my efforts to learn the "grammar of punctuation marks" required for writing Macros in Roll20. Thank you! EDIT: ...And I just realized that the query format of your example can be used to construct multi-function macros, such as "attack; with which weapon?" or "attack; regular or called shot?". Or, in this case, "roll a saving throw; which type?". As someone who used to teach computer programming years ago, I am very impressed. 
1498808248

Edited 1498808487
Loki
Sheet Author
Hi again. Yes, you understood correctly and I'm glad to help. :) Yes, it's possible to create (really long and complicated) macros with nested queries (for further information: <a href="https://wiki.roll20.net/Macros#Advanced_Usage_for_" rel="nofollow">https://wiki.roll20.net/Macros#Advanced_Usage_for_</a>... ). Long story short (as you are no beginner in programming): You have to replace specific characters with their HTML equivalents as you nest your queries deeper, because some characters are interpreted as "stopper" that would cause the macro interpreter to end the parsing if they are not replaced/masked. Greetings!
I am pleased to report that when I got up this afternoon (I work the overnight shift), I was able to use the trick Loki showed me to compare the "roll template" on the wiki page for the sheet to the actual-code enacted by hitting the button, allowing me to parse out my desired Macros one term at a time, to yield exactly the results which I had intended. Hooray.&nbsp; Next, I have a question about Token Actions. From what I've been able to gather, and I know that I could be wrong, it seems that the Macro Quick Bar at the bottom of the tabletop screen is universal regardless of which token is currently selected, while the Token Actions Bar at the top of the screen is intended to provide for macros specific to a given Token. I base my understanding on the following paragraph from the Roll20 wiki's page on Token Actions: "This means, for example, if you designate that 3 abilities for the Character "Mr. Bearington" are token actions (1.), those actions will only show up for tokens that are linked to (2.) "Mr. Bearington", not for all tokens." But I don't see where I would make that designation. I am pretty sure that it would be part of the "Attributes and Abilities" tab of my game's character sheets (to be specific to a given character), but my wiki reading has proven unable to find any clue of how to actually put them in.&nbsp; Of course, I can't access the system proper while on my phone here at work, and maybe the answer will become self-explanatory when I get home in the morning to open that tab on any given character sheet, but I would certainly appreciate any assistance which you might offer.&nbsp;
Both Macros and Abilities can be turned into Token Actions; the&nbsp; Token Actions Wiki page should prove helpful. OGIHR said: I am pleased to report that when I got up this afternoon (I work the overnight shift), I was able to use the trick Loki showed me to compare the "roll template" on the wiki page for the sheet to the actual-code enacted by hitting the button, allowing me to parse out my desired Macros one term at a time, to yield exactly the results which I had intended. Hooray. You should be proud; it sounds like you've made a lot of progress to becoming a macro master! :)
Thank you for the praise, but this was just reconstructing the grammar-of-punctuation for an existing bit of code (although I never did figure out what "wtype" did, but it appears to not disrupt anything if I leave it out). I was actually more proud of myself for reading through the Dice Reference page on the wiki and figuring out a simple little dicebot for a friend in my Shadowrun group who frequently gets frustrated by sorting out the actual dice she was rolling. So I wrote a simple little macro to query a number of D6 to roll, then count the 5s and 6s as successes, show those in green (critical successess), and sort all results descending so the successes are at one end and the 1s at the other. Nothing worth writing home about, but that was an actual labor of program-design, while yesterday's work was (in my book) just a matter of analysis.&nbsp; Anyway... I have read through the entire page of Token Actions several times, as well as Macros and Journal / Attributes and Abilities. I just haven't seen the part where an Ability actually gets turned into a Token Action.&nbsp; Previously, I've worked on Macros while in the&nbsp;Collections tab of the chat sidebar, and I am hoping that all I need to do is go to a specific character sheet, click an automated button therein for a specific action-roll, up-arrow the chat entry field, copy-paste to Notepad, and re-parse the text to translate it directly into a new entry on the Attributes And Abilities tab of the character's Journal.&nbsp; But until I actually attempt it, I have no idea how different the grammar-of-punctuation is between those two functions. Time shall tell.&nbsp;
1498881293

Edited 1498881342
OGIHR said: I have read through the entire page of Token Actions several times, as well as Macros and Journal / Attributes and Abilities. I just haven't seen the part where an Ability actually gets turned into a Token Action. Here's the pertinent section (from the Token Actions Wiki page): You'll find a new checkbox when editing Macros to designate it as a token action(4.), and you'll find a similar checkbox when editing an ability, below where you enter the name of the ability. Just check the respective box and save the macro/ability, and the next time you select a token you'll see it as an action. Both checkboxes are accompanied by the text "Show as Token Action" (can be seen here for Abilities).
Yes! That's exactly what I had previously overlooked. Thank you, so much.&nbsp;
Happy rolling!