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

Troubleshooting a macro calling nested abilities

1562267597

Edited 1562269661
I am trying to create a spell book macro that I can give to players and npc's alike.  From what I've been able to figure out it shouldn't be that much different from giving them any other macro like attack or initiative rolls. This is the macro I currently have. &{template:default} {{name=**@{selected|character_name}'s** Spellbook}} {{[0-Level](! %{selected|0level})}} The called character ability. 0level (Double and triple checked that it is spelled the same way in the ability name and the macro that calls it.) 0 level pass "@{selected|character_name}" What should happen: 1) Select token 2) Click Spells token action 3) Spellbook macro is called 4) Click 0-level to call the ability 5) Receive the "0 level pass "@{selected|character_name}"" output as success clause. What does happen. Steps 1-4. Nothing happens after that.  I know that step 5 works when called from the tokens character sheet.  I know that the spellbook macro is pointing at the selected token because it's name is properly displaying in the default template's title. Why is step 5 not working and how do I make it work? *Edit Spelling, formatting, replacing erroneous ) with correct }*
1562267970
Ziechael
Forum Champion
Sheet Author
API Scripter
From what I can tell on a high level pass (on my phone so can't test), your button is calling something prefixed with a ! which will tell it to be an API command and therefore do nothing unless there is a script looking for that message. You need to follow the ! up with a html encoded return... can't think off the top of my head but it should be somewhere in the forums/wiki... failing that I'll add more info when I get home!
1562269953

Edited 1562269973
Thank you very much.  I was able to find the encoded return of & #13; (no space between the & and #) The now working line. &{template:default} {{name=**@{selected|character_name}'s** Spellbook}} {{[0-Level](!
%{selected|0level})}}
1562312236
Ziechael
Forum Champion
Sheet Author
API Scripter
Thats the one! Great stuff, glad you got it working :)
1562340040

Edited 1562340075
Just a note for future googler's who have this problem or a similar one. Just after I got it to work and was all happy and got a player in to play test it, it immediately stopped working.  I was able to track the cause down to Roll20 hates us and everything we stand for.  And also it ate the % so just replace that with the html escape code % as well and its all easy peasy lemon squeezy. Spellbook &{template:default}{{name=**@{selected|character_name}'s** Spellbook}}{{[0-Level](!
%{selected|0level})}} (PS:It's really not.  It's difficult difficult lemon difficult but stick with it and it's super worth it.)
1562350745

Edited 1562350796
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Rigel W. said: Just a note for future googler's who have this problem or a similar one. Just after I got it to work and was all happy and got a player in to play test it, it immediately stopped working.  I was able to track the cause down to Roll20 hates us and everything we stand for.  And also it ate the % so just replace that with the html escape code % as well and its all easy peasy lemon squeezy. Spellbook &{template:default}{{name=**@{selected|character_name}'s** Spellbook}}{{[0-Level](!
%{selected|0level})}} (PS:It's really not.  It's difficult difficult lemon difficult but stick with it and it's super worth it.) Yep, html encoded macros should NEVER be put in as a global macro under collections, the html encoding will be eaten if you ever reopen and resave the macro; use a macro mule  instead and/or find a way to not need the html encoding. In this case I'd recommend doing both. Instead of using an API command button , you can use the closely related  ability command button : Spellbook &{template:default}{{name=**@{selected|character_name}'s** Spellbook}}{{[0-Level](~selected|0level)}} I would still recommend using a macro mule though as then your ability call syntax is always the same; you don't need to sometimes use #macro-name and sometimes use %{some character|macro-name}. Hope that helps, Scott
That...  Is amazing. Shame we are forced to do it that way, but thank you for showing me an amazing workaround.