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

Battletech - A Time of War character sheet - Data migration for repeating section with changed drop down values

Hi guys, I'm looking at the skills for the A Time of War  character sheet , and I have a cunning plan to improve them. A Time of War has a bit of an odd skill system where there are multiple skills, but some skills have a defined list of subskills (acrobatics/free-fall vs acrobatics/gymnastics), some skills have an open-ended list of subskills (interest/battlemechs, interest/war, interest/history, interest/potato growing etc.), and some skills don't have any subskills. Additionally, some skills are tiered, so that at levels three and under, they only rely on one attribute, but at levels four and up they rely on two attributes. The target number also increases. Currently, this has been implemented in a way that is very manual for players; you pick your skill from a drop down list, manually set the linked attribute(s), manually set the target number, manually set the amount of XP your skill has, the level of the skill (level is derived from XP), and the skill modifier. If your skill has a subskill, you have to type that in yourself. I'm aiming to improve this by making the drop down list of skills include all the officially defined subskills, and have an on change listener to the repeating section so that whenever you change your skill selection, the linked attribute(s), target number, modifier etc. are all automatically worked out. However, I've just tested this in my test game, and updating the values of the skill drop down list means that any existing skill entries lose their drop down value and default to the first one. Obviously this isn't great for a character with 20+ skills, so to finally get to my question: is there a way to do this in a non-breaking way, either via a data migration or some other trick? My only solution for now is to add a new repeating section and leave the old repeating section, and allow players to migrate their skills manually, but I'd prefer to automate it if possible. Thanks for all ideas, guys!
1553140895
GiGs
Pro
Sheet Author
API Scripter
You could add a new repeating section, hide the old one, and have a sheet upgrade function that runs when the sheet is first opened, and only once, which migrates the data from the old repeating section to the new one.
Yeah I wasn't sure how to get all the items in a repeating section, though. It's ok, because I think I've got a workable solution. :) Turns out that just because the options in the drop down list have changed, the original value still exists in the attribute, so I can run a migration that does its best to work out what the new skill should be based on the old value and update it.