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 things

Hi I have a question. Is there for the roll20 macros a way to roll xd4 and discard  the last dice? And my 2nd question is, is there a way to make a macro where you select something from a first drop down box, which then limits what can be selected from the second drop down box?
1545315857
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
1. I don't think so. Can you give an example of why you would want to do this rather than roll (x-1)d4? There might be another way to accomplish your goal. 2. No. Something like that would require an API script. Macros can't "remember" what they have rolled that way. The closest thing you could do would be to have the first drop down choose from among a group of macros that each contain their own drop down. But there would be no link back to any choices made by the first drop down. Depending on your goal, you might be better off using Chat Menus .
1545316170

Edited 1545316321
Andreas J.
Forum Champion
Sheet Author
Translator
The M. said: Hi I have a question. Is there for the roll20 macros a way to roll xd4 and discard  the last dice? It's possible, you don't even need macros for it.  /roll 8d4d1 The above would drop the smallest roll from the result. The M.  said: is there a way to make a macro where you select something from a first drop down box, which then limits what can be selected from the second drop down box? You can achieve that effect, but it's not quite that way. You'd essentially want to create a nested query, which gives you a different question depending on which answer you picked in the first question.  It's a bit tricky to do, and once you've written a nested query and saved it in a macro , you shouldn't open it because roll20 changes a few characters in this special case. You can read about it here . I think there floats a round a few threads a bout it here on the forums but the wiki doesn't seem to at least link to any larger example in the article, but there may still exist some article about it there. Edit: Between my and Keith's answers, it's more safe to assume Keith is correct, if we contradict eachother.
1545317425
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Actually, Andreas is likely right about the drop down, although I would caution that they are hideously complicated to write. Certainly beyond me. The character escaping is a bit arcane, and as Andreas says, fairly volatile. As for the die rolling expression, Andreas' expression would drop the lowest die, but the request was for a macro that would drop the last die, presumably regardless of the number rolled.
1545323298

Edited 1545323363
vÍnce
Pro
Sheet Author
I think you'll have to visually handle xd4 drop the last roll.  Wasn't sure if you needed to add the remaining dice together...  You may be doing something like this already; /em is rolling ?{how many|1}d4 = [[ ?{how many|1}d4 ]] Just hover over the result and visually drop the last roll.
Thank you for all of the help. In regards to my 2nd question I thought of Keithcurtis's solution a couple of hours later. (silly me forgetting that other macros can be referenced in a macro.) in regards to my first question this [1] would be the example, for which I would need it, because the player would in put their points in ballistic skill and then they would be asked at what range they are. The problem could also be solved by removing the first dice or a random dice, the thing is that i don't want to remove the highest or lowest dice, because that would weight the roll for or against them. The problem could of course be solved by just visually looking at the dice, but it is one of those general improvements of life, that is the same reason that we use macros; "why do it manually if you can have a computer do it for you" [1]: /roll ?{points in Ballistic Skill?|0}d4 + ?{Range?| Close, [[1d4]] | Medium,[[0]] | Far, [[ remove last dice??? ]]}
1545348366
GiGs
Pro
Sheet Author
API Scripter
The basic structure you'd need to make this work I believe is as below (but you'd need to replace some nested characetrs with html entities): /roll ?{Range?| Close, [[?{points in Ballistic Skill?}+1]]d4 | Medium,?{points in Ballistic Skill?}d4 | Far, [[{ ?{points in Ballistic Skill?}-1,0}kh1]]d4 } I dont mess with nested queries if I can avoid it, so not sure which characters you'd need to change. Note that if you are using a character sheet, you can replace ?{points in Ballistic Skill?} with a call to the value on the character sheet, something like @{selected|BallisticSkill} (whatever the attribute is called). This is easier.
It turned out that my 2nd problem was not as simple to solve as expected, and it turns out that both of my problems can currently only be solved by using HTML entities. I guess all my problems were solved more or less and I would just like to again thank everyone that helped me on this journey.
1545353659

Edited 1545354526
GiGs
Pro
Sheet Author
API Scripter
Here's the working code, with html entities: /roll ?{Range?| Close, [[?{points in Ballistic Skill?|0}+1]]| Medium,?{points in Ballistic Skill?|0}| Far, [[{?{points in Ballistic Skill?|0}-1,0}kh1]]}d4 Edit: added a default value, and moved die out of the query.
1545354310

Edited 1545354512
I just finished and I programming the macro myself, and then I just wanted to post the answer, for anyone who might be interested, only to find that you GiGs beat me to it. This is how I did it: /roll ?{Range?| Close, [[?{points in Ballistic Skill|0}+1]]d4 | Medium,?{points in Ballistic Skill|0}d4 | Far, [[?{points in Ballistic Skill|0}-1]]d4} + ?{Have you moved Last Turn (Only applies to sniper rifles)?  | Yes / does not apply to me, [[0]] | No, [[1d4]] } (Thing in bold is an addition that I made later on.) btw thx GiGs for helping me think about the problem in another way; first asking for the range and then the points in Ballistic Skill, instead of the other way around. (Also my solution is like 95% yours, so it really is more yours than mine, more like my take on your solution.)
1545354574

Edited 1545354625
GiGs
Pro
Sheet Author
API Scripter
You're welcome! glad you got there :)
1545354811
GiGs
Pro
Sheet Author
API Scripter
Note: in your version you might have an issue at far range when someone has 0 ballistic points (shouldnt happen often): they could end up rolling a total of -1d4. My method includes a check for that admittedly unlikely scenario, limiting the roll to 0, never negative.
1545354940

Edited 1545355008
I just figured out why you had the  -1,0}kh1  part in there, that's so ingenious, I would have never thought of that, and with that edition my version would  essentially be exactly yours. After I posted this I refreshed the page and just saw your post.
GiGs said: Here's the working code, with html entities: /roll ?{Range?| Close, [[?{points in Ballistic Skill?|0}+1]]| Medium,?{points in Ballistic Skill?|0}| Far, [[{?{points in Ballistic Skill?|0}-1,0}kh1]]}d4 Edit: added a default value, and moved die out of the query. just asking, didn't you forget the closing bracket at the end or is it supposed to be that way? (if you can't spot the difference look at the last character) shouldn't it be  /roll ?{Range?| Close, [[?{points in Ballistic Skill?|0}+1]]| Medium,?{points in Ballistic Skill?|0}| Far, [[{?{points in Ballistic Skill?|0}-1,0}kh1]]}d4 }
1545356590
GiGs
Pro
Sheet Author
API Scripter
No, it's supposed to be that way. I moved the d4 out of all three rows, and put it at the end - so the query just returns the number of dice to roll. I cant remember if its been mentioned: make sure you save this macro in a character ability, or if you put it in a Macro, never reopen it. The html entities will be erased if you open a standard macro, but that doesnt happen from Abilities.  One thing people often do is create a character called Macros, make it editable by all players, and put universal macros in that instead of the Macro tab. That means you can easily transfer them to new campaigns through the transmogrifier, and keeps html entities safe.