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

Macro still refering to different sheet:

1719477588

Edited 1719477975
Hi there, I'm trying to play Mr. Potato with some macros, but I've stumbled upon something I totally can't understand: I'm trying to create a macro that rolls 3d20 and scores a crit on a 19. So far, so good. But then I have trouble linking it to the right sheet to have the macro "read" the global damage modifier. I'll give you an example: I have created a level 1 character named Test1 and added a fake "rage" button for testing in the global damage modifier. So far, so good. When it's toggled on, it sends the value to the macro and it shows up with no problem. When I uncheck it, it doesn't send anything, and life is beautiful. @{Test1|wtype}&{template:atk} {{mod=1}} {{rname=[Javelin](~-881958124_7626266|repeating_attack_-O-iI1qZOaLTgYozPZmA_attack_dmg)}} {{rnamec=[Javelin](~-881958124_7626266|repeating_attack_-O-iI1qZOaLTgYozPZmA_attack_crit)}} {{r1=[[{3d20cs>19}kh1 + -1[STR] + 2[PROF]]]}} @{Test1|rtype}cs>19 + -1[STR] + 2[PROF]}} {{range=30/120}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{Test1|global_attack_mod}}} ammo= @{Test1|charname_output} Then I tried to change every instance of the character Test1, substitute it with AA, and tried to see if the macro would take the global damage modifier from that sheet, but no... it still takes it from Test1 even if it isn't named in this macro. @{AA|wtype}&{template:atk} {{mod=1}} {{rname=[Javelin](~-881958124_7626266|repeating_attack_-O-iI1qZOaLTgYozPZmA_attack_dmg)}} {{rnamec=[Javelin](~-881958124_7626266|repeating_attack_-O-iI1qZOaLTgYozPZmA_attack_crit)}} {{r1=[[{3d20cs>19}kh1 + -1[STR] + 2[PROF]]]}} @{AA|rtype}cs>19 + -1[STR] + 2[PROF]}} {{range=30/120}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{AA|global_attack_mod}}} ammo= @{AA|charname_output} I know that many things will need to change (for example, strength bonuses and so on), but I just wanted to change the sheet where the global damage modifier is taken from for the macro, but it seems I can't. Where in this code is the sorcery that makes the macro aware of a sheet whose name isn't in the macro? Thanks, folks! Where does this come from? I'm running a Bladesinger/Psi Warrior, and since I have Elven Accuracy and a homebrewed weapon that crits on a 19, I wanted to create my macro accordingly. Unfortunately, no matter how I try, I seem unable to make the macro pull data from its sheet.
Leontius Leunastar said: Where in this code is the sorcery that makes the macro aware of a sheet whose name isn't in the macro? Thanks, folks! Where does this come from? I'm running a Bladesinger/Psi Warrior, and since I have Elven Accuracy and a homebrewed weapon that crits on a 19, I wanted to create my macro accordingly. Unfortunately, no matter how I try, I seem unable to make the macro pull data from its sheet. This part here: (~ -881958124_7626266 |repeating_attack_ -O-iI1qZOaLTgYozPZmA _attack_dmg) (~ -881958124_7626266 |repeating_attack_ -O-iI1qZOaLTgYozPZmA _attack_crit) Those refer to specific repeating attacks on a specific character. -881958124_7626266 is the character reference - this is the same as typing 'Test1' -O-iI1qZOaLTgYozPZmA is the attack reference  - this is the same as typing the number that the attack is listed in the character's Attacks & Spellcasting section.  Try this: @{AA|wtype}&{template:atk} {{mod=1}} {{rname=[@{AA|repeating_attack_$0_atkname}](~AA|repeating_attack_$0_attack_dmg)}} {{rnamec=[Javelin](~AA|repeating_attack_$0_attack_crit)}} {{r1=[[{3d20cs>19}kh1 + -1[STR] + 2[PROF]]]}} @{AA|rtype}cs>19 + -1[STR] + 2[PROF]}} {{range=30/120}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{AA|global_attack_mod}}} ammo= @{AA|charname_output} You may have to change each instance of $0 to a higher number to reference the correct repeating attack.  (Change $0 to $1, then $2, etc.)
1719485524

Edited 1719486098
Jarren said: Leontius Leunastar said: Where in this code is the sorcery that makes the macro aware of a sheet whose name isn't in the macro? Thanks, folks! Where does this come from? I'm running a Bladesinger/Psi Warrior, and since I have Elven Accuracy and a homebrewed weapon that crits on a 19, I wanted to create my macro accordingly. Unfortunately, no matter how I try, I seem unable to make the macro pull data from its sheet. This part here: (~ -881958124_7626266 |repeating_attack_ -O-iI1qZOaLTgYozPZmA _attack_dmg) (~ -881958124_7626266 |repeating_attack_ -O-iI1qZOaLTgYozPZmA _attack_crit) Those refer to specific repeating attacks on a specific character. -881958124_7626266 is the character reference - this is the same as typing 'Test1' -O-iI1qZOaLTgYozPZmA is the attack reference  - this is the same as typing the number that the attack is listed in the character's Attacks & Spellcasting section.  Try this: @{AA|wtype}&{template:atk} {{mod=1}} {{rname=[@{AA|repeating_attack_$0_atkname}](~AA|repeating_attack_$0_attack_dmg)}} {{rnamec=[Javelin](~AA|repeating_attack_$0_attack_crit)}} {{r1=[[{3d20cs>19}kh1 + -1[STR] + 2[PROF]]]}} @{AA|rtype}cs>19 + -1[STR] + 2[PROF]}} {{range=30/120}} {{desc=}} {{spelllevel=}} {{innate=}} {{globalattack=@{AA|global_attack_mod}}} ammo= @{AA|charname_output} You may have to change each instance of $0 to a higher number to reference the correct repeating attack.  (Change $0 to $1, then $2, etc.) You are the man! Works like a charm! Thx Bud, Now i guess i can also use "Selected" in order to avoid Name problems. I have another question tho. Now that i have linked to the right sheet another problem occurred. I have used the sheet for several build variations and i often started from scratches. now the problem is that when the macro is linked it's using also Damage modiifiers that aren't on the sheet anymore such as: Poisoner, smite, sneak and so on, yes, i have created a character wit all those things but then restarted. Is there a eway i can purge All the unwanted Damage modifiers that are applied even if they are not on the sheet anymore? Also, how do i get to know the character reference of other sheets? Don't want to take advantage of ur time/kindness, feel free to skip!
Leontius Leunastar said: I have another question tho. Now that i have linked to the right sheet another problem occurred. I have used the sheet for several build variations and i often started from scratches. now the problem is that when the macro is linked it's using also Damage modiifiers that aren't on the sheet anymore such as: Poisoner, smite, sneak and so on, yes, i have created a character wit all those things but then restarted. Is there a eway i can purge All the unwanted Damage modifiers that are applied even if they are not on the sheet anymore? Also, how do i get to know the character reference of other sheets? I’m not 100% sure I understand.  What is the exact macro you are using?  Are you using Global Damage modifiers? Can you post a screenshot of the character sheet ‘Core’ tab and ‘Settings’ tab? (I want to see the Attacks & Spellcasting section and the global Damage Modifier section; and the right column of the Settings tab.) And a screenshot of the output in the chat window, with your mouse hovered over to show the tooltip?  Do you have more than one character with the same name? 
1719489588

Edited 1719490177
Jarren said: Leontius Leunastar said: I have another question tho. Now that i have linked to the right sheet another problem occurred. I have used the sheet for several build variations and i often started from scratches. now the problem is that when the macro is linked it's using also Damage modiifiers that aren't on the sheet anymore such as: Poisoner, smite, sneak and so on, yes, i have created a character wit all those things but then restarted. Is there a eway i can purge All the unwanted Damage modifiers that are applied even if they are not on the sheet anymore? Also, how do i get to know the character reference of other sheets? I’m not 100% sure I understand.  What is the exact macro you are using?  Are you using Global Damage modifiers? Can you post a screenshot of the character sheet ‘Core’ tab and ‘Settings’ tab? (I want to see the Attacks & Spellcasting section and the global Damage Modifier section; and the right column of the Settings tab.) And a screenshot of the output in the chat window, with your mouse hovered over to show the tooltip?  Do you have more than one character with the same name?  Ok, I'll start from scratch to make my reasoning clearer. One problem I mentioned (multiple non-existing global damage) was due to two characters having the same name, which is now sorted. Here's what I'm trying to do: I'm playing a bladesinger with Elven Accuracy, dual-wielding, and one weapon crits on a 19-20. I initially used the macro {{r1=[[{3d20cs>19}kh1 to handle the crits. Unfortunately, this requires creating a separate macro button for each weapon and manually updating all the stats and bonuses. I need a way to automatically pull this data from a specific character sheet, which led to my original question. On the big shcheme i'll need one way to handle those crits and also to create a different macro/method that let's me roll my con saves adding the Int save when Bladesong is active While waiting for advice, I found a different approach. I added this line to my Character Rtype: {{query=1}} ?{Advantage?|Normal Roll,{{normal=1}} {{r2=[[0d20|Super Advantage,{{advantage=1}} {{r2=[[2d20cs>20kh1|Advantage,{{advantage=1}} {{r2=[[@{d20}|Disadvantage,{{disadvantage=1}} {{r2=[[@{d20}} 3d20cs>20}kh1 since i can easely change crit range of the single weapons it seemed good to me. This seemed promising since I was frustrated with creating multiple macros. Now, when I roll, everything works great, including all damage and attack modifiers. Can't express how grateful i am bro! However, this string seems to add 2d20 to get the result of the second roll, and the macro doesn't work as it should (see photo). Roll on the left seems legit: Roll on the right seems like a mess: Sorry for changing my approach. Any advice on the best solution or coding tips would be greatly appreciated. Which solution in ur personal experience is better, easier, or less time-consuming?
1719493168

Edited 1719493193
Leontius Leunastar said: Ok, I'll start from scratch to make my reasoning clearer. One problem I mentioned (multiple non-existing global damage) was due to two characters having the same name, which is now sorted. Great! I had a feeling that might be a potential cause.  It happens often enough that when I see someone say anything about getting the wrong numbers, I always recommend checking for duplicate names. :)  While waiting for advice, I found a different approach. I added this line to my Character Rtype: {{query=1}} ?{Advantage?|Normal Roll,{{normal=1}} {{r2=[[0d20|Super Advantage,{{advantage=1}} {{r2=[[2d20cs>20kh1|Advantage,{{advantage=1}} {{r2=[[@{d20}|Disadvantage,{{disadvantage=1}} {{r2=[[@{d20}} 3d20cs>20}kh1 since i can easely change crit range of the single weapons it seemed good to me. However, this string seems to add 2d20 to get the result of the second roll, and the macro doesn't work as it should (see photo). Sorry for changing my approach. Any advice on the best solution or coding tips would be greatly appreciated. Which solution in ur personal experience is better, easier, or less time-consuming? Changing either the 'rtype' or 'queryadvantage' attribute is likely the best approach, but I'm not sure where you got that code from, and it's not correct.  Try this instead: {{query=1}} ?{Advantage?|Normal Roll,{{normal=1}} {{r2=[[0d20|Advantage,{{advantage=1}} {{r2=[[@{d20}|ElvenAccuracy,{{advantage=1}} {{r2=[[2d20k1|Disadvantage,{{disadvantage=1}} {{r2=[[@{d20}} A roll choosing Elven Accuracy will look like this: The R1 roll is a single 1d20, and it's compared against the R2 roll which is a 2d20k1 (roll 2 d20 dice and keep the higher one).  Whichever roll (R1 or R2) is higher will be shown in black.
1719496222

Edited 1719496233
timmaugh
Forum Champion
API Scripter
Just to point out in Jarren's excellent suggestion, he's using HTML replacements in your query. Basically, if certain characters are in the text of your query labels or values, those characters will advance the parser examining the query -- moving it to a new part. Commas advance the parser from label to value; vertical pipes advance from query option to query option; and the first right-brace encountered will end/close the query. So if any of these characters appear in the query choices, you have to use their HTML alternative. You can see how Jarren used the HTML encoding of } for the right braces in passages like: {{normal=1}} Without those kinds of fixes, your query was closing early, which was the likely cause of the "weirdness" you saw. Now, on a different note... if you start to use "selected"... then you might want to look at the metascript toolbox. With that, you can "virtually" select your token (without having to *actually* select the token on the VTT), just by turning your command into a script message (starting with a bang) and adding a formation like this (for a character named "Leontius") to your command line: {&select Leontius} {&simple} Or you could, if you had a set of characters that might need to use this command line, put a query of the characters in that {&select} tag. Then, you could make a query selection of the character rather than having to locate them on the VTT: {&select ?{Which character|Leontius|Begariath|Mephippipilo|Bob} } Of course, if you do that, then they might not have the same repeating attribute in the same place (not sure if you're still referencing repeating attributes in your final command line). In that case, the toolbox can help get the right item (for instance, identifying the attack that is named "Flame Tongue Rapier"). If you got that route, post back with more info about your command line and I can help rejigger it.
Aww lads!  Jarren  &  timmaugh  worked wonderfully. thank you so much. world is beautiful, full of knowledge and full of kind people like yourselves! Kudos to all of ye!