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

Question About Copying Sheet Data

I'm using the Pathfinder Community sheet. I was wondering if there was a way to copy over all spells on a sheet to another sheet? Possibly with one of the many API scripts that let you edit sheets with commands?
1528726562
The Aaron
Pro
API Scripter
While technically possible with general purpose API scripts, probably a custom script would be necessary to make it really useful.  Spells are spread across multiple attributes, you'd need to know all the names and ids to do the copying, and they'd be somewhat different each time. 
1528726802
Jakob
Sheet Author
API Scripter
The Aaron said: While technically possible with general purpose API scripts, probably a custom script would be necessary to make it really useful.  Spells are spread across multiple attributes, you'd need to know all the names and ids to do the copying, and they'd be somewhat different each time.  I would implement this as a "copy everything from repeating section named X" script, that could have a reasonable interface (but it doesn't exist yet afaik).
1528727371
The Aaron
Pro
API Scripter
Yeah, I can imagine a general purpose script where you could say "On character 'Foo', for the repeating group named 'spell_level_1', copy everything in the row with a 'spell_name' of 'fireball' to a new row on character 'Bar' "
1528728031
Jakob
Sheet Author
API Scripter
I was thinking something more primitive, just copy everything in a section with no regard for the name. The main function is simple enough, but writing the chat interface is the most annoying part, as always. const copyAllAttrs = (sectionName, sourceID, targetID) => {   findObjs({       characterid: sourceID,       type: "attribute"     })     .filter(x => x.get("name").indexOf(`repeating_${sectionName}_`) === 0)     .map(x => ({       characterid: targetID,       current: x.get("current") || "",       max: x.get("max") || "",       name: x.get("name") || ""     }))     .forEach(data => createObj("attribute", data)); };
1528728058
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The Aaron, this sounds very much like the tool I was speculating on last week, when you turned me on to the handout method of tracking magic items. It sounds like it would be a bit tricky (finding all of the fields in a repeating group that match the key search, and copy them all to a new character.) It sounds like you would need to specify source character, target character, match the repeating group with a keyword, and then match the specific item with a keyword, probably a "name" field? hurk!
1528728141
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Mister Smartypants Jakob. Writing a script in the same amount of time it took me to write a post saying how hard such a script would be to write!
1528728700
The Aaron
Pro
API Scripter
Yeah, certainly copying ALL the spells would be easier than copying specific ones.  The UI is always the hardest part. =D   Keith, it is actually pretty close to the magic items thing.  Probably a general purpose Repeating Group manipulation script would be useful... 
1528730316
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
The writer would be raised upon the virtual shoulders of the collective Pro user base and given hearty praise. No money, of course.
1528731298
The Aaron
Pro
API Scripter
HAHAHAHA. =D True enough.
The Aaron said: Yeah, certainly copying ALL the spells would be easier than copying specific ones.  The UI is always the hardest part. =D   Keith, it is actually pretty close to the magic items thing.  Probably a general purpose Repeating Group manipulation script would be useful...  That's exactly what I wanted to do. Copy ALL spells from one character to another. The two characters in question are Clerics (one is a cleric variant) and they just reached level 3. There are a total of 151 2nd level Cleric spells on the d20pfsrd. That's right. 151 . (Although only 77 of them are in the Pathfinder Compendium, all others must be typed up manually) - I wanted to copy the 77 spells from Cleric A to Cleric B but I'm almost done dragging them from the compendium so not really needed now. BUT - for future use it would be nice to have a script that indiscriminately copied character's spell-book over to another character.
1528734249
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
It might be easier to do this once, in a spreadsheet. Have the spreadsheet format a chat menu from which you can install any spell. You really don't want 77 (let alone 151!) spells on a character sheet. It will bog performance horribly. You might be able to use some of the code from  this macro and spreadsheet and repurpose it to your own requirements. 
Thanks keithcurtis I'll take a look at it. In the meantime I removed all spells from the 2 sheets in question and told the players to pick up to 30 spells from the list of 151 and they can swap out any whenever they rest to regain their spells.
1528767803
vÍnce
Pro
Sheet Author
I would highly recommend limiting the number of spells you keep "on-sheet".  As your number of spells increase, your performance will decrease due to the shear number attributes created.  I know it's a pain, but I would only keep your most often used spells on the sheet and just drag/drop situational and/or less used spells as needed and delete them when done.  
Is 30 spells x 2 = 60 spells spread across 2 character sheets really going to bog down my game that much? I haven't noticed an issue with it so far.
1528810193
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Maybe not. I think the assumption was that this was a practice you were employing widespread. As I understand it, you might have some slowness opening those particular sheets (or your players might, depending on their setup. But mostly I was commenting on the initial estimate of 77 or 151 on a sheet.
1528810570
The Aaron
Pro
API Scripter
There are 73 attributes per spell on the Pathfinder Community Sheet.  That's 4380 attributes for those 60 spells.  That's probably not going to be a problem with 2 characters, but it can get out of hand quickly.
keithcurtis said: Maybe not. I think the assumption was that this was a practice you were employing widespread. As I understand it, you might have some slowness opening those particular sheets (or your players might, depending on their setup. But mostly I was commenting on the initial estimate of 77 or 151 on a sheet. I might do something like you suggested keithcurtis and just have all my caster players spells in a spreadsheet where I can just copy / paste a macro and it adds the spell to their spellbook. Going to have to do a bunch of reading and figure out how I'm going to do this. The Aaron said: There are 73 attributes per spell on the Pathfinder Community Sheet.  That's 4380 attributes for those 60 spells.  That's probably not going to be a problem with 2 characters, but it can get out of hand quickly. Well if they get to pick another 30 3rd lvl spells, then 30 4th lvl spells, then 30 5th lvl spells etc etc it will add up quick on the 2 characters. I think like I said I might try something similar to what keithcurtis suggested.
1528811557
Jakob
Sheet Author
API Scripter
Kastion said: keithcurtis said: Maybe not. I think the assumption was that this was a practice you were employing widespread. As I understand it, you might have some slowness opening those particular sheets (or your players might, depending on their setup. But mostly I was commenting on the initial estimate of 77 or 151 on a sheet. I might do something like you suggested keithcurtis and just have all my caster players spells in a spreadsheet where I can just copy / paste a macro and it adds the spell to their spellbook. Going to have to do a bunch of reading and figure out how I'm going to do this. Shameless plug, you can probably do this (rather) easily with generated ChatSetAttr macros. I know that keithcurtis has done something similar for feats in D&D 5, perhaps he knows better how to go from spreadsheet to macro :).
Jakob said: Shameless plug, you can probably do this (rather) easily with generated ChatSetAttr macros. I know that keithcurtis has done something similar for feats in D&D 5, perhaps he knows better how to go from spreadsheet to macro :). I was already planning to use ChatSetAttr. I use it for quite a few of my macros already.
1528811827
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If you want to convert a whole bunch of stuff outside the SRD (for your own use, of course), it's probably worth the investment. You might want to consider using the powercards script, which would effectively make each spell a single macro (character Ability). Put these on one common character and have your spellcaster PCs just make macro calls to those individual spells/macros. One small line of code (or a roll template with a list of Ability Command Buttons) per spellcaster sheet, with all of your code stored only once. Your PCs would need to keep track of spell usage manually (not sure how the Pathfinder Sheet handles this), but you would definitely reduce code: only one sheet has the spells, and each spell is one attribute (macro). The downside is that you would have to transcode every spell, as you would be bypassing the utility of the compendium.
1528814706

Edited 1528814727
vÍnce
Pro
Sheet Author
It would be so nice if we could just post a nice spellblock directly from the compendium to chat and include any applicable rolls and/or variable stats from the sheet as needed...
1528814737

Edited 1528814820
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
There might be some useful stuff on  this page to aid with writing spell macros. Especially  this section .