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

[Script] Spell Management of public DnD 5E Spells

1411071504

Edited 1412107439
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
9/18/2014 Working Draft Recommended Setup: 1) Create a new campaign. 2) Be sure to select the Optional: Choose a Character Sheet Template: Dungeons & Dragons 5th Ed. Authors: John Myles (Actoba on Roll20.net, @jmyles85 on Twitter) 3) Add to the campaign the two needed and one recommended API scripts: SpellManager (API will soon be posted below.) SpellArrray (Link to this code can be found in the top comments of the SpellManager script.) PowerCardScript (Can be found here: [Script] Power Cards by HoneyBadger .) 4) You should be able to use my images for the code as is; however I have provided them here as well. Image files You will have to update the code for the icons but the SpellBookToken is just normal player token and not in the code. There are 28 of them found in the SpellManager script. Example below: roll20API.AbjurationURL = "Your image's source URL "; 5) Create a page called "Spell Book" (the API will be looking for it.) 6) Create a Character named "Spell Book" with a default token (the API will be looking for it.) 7) Add three abilities to the "Spell Book" as token actions. Name: Create/Update-Spell-List Action: !spellbooks?{This will overwrite existing table. Are you sure you want to do this? (Y/N)|N} Shown as Token Action: Checked Name: Update-List-Icons Action: !updatelist?{This will update your list icons. Are you sure you want to do this? (Y/N)|N} Shown as Token Action: Checked Name: Update-Character-Spells Action: !updatespell?{This will overwrite existing spells. Are you sure you want to do this? (Y/N)|N} Shown as Token Action: Checked 8) Build additional characters Make sure they have levels (at least 1) in a class (or at least 1 level in each of the classes the character has) on the 5E sheet. 9) Place the "Spell Book" and character(s) on the "Spell Book" page. 10)You should be all set up! Using the Spell Book: 1) Click and confirm the "Create/Update-Spell-List" Spell Book token action. a) This will create or update a player specific rollable-table with all spells available to the character based on class. b) Spells will be sorted by level (0,1,2,3) and then name (a,b,c.) c) The API spams some text to the chat pane (this can be removed from the code.) d) The table's name will be the character name and the character API unique ID. You can change the name, but do not change the ID. Example result: e) All the spells are listed, however the icons will be "RED" and the item weight for each spell will be "0" (Zero.) 2) Edit the item weight for whichever spells you choose. Spell item weight of '0' (zero) means the spell will NOT be added to the character record sheet at all. Spell item weight of '1' (one) means the spell WILL BE added to the character record sheet with an ability. Spell item weight of '2' (two) means the spell WILL BE added to the character record sheet with an ability and the ability will be a token action. 3) Once complete click and confirm the "Update-List-Icons" Spell Book token action. a) This makes the list more readable. b) Review the changes. c) Repeat steps 2 and 3 until you are happy. Example result: Green icon spells will be added to the character's spell book with an ability but not the ability will not be set as a token action. Blue icon spells will be added to the character's spell book with an ability set as a token action. Red icon spells will not be added to the character at all. 4) Once you have your list set... click and confirm the "Update-Character-Spells" Spell Book token action. That is it... the character has an updated spell book and abilities with desired token actions. Example result: Code Below: There is a lot of optimization of the code that is needed. And we will be working to achieve that (we will be actively seeking advice from others HINT HINT Brian, Aaron, Alex, Honey...etc...etc..etc....) Credit/Blame: Big thanks again to Wesley L. for all the hard work he put into this. <a href="https://gist.github.com/BaldarSilveraxe/7ae48e19be" rel="nofollow">https://gist.github.com/BaldarSilveraxe/7ae48e19be</a>...
1411075822
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
The last thing added was determining the casting level for the Power Cards and have not done much testing with that. But there it is. Along with about 70 public spells with more public spells to be added. However will likely working to optimize the code from a working draft to a more useful/smaller/faster final script before adding more public spells.
1411079294
The Aaron
Roll20 Production Team
API Scripter
Awesome! Can't wait to try it!
1411087881
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
There is a lot of inefficiency in there. But the basic path to getting there I think is right. Get a list of character to be updated (a page and tokens works well for that. For each character get a exhaustive list of all possible spells based on the character's class(es.) Use a character specific rollable table for a clunking interface to weight the spells by player preference. There could be player tools for reading through this and updating it. Based on that tables item weighting, update the character record sheet for each spell. This is where it get really inefficient. I should do all the character calculation/evaluations for the character's class (or classes)...once. I should then get all the spells that matter based on table setting...once. Compare and update...once. Wes is also refining the PowerCard information so more of it is constructed on the fly.
Do you have a copy of the text (or whatever format) you are pulling the spells from? I will need to get myself(or one of my crew) on it to be converted to my advanced sheet. i'll also have to update the API script.
I noticed today the 1st level bard/cleric spell 'Bane' is not in the SpellArray.
1411866585
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Yea... I got distracted a bit. I owe an update to the spell array, a bug in the code as is, and a rework of the code overall.
This is what I added locally: { Call:"bane", PowerCard:"I cast bane on up to three creatures of my choice within range. --text1|^*Whenever a target makes an attack roll or a saving throw before the spell ends, the target can roll a **1d4** and subtract the number rolled from the attack roll or saving throw.", Effect:"I cast bane on **@{target|t1|token_name}, @{target|t2|token_name}, and @{target|t3|token_name}**.", Name:"Bane", Class:"Bard,Cleric", SubClass:"", Ritual:"N", Concentration:"Y", Level:"1", School:"Enchantment", Component:"V,S,M", Material:"(a drop of blood)", Range:"30 feet", CastingTime:"1 action", Duration:"Concentration, up to 1 minute", Description:"I choose up to three creatures of my choice that I can see with range to make a Charisma saving throw. Whenever a target that fails this saving throw makes an attack or a saving throw before the spell ends, the target must roll a d4 and subtract the number rolled from the attack roll or saving throw.", HigherLevel:"When I cast this spell using a spell slot of 2nd level or higher, i can target one additional creature for each slot level above 1st.", EffectClean:"None", TargetAoE:"Up to Three creatures within range", SaveStat:"CHA", SaveSuccess:"No Effect", HealAmount:"0", CritText:".", DamageStatBonus:"0", DamageMiscBonus:"0", DamageType:"0", DamageKind:"None" },
wait, is this working? I thought this was still in progress?
1411870156
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
It works... but large amounts of spells in one shot it will times out. Needs to be rewritten to be more efficient... and the attack modifier is wrong.
If you need help I can take a look at it, I figured you guys were hard at work on it and almost had it. So the Spell Array is the text for all of the spells???
1411871331
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Spells found in any and all PDF's WOTC released for free... currently up to 3rd level. Wes was updating 4-9th (PDF's WOTC released for free) but I wont talk to him until tomorrow. And we have a google excel file with the same content we are updating (that file has a tab that concatenates everything into an array to make it easy to update and copy over.) Between work and that token pack I just haven't circled back to this yet.
1412090480
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Updated the spell array to include all 5E free content PDF spells (link in the code.) Also added a Google docs spreadsheet link to all 5E free content PDF spells (link in the code.) As to adding spells, that is the limit to what will be shared.... but if you have the PHB, just update your copy of the Google file and update your API. The main code still needs an update... working through that now.
Not sure if this is a Bug or not, but I did not add spellcastingability under attributes before running it and my healing spells seem to have defaulted to d8 + Clerics_level I also am not sure what happens if I change the token list and re run it. I think it would delete old spells and add the new ones. I tried deleting healing word after I added spell casting ability in an attempt to fix the macro it creates but it seems not be adding it back to my list.
1412101913

Edited 1412101966
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Its a mistake on my part. All the data should be in the sheet correctly, however when I construct the token action macro I did a per job based on the e5 rules. So I need to fix that.... hope to have the complete today or tomorrow. Edit: Also plan to get rid of the need for adding spellcastingability.
That's awesome! thanks!
1412107288
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
The code is updated... it needs to be made more efficent still.. but this should be working.
Do you have immediate plans to make it more efficient, or should I get started with it?
1412118284
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
I have good intentions; however I wouldn't wait on me.... taken me weeks to get you things I already promised in days.
Stephen, thanks for the nice script, it really saves a lot of time! It works pretty well (although admittedly I didn't try to load too many spells at once). The only quirk is that it seems to ignore the refresh of the icons in the rollable table to show the selected spells...
1412294134
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Fabio M. said: Stephen, thanks for the nice script, it really saves a lot of time! It works pretty well (although admittedly I didn't try to load too many spells at once). The only quirk is that it seems to ignore the refresh of the icons in the rollable table to show the selected spells... I will look at that.... its actually very poorly written in a great many places. It could really be condensed and optimized quite a bit I think. I also think storing a "default" set of spells would be nice.... so you could add a wizard with standard spells selections... then the rollable table for that wizard would only need review and minor editing... and not click, set, save....click, set, save... 70 times over.
Has anyone already updated the script with the latest spells from PHB? If so, can you provide a link either to the google doc or the actual working script. Thanks! Wermfood
Spells from the PHB won't be entered due to copyright issues, I believe. The only spells being included are those that are released in free resources like the Basic Rules pdf.
Anyone else wanna privately share their own custom spell array, also alot of typos in the current one. Im going through and fixing and adding new spells but this is a task within itself, if anyone else has already done this send me a pm and we will discuss it.
1414642778

Edited 1414642791
This looks very interesting!!! Is the timeout problem present when you add lots of spells at once or is it related to the length of the spells database? Basically, could you use it and add a few spells at a time (to avoid the timeout known issue) or will you hit a wall and can't go beyond lvl 3 spells?
Basically, we are already using @Actoba's 5e character sheet and players in my campaign have manually filled the spells they are using. Before overwriting any of their info I want to be sure that this script is functional. Anyhow, I'll test it on a dummy campaign sometime soon.
Is there a script that will parse these spells if we copy / paste out of the book?