
Hey Folks,
I am at my wit's end here and I want to see if it's me screwing up or if the sheet hates me. Buckle up as this has some parts and may be a bit rambling.
So I've written a script to take a JSON for a Starfinder Starship and import it into the character sheet. The various systems and weapons are, of course, repeating rows. I stole The Aaron's script to make row IDs and the systems (like sensors, computers, power cores, etc) import great.
However, the weapons are not showing up at all. The totally weird part is that when I use timmaugh's Xray script to examine the character, all of the attributes are there right where they should be. They even exist when I make a @{selected|repeating_attack_$X_name} call. I just cannot get them to display on the sheet though.
Is it possible there is a hidden attribute in the repeating_attack section (For the weapons) that displays them on the sheet? If so, how would I even go about finding that?
I'm including the code snippets involved. Hopefully, this can help.
Create Attribute function
const createAttribute = (name, current) => {
if (current == undefined) {
log(`Starship Import: no value found for ${name}, skipping create.`);
return;
}
createObj('attribute', {
name : name,
current: current,
characterid: character.id
});
};
Here is the relevant weapons code. All weapons are stored in an array within the JSON which is why I have the for loop.
for (i=0; i<starshipData.weapons.length; i++) {
var weaponRowID = generateRowID();
let range = starshipData.weapons[i].range.split(" ")
switch (range[0]) {
case "Short": rangeNumber = 5;
break;
case "Medium": rangeNumber = 10;
break;
default: rangeNumber = 20;
break;
};
//Name
createAttribute("repeating_attack_" + weaponRowID + "_name", starshipData.weapons[i].name);
//Type
createAttribute("repeating_attack_" + weaponRowID + "_type", starshipData.weapons[i].type.replace(" ","-").toLowerCase());
//Class
createAttribute("repeating_attack_" + weaponRowID + "_class",starshipData.weapons[i].class);
//Range
createAttribute("repeating_attack_" + weaponRowID + "_range", rangeNumber);
//DamageRoll
createAttribute("repeating_attack_" + weaponRowID + "_damage_dice",starshipData.weapons[i].damage.dice.count + "d" + starshipData.weapons[i].damage.dice.sides);
//Arc
createAttribute("repeating_attack_" + weaponRowID + "_arc",starshipData.weapons[i].installedArc);
//PCU
createAttribute("repeating_attack_" + weaponRowID + "_pcu", starshipData.weapons[i].pcu);
//Build Points
createAttribute("repeating_attack_" + weaponRowID + "_bp", starshipData.weapons[i].cost);
//speed
createAttribute("repeating_attack_" + weaponRowID + "_description", starshipData.weapons[i].speed);
};
A fresh pair of eyes will be greatly appreciated. I would also not rule out the possibly of a small shrine as well.