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

[5e OGL] Drop down macro comma causing problem. help

1515910998

Edited 1515911080
This is for the 5e OGL character sheet. I am working on a macro that would prompt with a question asking which trait I want to show. I can then select Trait 1, 2, 3, ect from a drop down and have it display the name and description. However, if a trait description has a comma in it, the macro breaks due to the drop down script. Is there a way I can get around this without having to go into the character sheet and remove or replace the commas? Here is a sample of The macro: /w gm &{template:default}{{name=@{selected|npc_name}}}?{Trait?|Trait1,{{rname=@{selected|repeating_npctrait_$0_name}}}{{description=@{selected|repeating_npctrait_$0_desc}}}|Trait2,{{rname=@{selected|repeating_npctrait_$1_name}}}{{description=@{selected|repeating_npctrait_$1_desc}}}} Alternatively, is there a macro that will display all traits on an NPC character sheet.
1515930526

Edited 1515930539
, is a comma if you can get the character escaped somehow.
Ya.I know the code to get commas. The problem is the comma is not in the script, its on the actual character sheet in the trait description. For instance on legendary resistance, "If a dragon fails its saving throw, it can instead choose to pass it" That comma in there is the problem. So I have a macro that is part of every new sheet I create. I would have to go into each creature's sheet and edit it with a special character or remove the character all together. I want to keep the process automated so that if I create a new creature on the fly everything is working without having to go in and change stuff.
1515967983
Silvyre
Forum Champion
Joseph T. said: Is there a way I can get around this without having to go into the character sheet and remove or replace the commas? Unfortunately not by using the current approach (nesting the traits within a Roll Query). Here is a macro that takes a different approach to work around this issue: &{template:npcatk} {{name=@{selected|npc_name}}} {{normal=1}} [[ {{r[[ ?{Trait|1|2|3|4} &{noerror} ]]=***@{selected|repeating_npctrait_$0_name}*** @{selected|repeating_npctrait_$0_desc} }} {{r[[ ?{Trait} - 1 ]]=***@{selected|repeating_npctrait_$1_name}*** @{selected|repeating_npctrait_$1_desc} }} {{r[[ ?{Trait} - 2 ]]=***@{selected|repeating_npctrait_$2_name}*** @{selected|repeating_npctrait_$2_desc} }} {{r[[ ?{Trait} - 3 ]]=***@{selected|repeating_npctrait_$3_name}*** @{selected|repeating_npctrait_$3_desc} }}
Silvyre said: Joseph T. said: Is there a way I can get around this without having to go into the character sheet and remove or replace the commas? Unfortunately not by using the current approach (nesting the traits within a Roll Query). Here is a macro that takes a different approach to work around this issue: &{template:npcatk} {{name=@{selected|npc_name}}} {{normal=1}} [[ {{r[[ ?{Trait|1|2|3|4} &{noerror} ]]=***@{selected|repeating_npctrait_$0_name}*** @{selected|repeating_npctrait_$0_desc} }} {{r[[ ?{Trait} - 1 ]]=***@{selected|repeating_npctrait_$1_name}*** @{selected|repeating_npctrait_$1_desc} }} {{r[[ ?{Trait} - 2 ]]=***@{selected|repeating_npctrait_$2_name}*** @{selected|repeating_npctrait_$2_desc} }} {{r[[ ?{Trait} - 3 ]]=***@{selected|repeating_npctrait_$3_name}*** @{selected|repeating_npctrait_$3_desc} }} Thanks Silvyre. I had not seen the {noerror} option before. This works great and cuts down on my clutter. I had taken an approach of creating buttons in the chat when I click on the macro and each button is linked to a macro for one trait. This is much cleaner though. I apperciate it.
Silvyre, So it seems with your suggestion here, if a creature does not have any traits or fewer than the 4 we used in this script, I will still receive errors when using the macro as those repeating rows do not exist, correct? I was hoping the {noerror} would resolve that. Currently I still get messages such as:  You tried to use the repeating section row at index 4 for repeating_npctrait, but there doesn't seem to be a row at that index. No attribute was found for @{selected|repeating_npctrait_$4_name} You tried to use the repeating section row at index 4 for repeating_npctrait, but there doesn't seem to be a row at that index.
So the mystery depends as I troubleshoot. I only get those errors if I use the token action button. If I actually open the character sheet and go to the macro and press the button from there it works fine. Even when I use the token action button, if a trait does exist I will get the errors but it will print the trait as it should. Super weird behavior.
1516044754
Silvyre
Forum Champion
Joseph T. said: So the mystery depends as I troubleshoot. I only get those errors if I use the token action button. If I actually open the character sheet and go to the macro and press the button from there it works fine. Even when I use the token action button, if a trait does exist I will get the errors but it will print the trait as it should. Super weird behavior. There are some discrepancies when using the "test macro" buttons, which the Dev Team is aware of. In the time being, I recommend against using them when testing macros; instead, call the macro or use its roll button.
1516045230

Edited 1516046379
Silvyre
Forum Champion
Unfortunately, in this case, it seems that using the "test macro" buttons (or directly pasting the macro into the Text Chat, which is the method I used when initially testing the macro before posting it) is the only way to get the &{noerror} flag to function as we'd like. (The Dev Team is also specifically aware of these interactions between &{noerror} and "test buttons" versus "roll buttons".)
1516046784

Edited 1516047378
Silvyre
Forum Champion
I have found a workaround to get the &{noerror} flag to work, however: Add a new Attribute (e.g. named "traits_macro")  Paste the macro into the value of this Attribute: Call the Attribute from within an Ability (or Macro): The &{noerror} flag should now fully function when that Ability is called (e.g. via clicking a Token Action button)
Very cool. Thank you!
1516118787
Silvyre
Forum Champion
You're very welcome!