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

A couple macro questions

What I'm looking to do is something like this, [[@{target|Me|?{Skill}}]] Basically a macro that lets me specify which skill I'm rolling against with a variable. Is this possible? Is it possible to test success against a sum? Something like [[3d6>{2+@{target|Enemy|Shield}}]] Is it possible to have dynamic values as the text or default value for a variable. I'm imagining something like ?{Test|[[1d20]]}
No, no, and yes.
The first is simply not possible at the moment, due to the way the system handles queries. Someone will be along soon with more details, and possibly a way to do so thru the API (I'm not sure if it is possible, even with the API, actually.) The second is simple, I think, provided the target number is available as an Attribute on the character sheet. (EDIT: Oops, guess not!) The third one, I'm not entirely sure what you're asking. It looks like you're wanting to query the value going into an inline roll, in which case this should work (I haven't tested it): [[?{Test|1d20}]] -Phnord
1427843549

Edited 1427843635
I'm trying to let the user see the result of an inline roll for the last one before putting in a value
Oh, than no to all your questions.
1427856893
Lithl
Pro
Sheet Author
API Scripter
Devon R. said: Is it possible to test success against a sum? Something like [[3d6>{2+@{target|Enemy|Shield}}]] Instead of (3d6)>(2+Target), try using (3d6-2)>(Target). The difficulty can't be an expression, but you can frequently change the expression of the roll so that the difficulty is simply a number.
The macro system resolves dice rolls and variable calls instantly and only once. So if you use a query to ask for a skill name, in that single instance of resolving values, it will only ask for the skill name. It will not resolve a second time to use that entered value to reference another value. ie: you can't ask for a skill name and then have it return the value of that skill. That's two operations. Rolling success rolls (comparing your roll to a value and determine if it succeeded or not) only works well if you're doing math on the left side of the comparison. The right side should be a single value. ex: [[ 1d20-5>10 ]] is ok. [[ 1d20>10-5 ]] is not. You can use a query to ask for some flavor text in the roll, certainly. You can use query's both inside and outside of inline rolls [[ ]] /me ?{What do you do?|does something}, rolling [[ 1d20 + ?{Roll Modifier:|0} ]] to succeed.
1427878264
Ziechael
Forum Champion
Sheet Author
API Scripter
Since it hasn't been mentioned yet I thought i'd chime in with a handy link to the dice reference , in particular the section on order of operations is worth noting when trying to reason out whether a macro should work or not :)
Hello everybody. I don't understand what's going wrong... My macro: /roll {((@{Insight Rank}+@{Reflexes})d10!!kh@{Reflexes})-@{Pen}} works fine. But the: {((@{Insight Rank}+@{Fire})d10!!kh@{Fire})-@{Pen}} don't work... Thanks for the attention and help.
1427917242
The Aaron
Roll20 Production Team
API Scripter
You have a closing ) instead of a closing }: @{Isawa Hisen|Insight Rank)d10!!kh@{Fire} is looking for "Insight Rank)d10!!kh@{Fire" as an attribute of "Isawa Hisen"
1427918369

Edited 1427918530
Hmmm. sorry. I don't get it. lol Same work with Insight Rank and Reflexes.. Where i fix it? the code dont have the ) in place of }. {((@ { Insight Rank } +@ { Fire } )d10!!kh@ { Fire } )-@{Pen}}
1427919990
The Aaron
Roll20 Production Team
API Scripter
It's not in what you posted, but it is in the error message: Somewhere you have a ) instead of a } or else something is changing it on your text input.
1427922069

Edited 1427923501
Well, i restart the table and working now... lol Thank you! Ah.. take one more doubt... how you saw, using the roll and keep system. how i sum a number into the keep area? Ex.: {((@{Agility}+5)d10!!kh@{Agility}+1)-@{Pen}} Agility is 3. (3+5)d10!!kh3+1 When I tried to put [...]kh(@{Agility}+1) didn't work.
1427923588
The Aaron
Roll20 Production Team
API Scripter
You'd need to apply the commutative property of addition and move that constant to the other side: (((@{Agility}+5)d10-1)!!kh@{Agility})-@{Pen}}
Roll and keep make me confuse... sorry. To sum in the keep? Like this: keep 4. (Agility = 3 + 1) Tried wha u said: {(((@{Agility}+5)d10-1)!!kh@{Agility})-@{Pen}} and received syntex error.
1427925341
The Aaron
Roll20 Production Team
API Scripter
Possibly I'm confused about what you're after? What part do you want summed?
the keep part... I was using "kh@{Agility}+1". Today i saw that actually the keep still as 3 (Agility) and not sum to 1. The 1 is added to the result. I know that my explanation isnt the best, bad english lol.
1427936053
The Aaron
Roll20 Production Team
API Scripter
Oh, so with an agility of 3, it should be keeping 4 dice?
yeah. keep the agility summed 1. When the agility is 3, the keep will be 4. If agility is 4, will keep 5. Thx
1427970168
Gauss
Forum Champion
When working on complicated macros like this it is usually easier to break it down into numbers and then later replace numbers with attributes. That way you know if the basic formula is the problem or not. Additionally, if the formula is breaking start with it's most basic form (a die roll) and then add in each element until you see what breaks it. Example: 10d10kh(4-1) doesn't work while 10d10kh3 does so from that we determine that you cannot sum a value before the keep/drop mechanic is applied. However, there is a workaround: If you put kh4dl1 then you will keep the 4 highest and then of those 4 you will drop the lowest die. The effect is keep high 3. Alternately, if you put it in an inline roll you can group it but that will require that you use a regular roll for the rest of the roll. All three of these versions should work. One is regular roll, one is full inline, the last is regular roll with summed inline parts. /r (@{Insight Rank}+@{Reflexes})d10!!kh@{Reflexes}dl@{Pen} [[(@{Insight Rank}+@{Reflexes})d10!!kh@{Reflexes}dl@{Pen}]] /r [[@{Insight Rank}+@{Reflexes}]]d10!!kh[[@{Reflexes}-@{Pen}]] Let me know if one of these does not work correctly.
Gauss... your solution will allow him to keep X fewer than his target attribute... whereas he's looking for an option to keep 1 more than his target attribute...
1427999469

Edited 1427999706
Gauss
Forum Champion
Chell , I was responding to Daniel's macro in this post . Daniel's macro in that post is designed to keep high (X-Y). The macros I provided him keep high (X-Y). If I misunderstood his macro or he didn't post it correctly he can rearrange the macros I gave him to suit.
oh... didn't see that, my mistake
1427999815
Gauss
Forum Champion
No worries, his macro is pretty complicated and I may have misunderstood it. If I did, it should be simple to fix. :)
this problem occurred with the fire attribute, that was fixed when i restart lol. But I liked your solution. I shall use so it is simpler to understand and work. And solve my new problem too. Many thx!
hmmmm.. a new problem with your solution... lol.. sorry. how to put the option: /r [[@{Insight Rank}+@{Reflexes}]]d10!!kh[[@{Reflexes}-@{Pen}]] into the template? Ex. {{Iniciativa= [[ [[@{Insight Rank}+@{Reflexes}]]d10!!kh[[@{Reflexes}-@{Pen}]] ]] }} the error: SyntaxError: Expected "]" or [^\]] but end of input found.
Nested inline rolls will not work, so this solution cannot work in a roll template.
1428074562

Edited 1428074840
Gauss
Forum Champion
Correct, if I knew you wanted a template for this then I would not have suggested inline rolls. :) You will need to use the non-inline version in where you kh@{Reflexes} and dl@{Pen}. That will go into a template. BTW, to double check what you want here so I am not misunderstanding you want: is it: (A+B)d10!!kh(B-C) or do you want: ( (A+B)d10!!kh(B) ) - C Or put another way, is "C" modifying the total roll or is it modifying the number of kept dice?
in real is ( (A+B)d10!!kh(B+C) ) - D this into the template, its possible? Sorry and again many thx with the help.
1428115489

Edited 1428127564
I think your best bet would be to do the following ((A+B-C))d10!!kh(B) + (C)d10!!) - D
1428121058

Edited 1428121190
Gauss
Forum Champion
Daniel , so you want to add (not subtract) the keep high portion "B+C" ? And "D" is subtracted from the entire roll?
exactly Gauss! with your code i can do it, but not into the template. the code that I mentioned: /r [[@{Insight Rank}+@{Reflexes}]]d10!!kh[[@{Reflexes}-@{Pen}]]
1428136700

Edited 1428136972
Gauss
Forum Champion
Ok, I am a bit confused then. The code that you mentioned doesn't add B+C to the keep high portion. Ok, we are clear that you want: (A+B)d10!! and that you want to keep a certain number of the highest rolls. Could you explain that a bit better? Because right now I am getting conflicting messages. My confusion is regarding how many rolls do you want kept. In your last post you agreed with B+C but then the code you mentioned does B-C. Version 1: you want B+C kept (example: if B = 3 and C = 2 you want 5 dice kept). Version 2: you want B-C kept (example: if B = 3 and C = 2 you want 1 die kept). If you want version 2 then the solution is: d10!!kh@{B}dl{@C} If you want version 1 then I will have to work on a solution. Chell's last post is regarding version 1 but it wont work as desired.
sorry, English is not my best, what I meant is that the code that sent separating by [[]] allows me to sum (or subtract) the values to be keeped, but does not allow the use of the template. But what I really need still is ( (A+B)d10!!kh(B+C) ) - D into the template, if possible. Like your version 1. Ex. ( (A+B)d10!!kh(B+C) ) - D A = 2 B = 3 C = 1 D = 5 results roll: (5d10!!kh3) - 5 (5 + 18 + 3 + 1 + 8) - 5 (31) - 5 26 Many thx!
To my knowledge there is no way to keep a dynamically increased number of dice... the solution I suggested earlier would result in a similar set of results but it won't be entirely accurate... using your sample numbers my suggestion would roll 4d10!! and keep the highest 3 and then roll 1 extra d10!!... the downside to this is that the 1d10!! that was dropped from the initial 4d10!! may in actuality be higher than the final kept d10!!... if both B & C are static values that can never be raised then you could just manually add them and have a new formula of ((A+B)d10!!kh(C)-D) where C = 4
I am also interested in the same type of macro as Devon: /w gm @{selected|character_name}'s ?{Skill?|spot}: [[1d20+@{selected|?{Skill?|spot}} ]] An order of operations would make macros break less often, as well as provide loads of functionality to the players. Something like ?{},@{},(),[]. This order makes user input first, then attributes/targets are figured out, then self-ordered calculations, and lastly the roll calculations. This gives all the calculations a chance to become numbers BEFORE trying to roll. Also, a name or function to talk to one's self through a macro would be nice, as having multiple GMs in a single game makes "/w gm" ineffective. A "/self" or "/w @self" or something along those lines would be nice. I'm not quite sure how to talk to the developers, but hopefully this works without upsetting the community.
1428183936
Gauss
Forum Champion
Daniel , I don't think there is a way to do it in the templates. /r (A+B)d10!!kh[[B+C]] - D is the only way to do it right now. Demonkin Esther , you can whisper to yourself by typing /w "your name" (without the quotes).
Chell, the static valor is the same into the roll and the keep, some attribute, like reflexes, willpower.. Ex. of default roll: ((Attribute + Skill Rank + bonus x )d10!!kh(Attribute + bonus y )) - Penality Thx again Gauss, I think that I'll use in the template rolling with bonus and do a head count of dice kept bonus. I like to template because it reduces the space used in chat with the roll, more organized. And thx everybody with the help and patience.
Demonkin Esther , you can whisper to yourself by typing /w "your name" (without the quotes). Although that's true, I have a 'character sheet' that has macros for the DM to utilize (we have multiple DMs that rotate depending on what we want to do for the session). Hard-coding a macro with my own name would prevent any other DM from utilizing it, hence why a "/self" would be useful. Thank you for the reply!