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

Drop-down choices and defered replacement

1598424789

Edited 1598429186
I want to make a knowledge macro for pathfinder, and it needs to go something like: Knowledge[choice] = 1d20 + @{selected|knowledge-choice} I'm trying this {{Knowledge [?{Knowledge|Arcana|Dungeoneering|Engineering|Geography|History|Local|Nature|Nobility|Planes|Religion}]=[[1d20+?{Knowledge|Arcana,@{selected|knowledge-arcana}|Dungeoneering,@{selected|knowledge-dungeoneering}|Engineering,@{selected|knowledge-engineering}|Geography,@{selected|knowledge-geography}|History,@{selected|knowledge-history}|Local,@{selected|knowledge-local}|Nature,@{selected|knowledge-nature}|Nobility,@{selected|knowledge-nobility}|Planes,@{selected|knowledge-planes}|Religion,@{selected|knowledge-religion} } }]]}} but apparently defering replacement for choices just doesn't work. It turns them into a 0. Is there a way to have a choice mean something in one place, and something else in another?
1598426099

Edited 1598426475
Oosh
Sheet Author
API Scripter
No there isn't, and you can't use a Query result inside an Attribute call due to order of operations. If you need it to hold two values (like a number and a text label) you can either have two Queries (tends to be annoying), or put more of your macro into the Query value: &{template:default} {{name=Knowledge Roll}} {{Knowledge (?{Knowledge| Arcana,Arcana)=[[1d20 + @{selected|knowledge-arcana}[ARC]]]| Dungeoneering,Dungeoneering)=[[1d20 + @{selected|knowledge-dungeoneering}[DNG]]] } }} Only two options in there, presumably you want to use a PF template anyway. But you get the idea. Note that you can put a line break in your macro at the pipe | where you split your Query options up. It makes these long drop-downs significantly easier to read and edit.
1598426732
GiGs
Pro
Sheet Author
API Scripter
Jean-Luc C. said: Is there a way to have a choice mean something in one place, and something else in another? No, there's no way to do this. The way to achieve a similar effect is to make each row of the query include more. You can do this: {{?{Knowledge| Test,Test=[[1d20+20]]| Arcana,Arcane=[[1d20+ @{selected|knowledge-arcana}]]| Dungeoneering , Dungeoneering, [[1d20+ @{selected|knowledge-dungeoneering}]]}}} Just enter the other rows as appropriate.