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 Seems to be breaking spontaneously?

1637451009

Edited 1637454226
So I'm working on a bit of a DnD Homebrew product and am making custom macros to help with the testing process. They were working perfectly a second ago, but without even touching it the macro now seems to suddenly be ignoring all the modifiers and defaulting to just the die roll... Any idea what could be doing this? The Macro:  /roll  [[ ?{Advantage/Disadvantage|Standard, 3d6|Advantage(5), 8d6kh3|Advantage(4), 7d6kh3|Advantage(3), 6d6kh3|Advantage(2), 5d6kh3|Advantage(1), 4d6kh3|Disadvantage(1), 4d6kl3|Disadvantage(2), 5d6kl3|Disadvantage(3), 6d6kl3|Disadvantage(4), 7d6kl3|Disadvantage(5), 8d6kl3} + ?{Ability Score|Strength,@{Selected|Strength}|Dexterity,@{Selected|Dexterity}|Constitution,@{Selected|Constitution}|Intelligence,@{Selected|Intelligence}|Wisdom,@{Selected|Wisdom}|Charisma,@{Selected|Charisma}} + ?{Proficiency Bonus|Unproficient,0|Proficient,@{Selected|Proficiency}|Expertise,@{Selected|Proficiency}*2|Jack Of All Trades,floor(@{Selected|Proficiency}/2)} +?{Bonus}]] Edit: Turns out the culprit was this little guy...  +?{Bonus} It turns out that if I don't input a value on the prompt it breaks the code and ignores all the modifiers. But as long as I put in a value (even 0), it works as intended.
1637453388
Kraynic
Pro
Sheet Author
I'm not sure if it will cure your issues, but I would remove any spaces that don't absolutely have to be there.  If you were doing a plain roll, you would have a space after /roll and then the roll calculation itself.  You have that space, plus another space inside the brackets before your first query, which means you effectively have 2 spaces after /roll.  But then, when you select an option in your queries, you have a space after the comma, which then injects another space into the initial gap after /roll.  And every query (with multiple options) after that is set up the same way, which creates more spaces after plus signs, which may very well be breaking your macro. Remove those and see if it makes a difference.
Kraynic said: I'm not sure if it will cure your issues, but I would remove any spaces that don't absolutely have to be there.  If you were doing a plain roll, you would have a space after /roll and then the roll calculation itself.  You have that space, plus another space inside the brackets before your first query, which means you effectively have 2 spaces after /roll.  But then, when you select an option in your queries, you have a space after the comma, which then injects another space into the initial gap after /roll.  And every query (with multiple options) after that is set up the same way, which creates more spaces after plus signs, which may very well be breaking your macro. Remove those and see if it makes a difference. This isn't something considered, I admit this is good practice and probably something I should do. Though for me the spaces help make reading it and spotting typos and such easier on the eyes. I would implement this advice, but it I had figured out the cause of the error by the time I saw your reply. Turns out this was this piece:  +?{Bonus} Where I just overlooked the fact that not putting in a number when prompted broke the code. So despite what my OP said, my code was never "breaking". It just took me a while to notice that all the 'broken" instances were those where I neglected to type a value vs all the working instances where I had done so.
I’d suggest on those ones adding a single option (so you’ll still be able to input any value you want) like this: ?{Bonus|0}
1637456802
GiGs
Pro
Sheet Author
API Scripter
Jarren's great suggestion of adding that |0 means that you enter a default value - if you dont enter anything, that is the value that is automatically entered.
1637463704
Oosh
Sheet Author
API Scripter
The 0-prefix is always an extra layer of error catching as well: +0?{Bonus|0} This will resolve as 0 even if someone enters "sdgknskdgnlsd".
Huh, good advice here. Thanks, I went ahead and updated it to: +0?{Bonus|0}
1637478072
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Oosh said: The 0-prefix is always an extra layer of error catching as well: +0?{Bonus|0} This will resolve as 0 even if someone enters "sdgknskdgnlsd". If that is not in Stupid Tricks Tips and Tricks, it should be.
1637487680
Oosh
Sheet Author
API Scripter
I'm pretty sure one of the usual suspects threw it in there - and it'll always be the Stupid Tricks thread in my brain, I did not give the name change recognition.
1637514715

Edited 1637515403
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
At least the URL still says Stupid Tricks... :)
1637526768
GiGs
Pro
Sheet Author
API Scripter
Personally i think it should have stayed called Stupid Tricks, we might have fewer general help questions if it wasn't named in a way to attract them.
1637531663
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
I was asked by Roll20 if I wouldn't mind renaming it (not pressured, just asked if it would bother me). I think the intent was to make it easier to direct people in social media. "Stupid Tricks" is kind of an inside joke, and almost no one realizes where the original reference came from anyway.
1637590900
Ziechael
Forum Champion
Sheet Author
API Scripter
<a href="https://app.roll20.net/forum/permalink/9102789/" rel="nofollow">https://app.roll20.net/forum/permalink/9102789/</a> &nbsp; keithcurtis said: If that is not in Stupid Tricks Tips and Tricks, it should be. To be fair it was written to accommodate missing attributes, never really thought of it as a way to error-proof queries!