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

Roll before Query inside a Macro? / Private Token Rolls?

Before someone says it (because I know someone would point it out at some point), I have already gone through the R20 wiki for macros and rollable tokens. 1) So... what I'm wanting to do is to have a gmroll that will decide how the macro will function. So, lets say I roll a d20 and it hits a 15... I want it to activate a certain other macro. How would I go about doing this? I've tried having the roll set before the query, but it doesn't work; it simply skips the roll and jumps straight to the query. I'm wanting this so that I can quickly set up random encounters without the players really knowing what's coming up next. /gmroll d15 ?{What type of encounter (1-10 Small, 11-15 Medium) ?| Small, #Small_Encounter | Medium, #Medium_Encounter } Another issue with it I'm having is that for my Small_Encounter macro, if it's activated from the query (removed the roll to test the query), it simply says a message "/gmroll [[#]]", the # being either a 2 or 3, "t[Encounter]" and not actually rolling the table... which actually happens as a gmroll if launched normally. 2) This one is minor and not as important as the first one, but still curious about it. Is it possible to do use a rollable tokens "Random Side" from it's right-click -> multi-sided to be turned into a gmroll while changing it's side? Thanks for reading this, and any help/info you can provide. I just hope that these things are just my lack of experience/overcomplicating things rather than API required.
Sorry about it being in the General On-Topic thread. I had multiple tabs opened, including the Specific Use thread (which I believe where this belongs), and accidentally posted it here instead. If it needs to be relocated, please do so.
1463030449

Edited 1463030933
qwerty4132 said: Sorry about it being in the General On-Topic thread. I had multiple tabs opened, including the Specific Use thread (which I believe where this belongs), and accidentally posted it here instead. If it needs to be relocated, please do so. No worries! I moved this to Specific Use Questions, but we really don't mind moving threads around at all. qwerty4132 said: I've tried having the roll set before the query, but it doesn't work; it simply skips the roll and jumps straight to the query. This is due to the Order of Operations . qwerty4132 said: Another issue with it I'm having is that for my Small_Encounter macro, if it's activated from the query (removed the roll to test the query), it simply says a message "/gmroll [[#]]", the # being either a 2 or 3, "t[Encounter]" and not actually rolling the table... which actually happens as a gmroll if launched normally. Do any of the Macros you have nested within your Roll Query (e.g. #Small_Encounter, #Medium_Encounter) happen to contain any vertical bars, commas, or closing curly braces? Extra instances of those characters can break Roll Queries, and need to either be removed (or replaced with HTML entities) as per Advanced Usage for Roll Queries and Roll Query Troubleshooting . If this isn't the case, feel free to post/outline what you're having trouble with (including the contents of the nested Macros), and I could take a look. qwerty4132 said: Is it possible to do use a rollable tokens "Random Side" from it's right-click -> multi-sided to be turned into a gmroll while changing it's side? I just discovered that, while /talktomyself is active, the "Token roll" is not output to the chat. (A side effect: the context menu does not disappear when you select "Random Side", making it very easy to roll the Token multiple times!)
1463033196

Edited 1463033326
Actually the encounter macros that I have nested don't have any of those in them. They're really plain.   Small Encounter-> /gmroll [[d3r]]t[Encounter] Could it be due to it using a rollable table? Edit: In the process of trying to figure out a workaround, the encounter is working just fine from the query... so maybe it's the rolls prior to the query that's messing with it... Thanks for the Order of Operations link. I probably missed it when I was doing a quick look for a couple things. Now I'mma be trying to figure out a workaround. I know that orders exist for a reason, but sometimes what you want to do goes against it. And that little discovery you made about the TTM is pretty cool. 
qwerty4132 said: Actually the encounter macros that I have nested don't have any of those in them. They're really plain.   Small Encounter-> /gmroll [[d3r]]t[Encounter] Ah, you'll want to remove the spaces before the Macro calls, i.e. ?{What type of encounter (1-10 Small, 11-15 Medium) ?| Small,#Small_Encounter | Medium,#Medium_Encounter }
1463034447

Edited 1463034498
qwerty4132 said: I know that orders exist for a reason, but sometimes what you want to do goes against it. Yup. Once way to do this is using API Command Buttons in a special way (that does not require access to the API). e.g. /w gm [[1d15]] - [Small](!
#Small_Encounter) [Medium](!
#Medium_Encounter) Alternatively, you could rename "Small_Encounter" to "Encounter_0" and "Medium_Encounter" to "Encounter_1" and then nest the d15 roll within an API Command Button like so: /w gm [Roll Encounter](!
#Encounter_[[[[ floor(1d15 / 11) ]]]])
So the call for the table roll is working fine. Now I just need to figure out the rolling workaround.
This is all so confusing to me and kinda challenging, and I'm loving it! 
Actually, there might be an even easier way to do this... What's #Medium_Encounter?
1463034995

Edited 1463035065
It's basically the same as Small, just a different sized roll. Like Small = 2 or 3, Medium = 4 - 6, Large = 7 - 10.
1463035166

Edited 1463035409
Ah, Okay. I was going to recommend amalgamating everything like so: /gmroll [[ d[[ 3 + 3 * floor(d15 / 11) ]]r<1 ]]t[Encounter] However, that won't work if you want to change r<1 to r<3 etc.
Why the floor though?
1463035753

Edited 1463036676
floor() is a Rounding Function that reduces a number to its largest previous integer. e.g. floor(1.242) → 1 and floor(0.324) → 0, etc. So, say d15 resolves to be <11. Then, 0  ≤ d15 / 11 ≤ 1 i.e. floor(d15 / 11) → 0. If d15 resolves to be ≥11, then, 1  ≤ d15 / 11 ≤ 2 i.e. floor(d15 / 11) → 1. It's a convenient (but not the only) way of mapping the results of a d15 roll to either 0 or 1.
Ooooooh. I get it. It basically combines the two into one. That's awesome! Thanks a bunch for that! If I need a large battle, I'll just go with the large encounter.  In all honesty, I love coming across problems and things I don't understand, simply because I get to learn something new and it actually entertains me. I understood what flooring does, but simply had a brain fart and didn't really understand the way you used it. After rereading your explanation a couple times, it finally clicked and that's pretty neat. Now I don't even really have to worry about how to decide whether or not an encounter is going to be small or not.  Again, thanks a bunch.
You're very welcome! Happy rolling!
You too.