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

macro help

How would I write a macro to roll a dice and add a variable depending on an attribute. For example I'd like to have an attack macro that rolls a d20 and adds  (-3) if the attribute is 3, (-2) if the attribute is 4-5, (-1) if the attribute is 6-8, (0) if the attribute is 9-12, (+1) if the attribute is 13-15, (+2) if the attribute is 16-17 and (+3) if the attribute is 18? Thank you for helping out a noob!
Nope, that's not possible right now. Might be soon with rollable tables though... but those are dev only in beta testing at the moment.
Ok. So I redid the character sheet to have the attribute bonus not the attribute. I added an ability "weapon damage" and I typed "/roll 1d8 + STR BONUS" (this was one of the drop down choices from the list of attributes). Then I checked the "show in macro bar?" box. When I click the macro button thus created the dice rolls across the screen but nothing appears in the chat log nor do I get the "beep" sound I associate with the chat. Also the dice doesn't ever go away so if I hit it over and over I get alot of dice on the screen I can't seem to get rid of. What am I doing wrong?
Wow the dice are stuck on every page of my campaign.
Hrm, the dice must not be "settling" into a final state. Can you go to&nbsp; <a href="http://supportdetails.com/" rel="nofollow">http://supportdetails.com/</a> &nbsp;and post the info from that page?
Here you go: Operating System Apple Mac OS X 10.6.8 Intel Screen Resolution 1440 x 900 Web Browser Chrome 25.0.1364.99 Browser Size 1390 x 683 IP Address Um I don't want to post this, hope thats ok.... Color Depth 24 Javascript Yes Flash Version 11.6.602 Cookies Yes User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.99 Safari/537.22 Support Details is brought to you with love by the fine folks at Imulus. Learn more about us at imulus.com or follow us on Twitter at twitter.com/imulus.
Thanks :) Can you restart your browser launch your campaign Open the chrome console:&nbsp; <a href="https://developers.google.com/chrome-developer-tools/docs/console#opening_the_console" rel="nofollow">https://developers.google.com/chrome-developer-tools/docs/console#opening_the_console</a> Click one of the macros that is causing problems If the dice get stuck again can you then copy the contents of your console and paste them here? -Eric
The dice did get stuck again. Here is the copy/paste you requested: 70 app.js:9 TOUCH SUPPORTED: false app.js:9 Switch mode to select app.js:1 Initializing new dice engine with ranomness... app.js:16 window resize app.js:17 tuts loaded tutorial_tips.js:7 2 window resize app.js:17 Final page load. app.js:14 Scan for new plays! app.js:14 Auth'ed. app.js:13 Object app.js:13 3 Scan for new plays! app.js:14 initial setup app.js:13 Object app.js:10 Creating text node app.js:10 CSSStyleSheet app.js:10 Object app.js:10 Creating text node app.js:10 CSSStyleSheet app.js:10 Object app.js:10 Creating text node app.js:10 CSSStyleSheet app.js:10 Object app.js:10 Creating text node app.js:10 CSSStyleSheet app.js:10 Object app.js:10 Creating text node app.js:10 CSSStyleSheet app.js:10 Object app.js:10 Creating text node app.js:10 CSSStyleSheet app.js:10 Object app.js:10 Creating text node app.js:10 CSSStyleSheet app.js:10 joining game... app.js:13 Player -IljZtuCW7CRGO4we8wZ is offline... app.js:12 THREE.WebGLRenderer 49 app.js:23 Player -Ilk2JQqhul1Z5Q0an7W is offline... app.js:12 Player -IlkAPKvGryoGfQxOGFs is offline... app.js:12 Player -ImSzdG_phqWjzT48p_D is offline... app.js:12 Player -ImT4wuxtSC2HHIEljmT is offline... app.js:12 Player -InQbUnvt86aO0uMCm8w is offline... app.js:12 Player -Ina-AzRuXk41tikllCU is offline... app.js:12 Firebase Online app.js:9 65 attr view! app.js:12 2 Uncaught TypeError: Cannot read property 'deck' of undefined app.js:13 Swapping <a href="https://s3.amazonaws.com/files.d20.io/images/577164/CySjul8zBVeW-2zy3wVEcQ/med.jpg?13594904725" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/577164/CySjul8zBVeW-2zy3wVEcQ/med.jpg?13594904725</a> to <a href="https://s3.amazonaws.com/files.d20.io/images/577164/CySjul8zBVeW-2zy3wVEcQ/max.jpg?13594904725" rel="nofollow">https://s3.amazonaws.com/files.d20.io/images/577164/CySjul8zBVeW-2zy3wVEcQ/max.jpg?13594904725</a> app.js:11 refershing page listings! app.js:14 setting src app.js:11 init active page! app.js:13 activate page! app.js:11 Reorder by Z app.js:11 refershing page listings! app.js:14 initiatlizing video chat app.js:16 Array[2] app.js:17 %{Gundren|Bastard-Sword} app.js:16 Finished after going 1 levels deep. app.js:16 E parseRollString: 1d8 ++2 app.js:16 Array[2] app.js:16 ValidatedRollExpression app.js:16 {"type":"V","rolls":[{"type":"R","dice":1,"sides":8,"mods":{}},{"type":"M","expr":"++2"}],"resultType":"sum"} app.js:16 L parseRollString: 2 expressions from: 1d8 ++2 app.js:16 1d8 - E doRolls app.js:16 Roll d8 app.js:29 1d8 - L doRolls app.js:16 executing group roll! app.js:29 creating scene! app.js:29 renderer already added app.js:29 done with mesh! app.js:30 heard external roll! app.js:29 Already rendering, can't show dice roll! app.js:29 shape is ready app.js:30 dice is now at rest. app.js:29 1d8 - E individualRollCallback(0) 5 app.js:16 1d8 - E diceRollCompleteCallback app.js:16 1d8 - L diceRollCompleteCallback app.js:16 2 E postProcessCompleteRolls app.js:16 (5)++2 app.js:16 Uncaught SyntaxError: Unexpected number (program):1 Array[2] app.js:17 %{Gundren|Bastard-Sword} app.js:16 Finished after going 1 levels deep. app.js:16 E parseRollString: 1d8 ++2 app.js:16 Array[2] app.js:16 ValidatedRollExpression app.js:16 {"type":"V","rolls":[{"type":"R","dice":1,"sides":8,"mods":{}},{"type":"M","expr":"++2"}],"resultType":"sum"} app.js:16 L parseRollString: 2 expressions from: 1d8 ++2 app.js:16 1d8 - E doRolls app.js:16 Roll d8 app.js:29 1d8 - L doRolls app.js:16 executing group roll! app.js:29 done with mesh! app.js:30 heard external roll! app.js:29 Already rendering, can't show dice roll! app.js:29 shape is ready app.js:30 dice is now at rest. app.js:29 1d8 - E individualRollCallback(0) 5 app.js:16 Uncaught All 1 tasks have already been completed for: rollCompleteCallback app.js:16 Array[2] app.js:17 %{Gundren|Bastard-Sword} app.js:16 Finished after going 1 levels deep. app.js:16 E parseRollString: 1d8 ++2 app.js:16 Array[2] app.js:16 ValidatedRollExpression app.js:16 {"type":"V","rolls":[{"type":"R","dice":1,"sides":8,"mods":{}},{"type":"M","expr":"++2"}],"resultType":"sum"} app.js:16 L parseRollString: 2 expressions from: 1d8 ++2 app.js:16 1d8 - E doRolls app.js:16 Roll d8 app.js:29 1d8 - L doRolls app.js:16 executing group roll! app.js:29 done with mesh! app.js:30 heard external roll! app.js:29 Already rendering, can't show dice roll! app.js:29 shape is ready app.js:30 dice is now at rest. app.js:29 1d8 - E individualRollCallback(0) 5 app.js:16 Uncaught All 1 tasks have already been completed for: rollCompleteCallback app.js:16 2 window resize app.js:17 [ "-Im2OsOcVbvdBZ-QWSDK", "-Im68ADtAnc18DOzPsiU"] app.js:17 %{Gundren|Bastard-Sword} app.js:16 Finished after going 1 levels deep. app.js:16 E parseRollString: 1d8 ++2 app.js:16 [ RollExpression,&nbsp;MathExpression] app.js:16 ValidatedRollExpression&nbsp;{ type:&nbsp;"V",&nbsp;rolls:&nbsp;Array[2],&nbsp;resultType:&nbsp;"sum"} app.js:16 {"type":"V","rolls":[{"type":"R","dice":1,"sides":8,"mods":{}},{"type":"M","expr":"++2"}],"resultType":"sum"} app.js:16 L parseRollString: 2 expressions from: 1d8 ++2 app.js:16 1d8 - E doRolls app.js:16 Roll d8 app.js:29 1d8 - L doRolls app.js:16 executing group roll! app.js:29 done with mesh! app.js:30 heard external roll! app.js:29 Already rendering, can't show dice roll! app.js:29 shape is ready app.js:30 dice is now at rest. app.js:29 1d8 - E individualRollCallback(0) 5 app.js:16 Uncaught All 1 tasks have already been completed for: rollCompleteCallback app.js:16 [ "-Im2OsOcVbvdBZ-QWSDK", "-Im68ADtAnc18DOzPsiU"] app.js:17 %{Gundren|Bastard-Sword} app.js:16 Finished after going 1 levels deep. app.js:16 E parseRollString: 1d8 ++2 app.js:16 [ RollExpression,&nbsp;MathExpression] app.js:16 ValidatedRollExpression&nbsp;{ type:&nbsp;"V",&nbsp;rolls:&nbsp;Array[2],&nbsp;resultType:&nbsp;"sum"} app.js:16 {"type":"V","rolls":[{"type":"R","dice":1,"sides":8,"mods":{}},{"type":"M","expr":"++2"}],"resultType":"sum"} app.js:16 L parseRollString: 2 expressions from: 1d8 ++2 app.js:16 1d8 - E doRolls app.js:16 Roll d8 app.js:29 1d8 - L doRolls app.js:16 executing group roll! app.js:29 done with mesh! app.js:30 heard external roll! app.js:29 Already rendering, can't show dice roll! app.js:29 shape is ready app.js:30 dice is now at rest. app.js:29 1d8 - E individualRollCallback(0) 5 app.js:16 Uncaught All 1 tasks have already been completed for: rollCompleteCallback app.js:16
Thanks Lisa, I've passed this on to the devs and we'll see if we can figure out what is going on. In the interim if you turn of 3d dice it should solve the problem.
Just to clarify -- when you do the exact same rolls/macro with the 3D Dice off, it works? Because it seems from that log like the problem isn't with the 3D Dice but just with the roll stuff in general....
Ok I tried it again. Now when I run the macro with 3d dice enabled the dice disappears after a second but nothing appears in the chat log. When I run the macro with the 3d dice disabled, the macro produces the expected chat log. I will disable 3D dice to run my games in the intrim. Thanks for looking into this.
Figured out the problem "1d8 ++2" there is an extra + sign in there. I might be able to fix this up to handle better in the parser but for now you can just remove the extra + in your attributes and you should be fine.
Should I remove it from the macro text or from the attribute?
ok. when i took the + sign out of the attribute and left it in the macro, everything works as expected when i take the + sign out of the macro and leave it in the attribute, i recreate the problem i will now try it with negative attributes
ok i take that back.. everything works as long as i leave the plus out of either the macro text or the attribute. thank you so much!
Yup, the - is fine for negative attributes but in the JS&nbsp;interpreter&nbsp;++ has special meaning so it ends up throwing a weird error. So for positive attributes just leave the + off the value.
I'm new here (and new to&nbsp;posting&nbsp;in general - please excuse any breaks in&nbsp;etiquette). To both Eric D. &amp; Lisa -&nbsp; I wanted to say thank you. I've been having some trouble making my Attributes macros work correctly. The most frustrating part was that it would work sometimes, but not others. The ++ comment helped me realize that I had put +2 in the Abilities section, then was putting 2d6+@{STR} which then recreated the ++ coding. Things are working!! I never would have realized it without this post. Thank you!
Awesome, I'll see if there is something we can do server side to make this less of a problem.