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

Simple macro, adding & with only one name ID

1692887456

Edited 1692887496
I have this code. /w gm &{template:default} {{name=Passive Perception}}     {{Drek=@{Drek Latefang|passive_wisdom}}} Easy peasy, displays the named sheets passive wisdom. Is there a way to repeat the passive_wisdom with subtractions or additions, without repeating the sheet name and add letters? Like /w gm &{template:default} {{name=Passive Perception}}     {{Drek=@{Drek Latefang|"N"passive_wisdom & "A"passive_wisdom+5 & "D"}passive_wisdom-5}} So that the end result would look something like Passive Perception Drek    N23    A28    D18 Any ideas please?
Without repeating the character name? No. But it is possible. Here's two options: /w gm &{template:default} {{name=Passive Perception}}  {{Drek=N[[@{Drek Latefang|passive_wisdom}]] & A[[@{Drek Latefang|passive_wisdom}+5]] & D[[@{Drek Latefang|passive_wisdom}-5]] }}  /w gm &{template:default} [[ [[ [[@{Drek Latefang|passive_wisdom}]] +5 ]] - 10 ]] {{name=Passive Perception}}  {{Drek=N$[[0]] & A$[[1]] & D$[[2]] }} 
Jarren said: Without repeating the character name? No. But it is possible. Here's two options: /w gm &{template:default} {{name=Passive Perception}}  {{Drek=N[[@{Drek Latefang|passive_wisdom}]] & A[[@{Drek Latefang|passive_wisdom}+5]] & D[[@{Drek Latefang|passive_wisdom}-5]] }}  /w gm &{template:default} [[ [[ [[@{Drek Latefang|passive_wisdom}]] +5 ]] - 10 ]] {{name=Passive Perception}}  {{Drek=N$[[0]] & A$[[1]] & D$[[2]] }}  That second one is great, is there a way to add multiple sheets though, so it displays the N,A & D values for different character sheets named before hand?
1692892460
timmaugh
Forum Champion
API Scripter
Do you mean multiple characters in the same report? That's just a matter of new lines in the template. The default template lets you do that pretty easily, so you can duplicate the inline roll portion for the other characters (since it's between template parts none of it will show, no matter how many you shove in there). You would just have to know which rolls were indexed to which characters: /w gm &{template:default} [[ [[ [[@{Drek Latefang|passive_wisdom}]] +5 ]] - 10 ]] [[ [[ [[@{Kalor Earlyfang|passive_wisdom}]] +5 ]] - 10 ]] {{name=Passive Perception}}  {{Drek=N$[[0]] & A$[[1]] & D$[[2]] }} {{Kalor=N$[[3]] & A$[[4]] & D$[[5]] }} If you find that a bit combersome, it really is no harder to use the first version of what Jarred supplied (referencing the character attribute each time separately), and that side-steps the problem of having to index the rolls to the right characters. Metascript Alternative As an alternative, if you don't mind multiple outputs at once, you could use metascripts to output a template of info for each character, and dynamically select the ones you want. !forselected(^) /w gm {&template:default} {{name=Passive Perception}}  {{@^(selected.token_name)=N[^[^@^(selected.passive_wisdom)^]^] & A[^[^@^(selected.passive_wisdom)+5^]^] & D[^[^@^(selected.passive_wisdom)-5^]^] }} {^&simple} That's the basic command, then you'd want a {&select} statement that would get the ones you want. You could hard code it: {&select Drek Latefang, Kalor EarlyFang} ...or, once v.1.1.0 of SelectManager is merged into the one-click (been waiting for 3 weeks),  you can select player characters (who have a representative token on the current page) using: {&select *, +pc} Making the final command: !forselected(^) /w gm {&template:default} {{name=Passive Perception}}  {{@^(selected.token_name)=N[^[^@^(selected.passive_wisdom)^]^] & A[^[^@^(selected.passive_wisdom)+5^]^] & D[^[^@^(selected.passive_wisdom)-5^]^] }} {^&simple}  {&select *, +pc} REQUIRED SCRIPTS: ZeroFrame, Fetch, SelectManager (v1.1.0)
James H. said: That second one is great, is there a way to add multiple sheets though, so it displays the N,A & D values for different character sheets named before hand? Yes, but it gets pretty ugly and more difficult to figure out which roll to reference the longer it gets. /w gm &{template:default} [[ [[ [[@{Drek Latefang|passive_wisdom}]] +5 ]] - 10 ]] [[ [[ [[@{CHARACTERNAME2|passive_wisdom}]] +5 ]] - 10 ]] [[ [[ [[@{CHARACTERNAME3|passive_wisdom}]] +5 ]] - 10 ]] {{name=Passive Perception}}  {{Drek=N$[[0]] & A$[[1]] & D$[[2]] }} {{CHARACTERNAME2=N$[[3]] & A$[[4]] & D$[[5]] }}  {{CHARACTERNAME3=N$[[6]] & A$[[7]] & D$[[8]] }}  At some point, the roll references will get out of order.  Why/how that happens is a mystery to me, and the only way to fix it is by trial and error - putting in specific numbers to characters passive_wisdom scores, and listing out all of the roll references, then putting them into the macro in the correct order. If you simply want a list of each character's passive perception scores showing advantage and disadvantage, there's other ways to accomplish that, and can have a nicer output. If you're playing D&D 5th Edition, you may be interested in using a Statblock Macro Mule .
Jarren said: If you simply want a list of each character's passive perception scores showing advantage and disadvantage, there's other ways to accomplish that, and can have a nicer output. That is indeed exactly what i am after, we have a game where the charcters are different each game and different GMs. I wanted a way to set up a macro easily before each game (changing the names) so that when the GM needs it they cna just press the macro and have the passive scores whispered to them.
1692898287
GiGs
Pro
Sheet Author
API Scripter
James H. said: That is indeed exactly what i am after, we have a game where the charcters are different each game and different GMs. I wanted a way to set up a macro easily before each game (changing the names) so that when the GM needs it they cna just press the macro and have the passive scores whispered to them. You'll probably need a Script-based solution for that.
If you have access to Mod scripts in your game, then that will be the cleanest way to get what you are looking for. However, h ere's a simple option I can offer. There's a little bit of setup, but it's all just cutting and pasting and it will work for a free Roll20 subscription (and using the D&D 5E by Roll20 character sheet 'npcaction' roll template): 1. Create a character named 'CharacterNames'. 2. On the Attributes & Abilities page of CharacterNames, create several Attributes:  4. Create an Attribute named 'At' with this code: @{ 5. Create Attributes named Char1, Char2, Char3, etc. (for as many characters as you have in the game). Put the character names of each character in the 'current' value of Char1, Char2, etc. 6. Create an Ability on CharacterNames called 'PartyPerception' with this code: /w gm &{template:npcaction} &{noerror} {{rname=Party Perception}} {{description=@{CharacterNames|Char1}: [[@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom}[Normal]]](N) [[[[0@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom} + 5]][Advantage]]](A) [[[[0@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom} - 5]][Disadvantage]]](D)  @{CharacterNames|Char2}: [[@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom}[Normal]]](N) [[[[0@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom} + 5]][Advantage]]](A) [[[[0@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom} - 5]][Disadvantage]]](D)  @{CharacterNames|Char3}: [[@{CharacterNames|at}@{CharacterNames|Char3}|passive_wisdom}[Normal]]](N) [[[[0@{CharacterNames|at}@{CharacterNames|Char3}|passive_wisdom} + 5]][Advantage]]](A) [[[[0@{CharacterNames|at}@{CharacterNames|Char3}|passive_wisdom} - 5]][Disadvantage]]](D)  @{CharacterNames|Char4}: [[@{CharacterNames|at}@{CharacterNames|Char4}|passive_wisdom}[Normal]]](N) [[[[0@{CharacterNames|at}@{CharacterNames|Char4}|passive_wisdom} + 5]][Advantage]]](A) [[[[0@{CharacterNames|at}@{CharacterNames|Char4}|passive_wisdom} - 5]][Disadvantage]]](D)  @{CharacterNames|Char5}: [[@{CharacterNames|at}@{CharacterNames|Char5}|passive_wisdom}[Normal]]](N) [[[[0@{CharacterNames|at}@{CharacterNames|Char5}|passive_wisdom} + 5]][Advantage]]](A) [[[[0@{CharacterNames|at}@{CharacterNames|Char5}|passive_wisdom} - 5]][Disadvantage]]](D) }} 7. Adjust the number of entries in the PartyPerception Ability to match the number of characters you have. 8. Create a Collection Macro with this code to display all of the character's Passive Perception scores: %{CharacterNames|PartyPerception} &{noerror} 9. Whenever you have new characters, simply update Char1, Char2, etc. with the new character names. If you create a brand new game each time, then you'll have to import the CharacterNames character or recreate it each time. I can make a more robust version as well that would be a single macro to include any number of characters, and only show their stats if there is a corresponding Char# attribute created for them, so it would be a bit more dynamic.
Jarren said: If you have access to Mod scripts in your game, then that will be the cleanest way to get what you are looking for. However, h ere's a simple option I can offer. There's a little bit of setup, but it's all just cutting and pasting and it will work for a free Roll20 subscription (and using the D&D 5E by Roll20 character sheet 'npcaction' roll template): This works, but it looks a bit off. Anyway to fix this?
Okay nevermind, i just put an empty line between the names and it looks much better xD Okay second question which is pretty big. Is there a way to do this, but also have it roll said passive perception, so if someone had say 22 passive perception, it would roll 1d20+6 as the modifier for 22 is 6?
James H. said: This works, but it looks a bit off. Anyway to fix this? Ah, mine looks better because I'm using the Stylus browser extension to widen the 'npcaction' template in the chat, using this code here . I really don't understand why the D&D 5E sheet uses such narrow templates ( and I made a suggestion in the official thread about 6 months ago to widen them ). The only way to fix them for you is to either use Stylus like I do, or to reduce the amount of text that is taking up space in the macro. Perhaps simply removing the ( ) will be enough. Or maybe remove the spaces between the values and just insert vertical pipes '|' between them instead. Lastly you could switch back to the 'default' template which does not shorten the width of the roll templates: /w gm &{template:default} &{noerror} {{name=Party Perception}} {{@{CharacterNames|Char1}: [[@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom}[Normal]]](N) [[[[0@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom} + 5]][Advantage]]](A) [[[[0@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom} - 5]][Disadvantage]]](D)}}} {{@{CharacterNames|Char2}: [[@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom}[Normal]]](N) [[[[0@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom} + 5]][Advantage]]](A) [[[[0@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom} - 5]][Disadvantage]]](D) }}
James H. said: Okay nevermind, i just put an empty line between the names and it looks much better xD Okay second question which is pretty big. Is there a way to do this, but also have it roll said passive perception, so if someone had say 22 passive perception, it would roll 1d20+6 as the modifier for 22 is 6? Just FYI, that's not how RAW passive checks work. It looks like your confusing Ability Scores and Modifiers. If a character has a 22 Passive Perception, then they have a +12 bonus to Perception checks, which can come from a variety of sources.  First is their Wisdom Modifier (+0 for a 10 Wisdom score to +5 for a 20 Wisdom score); if they are Proficient in Perception checks they add their Proficiency Bonus is (+2 at level 1 to +6 at level 17), then whatever else may increase their Perception (such as the Observant Feat, which grants +5 to Perception checks, or magic items, spells, etc.).  So a Passive Perception check is basically just assuming that they are rolling a 10 on a 1d20, and then adding any bonuses.  If a character has a PP of 22, then they would be able to roll between 13 and 32. Some DM's rule that any roll that is lower than a 10 counts as a 10 (or it's usually phrased as 'you can't roll lower than your Passive Perception'). That's the entire reason for adding the +5 or -5 for Advantage and Disadvantage on Passive checks: +/-5 is roughly the average adjustment that Advantage or Disadvantage grants on rolls (it gets skewed with higher/lower bonuses to the roll). So according to RAW, you never roll Passive  Perception. That is what the character is assumed to be doing all the time.  But if they were to actively search around, then they would make a Perception (Wisdom) check. But if you want some homebrew variant to make a roll for Passive Perception, and add the modifiers in some specific way, let me know and it's probably possible.
Jarren said: James H. said: Okay nevermind, i just put an empty line between the names and it looks much better xD Okay second question which is pretty big. Is there a way to do this, but also have it roll said passive perception, so if someone had say 22 passive perception, it would roll 1d20+6 as the modifier for 22 is 6? Just FYI, that's not how RAW passive checks work. It looks like your confusing Ability Scores and Modifiers. If a character has a 22 Passive Perception, then they have a +12 bonus to Perception checks, which can come from a variety of sources.  First is their Wisdom Modifier (+0 for a 10 Wisdom score to +5 for a 20 Wisdom score); if they are Proficient in Perception checks they add their Proficiency Bonus is (+2 at level 1 to +6 at level 17), then whatever else may increase their Perception (such as the Observant Feat, which grants +5 to Perception checks, or magic items, spells, etc.).  So a Passive Perception check is basically just assuming that they are rolling a 10 on a 1d20, and then adding any bonuses.  If a character has a PP of 22, then they would be able to roll between 13 and 32. Some DM's rule that any roll that is lower than a 10 counts as a 10 (or it's usually phrased as 'you can't roll lower than your Passive Perception'). That's the entire reason for adding the +5 or -5 for Advantage and Disadvantage on Passive checks: +/-5 is roughly the average adjustment that Advantage or Disadvantage grants on rolls (it gets skewed with higher/lower bonuses to the roll). So according to RAW, you never roll Passive  Perception. That is what the character is assumed to be doing all the time.  But if they were to actively search around, then they would make a Perception (Wisdom) check. But if you want some homebrew variant to make a roll for Passive Perception, and add the modifiers in some specific way, let me know and it's probably possible. Yes sorry I should have been more specific, I know how it works normaly, we may have been playing a lot og BG3 lately and the idea of rolling passive checks has apealed to us a little xD Now it would be simple enough to just secretly roll peoples perception scores, which may be the best option, but some people have advantage, some have disadvantage, some have magic items that give a small bonus etc. So somehow rolling the passive perception would have been helpful. Would it work to do 1d20+passive-10 ?
James H. said: Yes sorry I should have been more specific, I know how it works normaly, we may have been playing a lot og BG3 lately and the idea of rolling passive checks has apealed to us a little xD Now it would be simple enough to just secretly roll peoples perception scores, which may be the best option, but some people have advantage, some have disadvantage, some have magic items that give a small bonus etc. So somehow rolling the passive perception would have been helpful. Would it work to do 1d20+passive-10 ? It's homebrew so it can be whatever you want it to be. If you describe the mechanics that you're looking for - e.g. describe the roll that the same as how you would explain to a player in person rolling physical dice - then I'm sure someone can come up with the roll command in Roll20. I'm still a little confused about exactly what you're looking for when you say you want to roll for passive perception. And sadly I haven't had a chance to play BG3 yet, so I'm not sure what those mechanics look like either! Are you simply looking for some variance from the Passive Perception score? If that's the case then it should be possible to get a +/- 1d4 from the passive score so it's not static (just as an example). Is that the kind of thing you're looking for?
Jarren said: James H. said: Yes sorry I should have been more specific, I know how it works normaly, we may have been playing a lot og BG3 lately and the idea of rolling passive checks has apealed to us a little xD Now it would be simple enough to just secretly roll peoples perception scores, which may be the best option, but some people have advantage, some have disadvantage, some have magic items that give a small bonus etc. So somehow rolling the passive perception would have been helpful. Would it work to do 1d20+passive-10 ? It's homebrew so it can be whatever you want it to be. If you describe the mechanics that you're looking for - e.g. describe the roll that the same as how you would explain to a player in person rolling physical dice - then I'm sure someone can come up with the roll command in Roll20. I'm still a little confused about exactly what you're looking for when you say you want to roll for passive perception. And sadly I haven't had a chance to play BG3 yet, so I'm not sure what those mechanics look like either! Are you simply looking for some variance from the Passive Perception score? If that's the case then it should be possible to get a +/- 1d4 from the passive score so it's not static (just as an example). Is that the kind of thing you're looking for? I think right now, preferably, the best way would be is there a way to use the code you quite fnatasticaly made above, but replace the passive_wisdom with a d20+passive_wisdom-10 roll ?
James H.  said: I think right now, preferably, the best way would be is there a way to use the code you quite fnatasticaly made above, but replace the passive_wisdom with a d20+passive_wisdom-10 roll ? /w gm &{template:npcaction} &{noerror} {{rname=Party Perception}} {{description=@{CharacterNames|Char1}: [[0@{CharacterNames|at}@{CharacterNames|Char1}|d20}+0@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom}-10]] @{CharacterNames|Char2}: [[0@{CharacterNames|at}@{CharacterNames|Char2}|d20}+0@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom}-10]] @{CharacterNames|Char3}: [[0@{CharacterNames|at}@{CharacterNames|Char3}|d20}+0@{CharacterNames|at}@{CharacterNames|Char3}|passive_wisdom}-10]] @{CharacterNames|Char4}: [[0@{CharacterNames|at}@{CharacterNames|Char4}|d20}+0@{CharacterNames|at}@{CharacterNames|Char4}|passive_wisdom}-10]] @{CharacterNames|Char5}: [[0@{CharacterNames|at}@{CharacterNames|Char5}|d20}+0@{CharacterNames|at}@{CharacterNames|Char5}|passive_wisdom}-10]]}}
Jarren said: James H.  said: I think right now, preferably, the best way would be is there a way to use the code you quite fnatasticaly made above, but replace the passive_wisdom with a d20+passive_wisdom-10 roll ? /w gm &{template:npcaction} &{noerror} {{rname=Party Perception}} {{description=@{CharacterNames|Char1}: [[0@{CharacterNames|at}@{CharacterNames|Char1}|d20}+0@{CharacterNames|at}@{CharacterNames|Char1}|passive_wisdom}-10]] @{CharacterNames|Char2}: [[0@{CharacterNames|at}@{CharacterNames|Char2}|d20}+0@{CharacterNames|at}@{CharacterNames|Char2}|passive_wisdom}-10]] @{CharacterNames|Char3}: [[0@{CharacterNames|at}@{CharacterNames|Char3}|d20}+0@{CharacterNames|at}@{CharacterNames|Char3}|passive_wisdom}-10]] @{CharacterNames|Char4}: [[0@{CharacterNames|at}@{CharacterNames|Char4}|d20}+0@{CharacterNames|at}@{CharacterNames|Char4}|passive_wisdom}-10]] @{CharacterNames|Char5}: [[0@{CharacterNames|at}@{CharacterNames|Char5}|d20}+0@{CharacterNames|at}@{CharacterNames|Char5}|passive_wisdom}-10]]}} This is perfect, thankyou so much.