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

Macros and Variables

Simple question: can you pass a variable to a macro?  Example: Could I create a Savage Worlds macro where I type: #sw <num> and it does: /r {1d<num>! , 1d6!}k1 So you could do #sw 6 and do 1d6/1d6, or #sw 12 and do 1d12/1d6, or 1d12+2 and do 1d12+2/1d6. Seems simple, but can't find a method anywhere in help, but I could be missing it.
You could do [[{1d?{how many sides},1d6}k1]]
1463606356
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
yep, it isn't so much passing a variable to the macro as saying that there is an undefined part of the macro that it asks for when the macro is called
David S. said: Could I create a Savage Worlds macro where I type: #sw <num> and it does: /r {1d<num>! , 1d6!}k1 Unfortunately, it's not possible to do this without the assistance of an API Script . (Access to the API is available in games in which the Creator has an active Pro subscription.) The closest you could get (without an API Script) would be providing #SW with the value "/r { 1d6!," and then entering something like "#SW d12!+2}k1" into the text chat. In my opinion,  Okieone offers a better solution using a Roll Query . I might suggest going a step further and also using a Drop-Down Roll Query , e.g. /r {?{Die|d4|d6|d8|d12}! + ?{Mod|0}, d6!}k1
Using two macros might work. First half in the first macro and second half in the second. #sw #12