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

Changing the spell buttons created by token action API

I find that having the actions players/NPC can take represented by token action buttons to be invaluable.  I use the "Token Action" API to auto generate these.  I then remove informational only items.  However, I have begun using a custom spell book API Nick Olivo created on his channel.  It scales spells by spell level and removes the appropriate spell slots.  More importantly the API can have other spells added as needed.  I would love to use the spell buttons created by "Token Action" API but replace the scale-able spells with references to the customspellbook functions. How does one change the following: @{selected|wtype}&{template:default}{{name=@{selected|character_name} Spells}}{{Cantrips=[@{selected|repeating_spell-cantrip_$0_spellname}] (~selected|repeating_spell-cantrip_$0_spell)[@{selected|repeating_spell-cantrip_$1_spellname}](~selected|repeating_spell-cantrip_$1_spell) [@{selected|repeating_spell-cantrip_$2_spellname}](~selected|repeating_spell-cantrip_$2_spell)}}{{1st Level (4 slots) =[@{selected|repeating_spell-1_$0_spellname}](~selected|repeating_spell-1_$0_spell)[@{selected|repeating_spell-1_$1_spellname}] (~selected|repeating_spell-1_$1_spell)[@{selected|repeating_spell-1_$2_spellname}](~selected|repeating_spell-1_$2_spell) [@{selected|repeating_spell-1_$3_spellname}](~selected|repeating_spell-1_$3_spell)[@{selected|repeating_spell-1_$4_spellname}] (~selected|repeating_spell-1_$4_spell)[@{selected|repeating_spell-1_$5_spellname}](~selected|repeating_spell-1_$5_spell) [@{selected|repeating_spell-1_$6_spellname}](~selected|repeating_spell-1_$6_spell)[@{selected|repeating_spell-1_$7_spellname}] (~selected|repeating_spell-1_$7_spell)}}{{2nd Level (2 slots)=[@{selected|repeating_spell-2_$0_spellname}](~selected|repeating_spell-2_$0_spell) [@{selected|repeating_spell-2_$1_spellname}](~selected|repeating_spell-2_$1_spell)[@{selected|repeating_spell-2_$2_spellname}] (~selected|repeating_spell-2_$2_spell)[@{selected|repeating_spell-2_$3_spellname}](~selected|repeating_spell-2_$3_spell)}} to instead use the spell referencing my customspellbook? I could create macros for every spell the player knows and create my own nested macros list, but that sounds tedious.  Is there a way to read the spells (like above), but have the actual spell name appear so you could change the appropriate snippet? Thanks,
1597777828
timmaugh
Pro
API Scripter
I have a script I should be releasing tomorrow that will do this exact thing for you, automatically. I'm actually done with the coding, but the script is *massive* so the help, example, and introductory post write-up is taking some time. Oh, and we're moving. But, if everything works out, tomorrow.
Sounds great.  I look forward to checking it out.  Just to be clear, it will list all the spells on a character sheet, but also will allow for substitution of spells I have put into my custom spell book or custom prayer API scripts (build from Nick Olivo's Magic Missile API script)?
1597794342
timmaugh
Pro
API Scripter
It's a "get this from here, filter for this, format it like that, sub it there... oh... and get this from here, filter it for this, format it like that, and spread the return here, here, here, and there..." type of script, so I don't see why not.
1597842765
David M.
Pro
API Scripter
timmaugh said: It's a "get this from here, filter for this, format it like that, sub it there... oh... and get this from here, filter it for this, format it like that, and spread the return here, here, here, and there..." type of script, so I don't see why not. Oh, is that all? ;)
1597858562
timmaugh
Pro
API Scripter
=D
sounds fantastic!  Were you able to get it up today?
1597874148
timmaugh
Pro
API Scripter
not quite... too much moving... will try tonight.
1598015134
timmaugh
Pro
API Scripter
It dropped last night . Let me know if you need help with it, or if it solves your issue!
timmaugh said: It dropped last night . Let me know if you need help with it, or if it solves your issue! Ok i got the scripts installed, after reading your thread I am pretty sure this is outside my abilities (for now).  I might have to reach out.
1598029411
timmaugh
Pro
API Scripter
np... let me know
timmaugh said: np... let me know When I load and enable the scripts i get the following error: Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your script's code and click the "Save Script" button. We will then attempt to start running the scripts again.  More info...  If this script was installed from the Script Library, you might find help in the Community API Forum. For reference, the error message generated was:  ReferenceError: Cannot access 'ia' before initialization
1598326052
timmaugh
Pro
API Scripter
Make sure that you load InsertArg first, then the core library and/or xray scripts.