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

APILogic Escape issue when processing fields with line breaks and Parenthesis

So, I'm making some pretty extensive use of APILogic in my Star Wars game.  (Character Sheet Template: Star Wars Saga Edition) I have a macro that, among other things, looks at the Feats field in the Character Sheet to see if it should display something.  Here is the relevant snippet of code from the Macro: {& if (@{selected|Feats} ~ "Burst Fire")}[Burst Fire](`#Weapon-1-BurstFire){& end} Here are the full contents of the Feats field: Armor Proficiency (Light) Armor Proficiency (Medium) Weapon Proficiency (Advanced Melee Weapons) Weapon Proficiency (Pistols) Weapon Proficiency (Rifles) Weapon Proficiency (Simple Weapons) Weapon Focus(Rifles) Weapon Proficiency (Heavy) Burst-fire Here is a screencap of what ends up in the Chat Window if the Character Sheet has the Burst Fire feat is listed : (Pay no attention to the Burst-fire part...that was my player screwing with me when I was trying to get screenshots.  I tested it with correct entries before and after.) As you can see, APILogic causes  some  of the contents of the Feats field to be printed...but here is the weird part: If the contents of the Feats field are shorter (aka, not as much stuff listed), APILogic still displays the Burst Fire macro link, but it does NOT print out the Feat List.  Here is a screenshot of the same stuff from a  different character : On this character, the Feats field does  not  have the Burst Fire entry, but the link still shows...at least it doesn't show all of the feats though. Here is a third character sheet, without the Burst Fire entry, but still showing some of the feats: I know this is a super-weird issue.  Hopefully someone can help me get it squared away.
1767661292
timmaugh
Forum Champion
API Scripter
Hey, Michael! I don't think the line breaks should be causing a problem, but the parentheses are a different story. The easiest fix is to enclose the contents of the Feats attribute retrieval in quotation marks: {& if ("@{selected|Feats}" ~ "Burst Fire")} My quick/dirty testing, here, shows that that works. If it doesn't work for you, post back. There's another thing we can do by involving the Plugger script, but just using quotation marks is much simpler if it works!
The quote marks did it.  I can't believe it was something so simple. Thank you!