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

Global Drop Down Referencing Character Macros

1606183756

Edited 1606185265
Hello, I have created a global drop down prompt that I am trying to reference a character's macros. The two macros look like this. test1-2 &{template:default}}{{Spell Levels=[Lvl:0-1](!
%{Bartuc Vizjerei|0-1})}} test2-3 [[3d6]] test Global Macro /w Bartuc ?{Select macro|[test1-2],%{Bartuc Vizjerei|test1-2}|test2-3,%{Bartuc Vizjerei|test2-3}} Issue: When I select either option it whispers to me "%{Bartuc Vizjerei|test2-3}" I'm guessing I have either an html entity misplaced here or I have something missing. This is quite maddening because if I just copy and paste "%{Bartuc Vizjerei|test1-2}" into the chat, it references the macro in my character sheet just fine. I would greatly appreciate any help. Thanks for your time, Blood-Lord
1606187027

Edited 1606187096
Oosh
Sheet Author
API Scripter
You never replace HTML in Ability or Attribute calls , as they are resolved before the Queries. You first example there also has an API command button, the syntax should be like this: [Button](~characterName|abilityName) After fixing up those two issues, you're likely to hit the next one, in that all the } | , characters inside those Ability macros will need to be escaped if you don't want the Query to break. If you're going for a spell list, as it appears, I'd highly recommend using a Chat Menu , trying to get those into a drop-down will require rewriting every single one into an HTML-escaped form which will not work unless it's run from the exact Query depth it's designed for.
Oosh said: If you're going for a spell list, as it appears, I'd highly recommend using a Chat Menu , trying to get those into a drop-down will require rewriting every single one into an HTML-escaped form which will not work unless it's run from the exact Query depth it's designed for. This looks like it requires API access and adjusting the CSS style of the client's page. I'm not really interested in subscribing to PRO. I'll work on this for the next week or so. I should be able to get it to work. Thanks for your help!
1606227850
Kraynic
Pro
Sheet Author
Blood L. said: This looks like it requires API access and adjusting the CSS style of the client's page. I'm not really interested in subscribing to PRO. I'll work on this for the next week or so. I should be able to get it to work. Thanks for your help! It is easier with a pro account, since some scripts will help generate the chat menus, but creating and using them manually doesn't require a subscription at all.
1606353451

Edited 1606354279
Oosh
Sheet Author
API Scripter
edit - whoops, just realised I've assumed the 5e Roll20 sheet. The repeating section names will be wrong if you're using another sheet. Nope, no Pro required! And you can even skip the whole Stylus/CSS thing with some (rather ugly) style injection: &{noerror} &{template:default}{{name=Spellbook}}{{Cantrips=[@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-cantrip_$0_spellname|max}) [@{selected|repeating_spell-cantrip_$1_spellname}](~selected|repeating_spell-cantrip_$1_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-cantrip_$1_spellname|max}) [@{selected|repeating_spell-cantrip_$2_spellname} ](~selected|repeating_spell-cantrip_$2_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-cantrip_$2_spellname|max}) [@{selected|repeating_spell-cantrip_$3_spellname}](~selected|repeating_spell-cantrip_$3_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-cantrip_$3_spellname|max})}} {{Level 1 @{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total} Slots=[@{selected|repeating_spell-1_$0_spellname}](~selected|repeating_spell-1_$0_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-1_$0_spellname|max}) [@{selected|repeating_spell-1_$1_spellname}](~selected|repeating_spell-1_$1_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-1_$1_spellname|max}) [@{selected|repeating_spell-1_$2_spellname} ](~selected|repeating_spell-1_$2_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-1_$2_spellname|max}) [@{selected|repeating_spell-1_$3_spellname}](~selected|repeating_spell-1_$3_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-1_$3_spellname|max})}}{{Level 2 @{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total} Slots=[@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-2_$0_spellname|max}) [@{selected|repeating_spell-2_$1_spellname}](~selected|repeating_spell-2_$1_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-2_$1_spellname|max}) [@{selected|repeating_spell-2_$2_spellname} ](~selected|repeating_spell-2_$2_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-2_$2_spellname|max}) [@{selected|repeating_spell-2_$3_spellname}](~selected|repeating_spell-2_$3_spell" style="background:none;border:none;color:blue;display:none;display:inline@{selected|repeating_spell-2_$3_spellname|max})}} Just an example with 4 spells per tier, you'd probably want to increase that. And you can pretty it up, and remove blank lines, using Stylus if you prefer. Also, you probably want to put a /w "@{selected|character_name}" at the start, or just hard code it with /w "playerName". If it's for a player, I'd also do a Replace All and change selected to the character name, so you don't have the annoyance of the macro not working if your token isn't selected. If you only want to display prepared spells, that definitely requires Stylus (so only works for the person running the Stylus changes).
You can make the style injection a bit simpler as well by using this Stupid Trick : 1. Create a character named 'Style' 2. On the Attributes & Abilities page of the character sheet, create an ability named 'Spellbook' 3. In the 'current' field for the 'Spellbook' ability, paste the entire final code you want to use style="background:none;border:none;color:blue;display:none;display:inline 4. In whichever macros you want to include the CSS style, just use this code @{Style|Spellbook} For example, your code above would look like this: &{noerror} &{template:default}{{name=Spellbook}}{{Cantrips=[@{selected|repeating_spell-cantrip_$0_spellname}](~selected|repeating_spell-cantrip_$0_spell" @{Style|Spellbook}@{selected|repeating_spell-cantrip_$0_spellname|max}) [@{selected|repeating_spell-cantrip_$1_spellname}](~selected|repeating_spell-cantrip_$1_spell" @{Style|Spellbook}@{selected|repeating_spell-cantrip_$1_spellname|max}) [@{selected|repeating_spell-cantrip_$2_spellname} ](~selected|repeating_spell-cantrip_$2_spell" @{Style|Spellbook}@{selected|repeating_spell-cantrip_$2_spellname|max}) [@{selected|repeating_spell-cantrip_$3_spellname}](~selected|repeating_spell-cantrip_$3_spell" @{Style|Spellbook}@{selected|repeating_spell-cantrip_$3_spellname|max})}} {{Level 1 @{selected|lvl1_slots_expended}/@{selected|lvl1_slots_total} Slots=[@{selected|repeating_spell-1_$0_spellname}](~selected|repeating_spell-1_$0_spell" @{Style|Spellbook}@{selected|repeating_spell-1_$0_spellname|max}) [@{selected|repeating_spell-1_$1_spellname}](~selected|repeating_spell-1_$1_spell" @{Style|Spellbook}@{selected|repeating_spell-1_$1_spellname|max}) [@{selected|repeating_spell-1_$2_spellname} ](~selected|repeating_spell-1_$2_spell" @{Style|Spellbook}@{selected|repeating_spell-1_$2_spellname|max}) [@{selected|repeating_spell-1_$3_spellname}](~selected|repeating_spell-1_$3_spell" @{Style|Spellbook}@{selected|repeating_spell-1_$3_spellname|max})}}{{Level 2 @{selected|lvl2_slots_expended}/@{selected|lvl2_slots_total} Slots=[@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell" @{Style|Spellbook}@{selected|repeating_spell-2_$0_spellname|max}) [@{selected|repeating_spell-2_$1_spellname}](~selected|repeating_spell-2_$1_spell" @{Style|Spellbook}@{selected|repeating_spell-2_$1_spellname|max}) [@{selected|repeating_spell-2_$2_spellname} ](~selected|repeating_spell-2_$2_spell" @{Style|Spellbook}@{selected|repeating_spell-2_$2_spellname|max}) [@{selected|repeating_spell-2_$3_spellname}](~selected|repeating_spell-2_$3_spell" @{Style|Spellbook}@{selected|repeating_spell-2_$3_spellname|max})}} This is also nice because you can update ALL your macros to look the same, simply by modifying the 'Spellbook' ability on the Style character sheet.  If you decide that you want all the macros to be red, you just change the one piece of code and all future macro calls will be in red instead.