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

Passing variables to macros from chat window?

I'm trying to streamline die rolls in my game, while still minimizing the number of macros that I need.  Let's attack this in two steps: 1. Is it possible to pass variables from the chat window to a macro directly?  ie, let's say I set up a macro: #attack /roll 1d20 + ?{modifier} I'd like to be able to type in "##attack 5" and have it resolve to "/roll 1d20 + 5" without seeing the extra prompt show up. 2. Can I include characters as variables in my macros?  If I set up a character sheet for each of my monsters, and give them all an Attribute called "AC" (for example, make a zombie character sheet with AC=11), can I have a macro make a roll against this zombie's AC to check for success? #attack /roll {1d20 + ?{modifier}} > @{?{enemy}|AC} That's how I think it should work, but it does not.  It won't resolve the ?{enemy} inside the @ statement properly. If I can get this to work properly, then I can use the same macro to have the enemies attack my players, as long as they have their AC recorded in their character sheets.  It would be a very neat and tidy solution. Thanks!
1378244316

Edited 1378244813
Gauss
Forum Champion
1. No, the variable can only be used via the query popup window. However, if you type "#attack +5" it will add the +5 to the end of the macro. If the end of the macro is "/roll 1d20" itll add +5 to the 1d20.  Note: if your macro is "/roll 1d20 +" and you type "#attack +5" you will create "/roll 1d20 ++5" which won't work ("++" and "--" results in a bug). 2. No, while you can set up an attribute as the default in a query you cannot input an attribute in the query window. To set up an attribute as the default you need to put in: ?{query name|@{character sheet name|attribute name}} But, you will not be able to change the attribute from one attribute to another inside the query window. Your example looks like an attribute with a query inside. In order to do an attribute with a query inside you need to put the following in the attribute on the character sheet (but I don't think this is what you wanted): ?{query name|default value} Sorry that the answer to both is a no. Perhaps the API can do these things, I would ask the API forum. - Gauss
Gauss, Thanks for the prompt reply.  It looks like all of this would be completely doable using the API interface.  Let me make a promise here: I'll run through one or two adventures using my free account, and if things are as awesome and easy to use as they look like they'll be, I'll get a subscription and start playing with the API (and the dynamic lighting!) :) -David