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

Display result before drop down list

December 30 (1 year ago)

Hello everyone, is there a way in a macro to operate and display a roll dice before displaying a drop down macro ?
I want to roll for a number of shot, show the result in the chat and then ask the displayed number with a drop down list.

Another way I just think of would be to randomly choose an option of the drop down list each time.

Any idea ? Here is my code for the macro:

&{template:default} {{name=shot preparation}} {{Shots launch: =[[d3+1]]}}

?{nb shots |
2, 2 shots |
3, 3 shots
}
December 30 (1 year ago)

Edited January 02 (1 year ago)
GiGs
Pro
Sheet Author
API Scripter

Simple answer: no.

The Roll20 Order of Operations will make such attempts fail.

ISTR there is a way to fake it by having all rolls made but only displaying the one you want, but I can't rermember how to do that.

December 30 (1 year ago)

Thanks for the quick answer GiGs, maybe someone else will remember the trick you talked about.

December 30 (1 year ago)

Edited December 30 (1 year ago)
Gauss
Forum Champion

Hi Robin, 

What happens after the dice are rolled? Step by Step please.

December 30 (1 year ago)

Hi Gauss,

Actually the dice for the number of shots are rolled only after I choose in the drop down list the number i'm suppose to shot.

What I want is the display of the dice and then, after, the drop down list asking for the number.
Another way of working I'm currently looking for would be to select randomly one of the drop down list choice. It would display the desired result with only one step.

December 30 (1 year ago)
Gauss
Forum Champion

Alright, lets see if I understand. 

You want a bunch of rolls, then you want those rolls to be displayed depending on a query of how many rolls you want displayed? 
Are the rolls to be summed or displayed separately?

December 30 (1 year ago)

Actually I only use one roll, the first one: Shots launch: =[[d3+1]]

This roll give me 3 possible results which are 2, 3 or 4. Then I use the result to choose between the choices in the drop down list:
2 for a macro with 2 shots
3 for a macro with 3 shots
4 for a macro with 4 shots (forgot to add this one in the code I gave in the exemple higher)

My issue being that the list ask for a choice before the roll with the answer is made :/

December 30 (1 year ago)

Edited December 30 (1 year ago)
Gauss
Forum Champion


Robin said:

Actually I only use one roll, the first one: Shots launch: =[[d3+1]]

This roll give me 3 possible results which are 2, 3 or 4. Then I use the result to choose between the choices in the drop down list:
2 for a macro with 2 shots
3 for a macro with 3 shots
4 for a macro with 4 shots (forgot to add this one in the code I gave in the exemple higher)

My issue being that the list ask for a choice before the roll with the answer is made :/


I understand you have the problem with the choice. But, I need, step by step, exactly every single thing that is being done, pretend there is no computer, only the kitchen table. 

You roll 1d3+1
Now what? 
What is done with the 2 shots, the 3 shots, etc? 

You are leaving out the result which is just as important as the how to get the result. 

The reason all of it matters, start to finish, is because there are multiple ways to solve such things. Sometimes approaching it backwards solves it.

December 30 (1 year ago)

I wanted to keep the question simple but I understand it could be hard to answer without the full context. So let's explain the entirety of my problem.
I have this chat menu with buttons able to call 3 abilities for the caracter Nikita: "melee-attack", "range-attack" and "nb-strike"

Abilitie "menu":

/w Nikita &{template:default} {{name=Choix d'action }} {{Attaque :=[Mélée](~Nikita|melee-attack) [Distance](~Nikita|range-attack)}} {{Acharnement :=[Furax](~Nikita|nb-strike)}}

Abilitie "nb-strike":

&{template:default} {{name=Préparation d'Acharnement 卵亂}} {{Nombre de coups lancés : =[[d3+1]]}} {{[Démarrer l'Acharnement](~Nikita|acharnement)}}

We are looking for "nb-strike" since this macro give the nomber of shots and can call my drop-down list call "acharnement". My way to deal with the problem I talked about higher was to start the list with a button. This way I can read the nomber of shot and then select the correct option.

Abilitie "acharnement"

?{Nombre de coups |
2 coups, &{template:default} {{name=Acharnement 望卵}} {{Vos capacités en force : =@{Nikita|Force}}} {{ Tentative n°1 :=[[d100]] | @{Nikita|Force}}} {{*Schlak !* Dégâts du 1er coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} {{ Tentative n°2 :=[[d100]] | @{Nikita|Force}}} {{*Bim !* Dégâts du 2nd coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} |
3 coups, &{template:default} {{name=Acharnement 望卵}} {{Vos capacités en force : =@{Nikita|Force}}} {{ Tentative n°1 :=[[d100]] | @{Nikita|Force}}} {{*Schlak !* Dégâts du 1er coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} {{ Tentative n°2 :=[[d100]] | @{Nikita|Force}}} {{*Bim !* Dégâts du 2nd coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} {{ Tentative n°3 :=[[d100]] | @{Nikita|Force}}} {{*Bonk !* Dégâts du 3ème coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} |
4 coups, &{template:default} {{name=Acharnement ️望卵}} {{Vos capacités en force : =@{Nikita|Force}}} {{ Tentative n°1 :=[[d100]] | @{Nikita|Force}}} {{*Schlak !* Dégâts du 1er coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} {{ Tentative n°2 :=[[d100]] | @{Nikita|Force}}} {{*Bim !* Dégâts du 2nd coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} {{ Tentative n°3 :=[[d100]] | @{Nikita|Force}}} {{*Bonk !* Dégâts du 3ème coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}} {{ Tentative n°4 :=[[d100]] | @{Nikita|Force}}} {{*Schling !* Dégâts du 4ème coup : =[[d@{Nikita|Contact}+@{Nikita|Contact}]]}}
}

Here is the list with each option making 2, 3 or 4 rolls for 2, 3 or 4 attacks.

December 30 (1 year ago)

Edited December 30 (1 year ago)
Gauss
Forum Champion

I feel we are having a communication issue. 

What I am trying to get from you is...
Pretend you are at your kitchen table. There is no Roll20, no computer. 
You roll a die. 
Then you do...X
Then you do Y
Then you do Z

Example: 
I roll a d3 and add 1 to decide how many attacks I make
Then I roll 1d20+5 for each attack
Then I roll 1d8+3 for each attack's damage. 
And so on. 

Edit: Rereading this a bunch of times let me see if I understand: 
You roll 1d3+1
If it is a 2, you select the "2" option from your query, which results in two attacks (or whatever they are)
If it is a 3, you select the "3" option from your query, which results in three attacks (or whatever they are)
If it is a 4, you select th "4" option from your query, which results in four attacks (or whatever they are)

Yes? 

If that is the case, could you explain what exactly is rolled etc in the 'attack'? 
Again, step by step as if Roll20 doesn't exist would be most helpful.

December 30 (1 year ago)

Yes you summarized it well.

I roll a d3 and add 1 to decide how many attacks I make
Then I roll a d100 Strenght check for the 1st attack damage (so 1d100 who must be lower than 45)
Then I roll a dContact+Contact for the 1st attack damage (so 1d33+33)
Then I roll a d100 Strenght check for the 2nd attack damage (so 1d100 who must be lower than 45)
Then I roll a dContact+Contact for the 2nd attack damage (so 1d33+33)
And so on. 

I hope I was more clear this time.

December 31 (1 year ago)

Edited December 31 (1 year ago)
Gauss
Forum Champion

Alright, thank you for the explanation. Without using the API that may be a tricky one. I am going to have to think about it. As GiGs said there might be a way, but it may be very arcane and only a few people (who are not me) understand those options. 

With that said, this isn't a 1d3+1 roll. It is a 1d3 roll where: 
2 attacks are always made
On a 1: nothing different happens (ie: the first two attacks are already "always on")
On a 2: a third attack is added
On a 3: a fourth attack is added

I'll give it some thought. 

Now that Gauss has done the hard work of determining the requirements I can make a macro that does it.

&{template:default} {{Nombre de coups lancés : = $[[0.computed]]}} {{Vos capacités en force : =@{Nikita|Force}}} {{Tentative n°1 :
*Schlak !* Dégâts:=$[[12.computed]] | @{Nikita|Force}
$[[13.computed]]}} {{Tentative n°2 :
*Schlak !* Dégâts:=$[[14.computed]] | @{Nikita|Force}
$[[15.computed]]}} {{Tentative n°$[[5]] :
*Schlak !* Dégâts:=$[[16.computed]] | @{Nikita|Force}
$[[17.computed]]}} {{Tentative n°$[[8]] :
*Schlak !* Dégâts:=$[[18.computed]] | @{Nikita|Force}
$[[19.computed]]}} {{name=

$[[$[[1]]]] [[[ [[ [[1d3+1]] ]] [[ [[ [[102]]+1 ]]+1 ]] [[3]][[3]][[2]][[4]][[3]][[2]] $[[11]] [[ [[ [[0]] ]] ]] ]]]
[[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]] [[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]] [[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]] [[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]]

}} {{name=Acharnement}}
January 02 (1 year ago)
Gauss
Forum Champion

Thank you RainbowEncoder :)

January 05 (1 year ago)

Thank you so much RaibowEncoder, it work like a charm !

Do you have some explaination on how it's working ? Or at least some link to a wiki, post or tutorial about this magic? I would like to learn this kind of trick.

January 05 (1 year ago)
Gauss
Forum Champion

Robin,

Here is the link to how it is working.

Everything else can be found under Reusing Rolls

January 13 (1 year ago)

Edited January 13 (1 year ago)

So I learn some new things with the wiki and the link on how to reuse rolls and tricks to hide those rolls in the name field but I still can't understand some parts/magic/logic behind all this.

What is the use of 102 ?
In which order are made the $[[x.computed]] calls finding their value in the hide name field ?

Could you break down the flow of the macro part by part to explain it to me a bit?

RainbowEncoder said:

{{name=

$[[$[[1]]]] [[[ [[ [[1d3+1]] ]] [[ [[ [[102]]+1 ]]+1 ]] [[3]][[3]][[2]][[4]][[3]][[2]] $[[11]] [[ [[ [[0]] ]] ]] ]]]
[[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]] [[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]] [[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]] [[d100]] [[d@{Nikita|Contact}+@{Nikita|Contact}]]

}}

I would like to update the macro to roll a 1d4+2 (try to hit 3 times Min and 6 times Max now), but I'm still really far from perfect understanding of this wonder.

Have you read the Macro curiosities thread? Since you'll need to understand most of those concepts. It also includes a breakdown of roll duplication which is the major trick here. The value of 102 isn't functional, I was just using it as a distinct value to help keep track of where the rolls were. The computed rolls are alternating between attack and damage but it is not important to the trick.