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
This post has been closed. You can still view previous posts, but you can't post any new replies.

5e Shaped Companion Script Thread 2

Quick question, is it possible now, or will it be possible in the future to not have to open up individual character sheets and click Import after import an NPC from json?
1475268060
Lucian
Pro
API Scripter
Benevolent Tyrant said: Quick question, is it possible now, or will it be possible in the future to not have to open up individual character sheets and click Import after import an NPC from json? Yeah, this is a PITA. It's a limitation imposed by the way Roll20 works - the API can't trigger the sheet worker scripts directly, so I can't make the sheet load all the data properly without this. Riley has said he's working on changing this right now, and should have something up on dev soon, but I wouldn't be surprised if it turns out to be harder than he'd hoped + I suspect dev schedules have been a bit torpedoed by the whole Soundcloud bombshell. TL;DR: there's no way round this right now, but hopefully there will be within the next month or two.
Thanks for the heads up, I'll see if I can automate it in JS from the dev console or some other way.
1475268679
Lucian
Pro
API Scripter
Benevolent Tyrant said: Thanks for the heads up, I'll see if I can automate it in JS from the dev console or some other way. Let me know if you have any luck - I think you may find it quite tricky. The button simply toggles an attribute value to trigger a sheetworker that watches for a change in that value, which then kicks of the main import code. Unfortunately the sheetworkers depend on a whole bunch of magic state that is setup in the roll20 JS code, so you can't just call them directly. You *might* be able to call into the Roll20 code earlier to trigger the update, but I suspect that it's too closely coupled to all the firebase stuff for it to be straightforward. Your best bet is probably to ask the Scriptomancer - if anyone is going to be able to help you it will be him!
Lucian said: Benevolent Tyrant said: Thanks for the heads up, I'll see if I can automate it in JS from the dev console or some other way. Let me know if you have any luck - I think you may find it quite tricky. The button simply toggles an attribute value to trigger a sheetworker that watches for a change in that value, which then kicks of the main import code. Unfortunately the sheetworkers depend on a whole bunch of magic state that is setup in the roll20 JS code, so you can't just call them directly. You *might* be able to call into the Roll20 code earlier to trigger the update, but I suspect that it's too closely coupled to all the firebase stuff for it to be straightforward. Your best bet is probably to ask the Scriptomancer - if anyone is going to be able to help you it will be him! To summon the Scriptomancer in such a manner... The sacrifices that need to be made... a hundred dwarf beards... Fresh... 20 cups of coffee spilled in barcode...
EDIT: Not sure how to format code for the forums. EDIT2: Is the "Took XXXX ms" a good signal that the sheet is done completely with its labor? You asked me to update you if I got something working, so far very very cludgy but it worked: First character with Import yet clicked hidden away in the handouts tab: $("li [data-itemid='-KSwk2BbLAxJE36aj7Nu']").click(); $("div [data-characterid='-KSwk2BbLAxJE36aj7Nu'] ul li:nth-child(2) a").click(); $("input [name='attr_accept_import']").click(); worked, so something like this might work: $("li [data-itemid][class='journalitem dd-item character ui-draggable']").each( function() { var id = this.attributes["data-itemid"].value; if (!id) return; this.click(); //wait for something signifying done var div = $("div [data-characterid='"+id+"'] ul li:nth-child(2) a"); if (!div) {     $("a[class='ui-dialog-titlebar-close ui-corner-all']").click(); //close character sheet     return; } div.click(); //wait for something signifying done var importButton = $("input [name='attr_accept_import']"); if (!importButton) { $("a[class='ui-dialog-titlebar-close ui-corner-all']").click(); //close character sheet return; }; importButton.click(); //wait for something signifying done $("a[class='ui-dialog-titlebar-close ui-corner-all']").click(); //close character sheet //wait just to not inundate API which makes it stop responding } ); I'm currently figuring out what the "wait for something signifying done" is for each step.  Yes, it isn't integrated into Roll20, but it still may do the labor of clicking on all that stuff.
1475321403
Lucian
Pro
API Scripter
Cool! The "wait for something signifying done" is a bit of a problem. The issue is that the sheetworkers trigger each other - I think the "Took XXX ms" is for one "run", but then roll20 will go away and work out what other sheetworkers need to trigger based on what was changed by the last run, and trigger those, and so it continues until the updates stop happening. Riley has the same problem to solve for the API sheetworkers since I asked for there to be a completion callback. His solution involved having a countdown that resets every time a new set of updates kick off - and assuming that if there are no updates for XXX ms then the "chain reaction" has finished. You could do something similar - watch for 'Took XXX ms" and start a countdown when you see it - if the countdown reaches zero, then assume that everything has finished, otherwise, if you see another "Took XXX ms", reset the countdown and continue waiting.
Hi, first of all, I want to thank you for the script. It has made my life as a DM much easier! Unfortunately it has been having some issues lately. After encountering a few issues with an older version of the script and character sheets, I tried updating the sheets and scripts. Well, that broke a whole lot of things. I kind of expected it to happen but came to terms that I'd need to redo sheets and creatures. Where it gets weird is that with the new script I am still able to import creatures and spells mostly fine, however, the command !shaped-config refuses to respond. I don't see any errors in the log. Without the config I am unable to set defaults for new creatures or players. Any ideas what might be causing this or how I can fix it? I've verified that a brand new campaign works fine. Something in my current one refuses to allow the script to function properly.
1475438653

Edited 1475438670
Lucian
Pro
API Scripter
Hi Eric, First things first, when you say "an older version of the script and character sheets", how old are we talking? Is this the old shaped sheet, before it was "ReShaped", and the corresponding script; or is it just an earlier version of the current incarnation? For reference, the "new" script appeared sometime around March/April this year.  If you're upgrading something that's earlier than that you're likely to have a whole load of problems, unfortunately. Kryx basically recommends that people start from scratch rather than trying to automatically upgrade characters - so much has changed. Either way If you ping me a campaign invite I can try and have a look for you to see if I can work out what's going wrong. Cheers,
Hi Lucian, Thanks for the reply. It looks like I was using 3.6.1 for the sheets. I'm not sure about the script version. Is the version number buried somewhere in the script? I can see this line:  el.configureEntity('spells', [el.getMonsterSpellUpdater()], EntityLookup.getVersionChecker('0.2.1')); Not sure if that is the actual version or not though. I sent you a PM for the game. I appreciate it!
1475455100
Kryx
Pro
Sheet Author
API Scripter
3.6.1 shouldn't present major problems. Likely none. Hopefully Lucian can figure it out.
1475523106
Lucian
Pro
API Scripter
4.6.0 (2016-10-03) Features import-statblock: Changes to support parsing Tome of Beasts text ( 6ebd6c6 )
1475526176
Lucian
Pro
API Scripter
4.6.1 (2016-10-03) Bug Fixes chat-output: Fix bug with multiple players with same forename ( a2898ce ), closes #243 Thanks to Eric J. for uncovering this one - I can't believe this has never turned up before!
1475547557
The Aaron
Pro
API Scripter
Saevar L. "Liquid-Sonic" said: To summon the Scriptomancer in such a manner... The sacrifices that need to be made... a hundred dwarf beards... Fresh... 20 cups of coffee spilled in barcode... HAHAHAHA!  Sorry I missed this.  I was deep in the heart of moving across 2 states at the time. =D
1475933986
Lucian
Pro
API Scripter
Hey, is anyone else who is following this thread getting notifications for new replies but then not seeing them on the thread? Have we hit some sort of post count maximum or something? Do I need to start a new thread?
I did but just saw old messages - until this last one from you.
same here
1475934848
Lucian
Pro
API Scripter
Hey, turns out that it was just a coincidence - two people in a row posting and then finding answers to their questions and deleting their posts. Thanks for confirming though!
I am not sure if it's the Shaped 6.1.1 sheet, the Storm King Thunder's recent changes, the shaped companion sheet, or a combination of -- but I was wondering if someone could take a look at this post to see if it's possibly something that can be resolved with something I can do with the sheet or script? &nbsp;Thanks in advance: &nbsp; <a href="https://app.roll20.net/forum/post/4094240/shaped-a" rel="nofollow">https://app.roll20.net/forum/post/4094240/shaped-a</a>...
1476136860
Kryx
Pro
Sheet Author
API Scripter
Script issues will only occur from importing monsters or spells. Otherwise it's a sheet issue. This is a sheet issue and I've responded in that thread. :)
1476222368
Lucian
Pro
API Scripter
4.7.0 (2016-10-11) Features config: Add Hit Dice Output and Show Rests to "!shaped-config" ( d5ab14b ), closes #246
1476222694
Lucian
Pro
API Scripter
Also, Roll20 have now merged and released 4.6.1. This version is only compatible with a newer version of the JSON format. If you're on 1-click you may find that your monster files suddenly no longer work. If you've obtained monster files from elsewhere I'd advise you to go and check with the original source to see if you can get an updated version; if you've made your own, PM me and I'll help you upgrade them.
Would this affect the SKT's module where the NPCs have been pre-built?
1476279057

Edited 1476279071
Kryx
Pro
Sheet Author
API Scripter
The script only handles what it is made to handle: Automatically create characters from Monster Manual statblock text Import spells to characters from user-created databases of spells in JSON format Import monsters from user-created databases in JSON format Automatic population of NPC spells from JSON (if present) on import (both JSON and statblock) Auto HP rolling on drop for monster tokens Token setup with configurable defaults on monster import Auto ammo decrement Auto death save increment Auto HD reduction/HP increase on HD roll Advantage tracking commands - set a character to have (dis)advantage and mark which tokens this applies to Commands to create token actions for new characters Short/Long Rest handling Trait use count decrementing Automatic configuration of new characters see&nbsp;<a href="https://github.com/symposion/roll20-api-scripts/tree/master/5eShapedCompanion/latest#key-features" rel="nofollow">https://github.com/symposion/roll20-api-scripts/tree/master/5eShapedCompanion/latest#key-features</a>
Kryx, thanks for the feature list. &nbsp;I was concerned simply because he said: "you may find that your monster files suddenly no longer work. If you've obtained monster files from elsewhere I'd advise you to go and check with the original source to see if you can get an updated version" -- and my module had monster files already created, so that made me wonder..... Also, for "Import spells to characters from user-created databases of spells in JSON format" -- is there a guide/tutorial for this readily available anywhere? &nbsp;
1476280393
Kryx
Pro
Sheet Author
API Scripter
Monster files = monsters in json format for importing. So it will have no impact on any roll20 monsters, only files used for importing. For importing spells and monsters from JSON you have to setup json files. I thought it was on the documentation, but perhaps lucian moved it.
1476283728
Lucian
Pro
API Scripter
To be clear, if anyone else is confused: there are essentially 5 ways to create monsters: Type them in manually (exceptionally dull and time-consuming) Buy a module that already contains them Drag them over from the 5e Compendium - easy when it works, but limited to what's available in the SRD + doesn't auto-populate spells for you Use the script to import from statblock text, typically copy-pasted out of a PDF somewhere. Good for things that you can't get any other way; can be fussy if the statblock text isn't correctly formatted; the most work apart from typing it all in manually Use the script to import from a custom monster database using the !shaped-import-monster command. Generally the fastest and most effective way, providing that you can find an appropriate database that contains the monsters you want. These databases are installed as additional scripts in your campaign and mean that you can import monsters into your campaign by name - e.g. !shaped-import-monster --Lich Methods 4 & 5&nbsp; are the only ones that you need the script for, are described in detail in the script documentation . The documentation also provides instructions on how to install custom monster databases, but not how to create them, which requires some programming knowledge (if you need to ask how it's probably not for you). There are some user-created databases floating around somewhere with useful monsters in but some of them probably contain copyrighted material which is a whole can of worms that I don't want to open here...
Lots of information and clarification -- thank you both so much!!! &nbsp;Sorry for all the noob questions.... I am beginning to grasp all of this more each day....
1476394815
Lucian
Pro
API Scripter
4.8.0 (2016-10-13) Features json-import: Internal improvements to JSON database loading ( 7a62d0c ), closes #248 This release is most likely irrelevant to anyone who isn't creating their own JSON files for monster/spells. Hopefully it will make a few things easier in the future though.
I hacked this together to do the imports for me from the Chrome dev console. &nbsp;I'm running the first bit of javascript after I select the Journal tab from the side menu&nbsp; //open and switch to character sheet $("li [data-itemid][class='journalitem dd-item character ui-draggable']").slice(0,40).each( function() { var id = this.attributes["data-itemid"].value; if (!id) return; this.click(); //wait for something signifying done var div = $("div [data-characterid='"+id+"'] ul li:nth-child(2) a"); if (!div) return; div.click(); } ); after I'm sure it's finished by watching the dev console not produce any more debug output I run the following: //click import every 10 seconds, change to higher value on slower machines var every10Seconds = 0; $('input[type=checkbox][name=attr_accept_import]').each( function() { var char = this; setTimeout( function() { char.click(); } ,every10Seconds ); every10Seconds += 10000; }); Then finally this to close all the open character/NPC modal windows: $('span[class="ui-icon ui-icon-closethick"]').click() After that's done, I modify the first bit of javascript to be from 41-80 and follow the same pattern again. &nbsp;I keep repeating it until they are all imported. &nbsp;Took me about 30 minutes of letting it run while I did other stuff to import all the monsters but I wasn't watching it like a hawk. &nbsp;I'm sure there's a clever way to chain all this together while not overtaxing the browser but I didn't put the research in to figure it out since this crude method worked for me.
1476422457

Edited 1476441035
Question, is there a spell tracker for this?
1476479222
Lucian
Pro
API Scripter
What do you mean by a "spell tracker"? Do you mean decrementing spell points? If so, it's in the works - there are still some complexities to iron out around multiclassing etc.
1476479241
Lucian
Pro
API Scripter
4.9.0 (2016-10-14) Features rests: Regain spell points and warlock slots on rests ( eb52191 ), closes #131
ah ok thanks great work so far
Can someone please explain to me how does the&nbsp; !shaped-import-statblock works? I've tried to copy it from a PDF of a monster manual, from various other sources as well as the Roll20 SRD but it keeps coming up with errors...
1476538858
Jakob
Sheet Author
API Scripter
Geze said: Can someone please explain to me how does the&nbsp; !shaped-import-statblock works? I've tried to copy it from a PDF of a monster manual, from various other sources as well as the Roll20 SRD but it keeps coming up with errors... If you go back through this thread, there should be a couple of examples of valid statblocks. If yours follow the same format, they ought to work (it's usually just small OCR oddities).
1476539126
Kryx
Pro
Sheet Author
API Scripter
Edit the content in a notepad or something similar beforehand. Remove any errors and it'll work. Examples above like Jakob said.
Geze I have an example video of me editting a statblock as well as some resources you can use in conjunction with this tool. I also walk you through the import process step by step. <a href="https://www.youtube.com/watch?v=S9S4i_awTjk" rel="nofollow">https://www.youtube.com/watch?v=S9S4i_awTjk</a>
1476557599
Lucian
Pro
API Scripter
Hi Geze, If you are still having problems, some suggestions: Paste the text into notepad first. This avoids issues with Roll20 trying to "interpret" the formatting from the PDF (usually badly). Before copying the text back out into Roll20, look at the text in notepad. Make sure it looks like a reasonable representation of the statblock from the PDF - quite often - especially when they are OCRed PDFs - the text comes out surprisingly mangled. The parser does its best to fix stuff, but there are limits - so you may need to tweak the text so it actually looks like the PDF statblock it supposedly came from. Copy the text out of notepad and paste it into Roll20, and then run the import Read the error messages it gives you if any - generally they do tell you basically what's wrong - you may well be able to fix the problems yourself If you're still struggling, send me a PM with the full text of the statblock as you're pasting it into Roll20 and I'll try and help you out.
OK, so what do we do if our json monster file is no longer compatible?&nbsp;
Dvergr76 said: OK, so what do we do if our json monster file is no longer compatible?&nbsp; Buy Kryx & Lucian a triple Belgian Choc Muffin. Then proceed to do their cleaning, shopping and most important of all, a foot massage for them.
1476781566
Lucian
Pro
API Scripter
Saevar L. "Liquid-Sonic" said: Dvergr76 said: OK, so what do we do if our json monster file is no longer compatible?&nbsp; Buy Kryx & Lucian a triple Belgian Choc Muffin. Then proceed to do their cleaning, shopping and most important of all, a foot massage for them. Turn your computer on and off 7 times under the light of the full moon; after each cycle, walk anticlockwise around your desk clad only in a white linen robe, chanting, "here be monsters".
lol
Lucian said: Saevar L. "Liquid-Sonic" said: Dvergr76 said: OK, so what do we do if our json monster file is no longer compatible?&nbsp; Buy Kryx & Lucian a triple Belgian Choc Muffin. Then proceed to do their cleaning, shopping and most important of all, a foot massage for them. Turn your computer on and off 7 times under the light of the full moon; after each cycle, walk anticlockwise around your desk clad only in a white linen robe, chanting, "here be monsters". On topic though, I do seem to get this error pumping out all of a sudden which is weird. It still imports everything correctly though. I dunno if I just formatted the file badly, if there is a easy fix to it, cool, if not- i'll live with it.
1476789900
Lucian
Pro
API Scripter
Yeah, sorry, I realised after I pushed an update to the format that it wasn't quite as backwards compatible as I'd thought. It's harmless, as you've found out, but if you want to get rid of it you can update to the latest github script. I've sent a pull request to Roll20 and hopefully they'll merge it soon so all you 1-clickers don't get this spam in your chat logs.
Saevar L. "Liquid-Sonic" said: Dvergr76 said: OK, so what do we do if our json monster file is no longer compatible?&nbsp; Buy Kryx & Lucian a triple Belgian Choc Muffin. Then proceed to do their cleaning, shopping and most important of all, a foot massage for them. 80% seriously, is there some kind of muffin fund we could be contributing toward?
1477166327
Kryx
Pro
Sheet Author
API Scripter
I don't think Lucian has any kind of patreon, though if you want to contribute to the sheet: Kryx said: Since many have asked for it: If you appreciate what I do and want to compensate me for the countless hours that I have spent building this character sheet feel free to support me on Patreon or Paypal ( <a href="mailto:mlenser@gmail.com" rel="nofollow">mlenser@gmail.com</a> ). Thanks so much for your support. This Patreon campaign is not affiliated with Roll20; as such, contributions are voluntary and Roll20 cannot provide support or refunds for contributions.