Here's the whole thing: var SCVMBuild = {
version: "0.4.4",
output: [],
listen: function () {
on("chat:message", function (b) {
if ("api" == b.type) {
switch (sendto = isGM(b.playerid) ? "/w gm " : "/direct ", b.content) {
case "!GenClass":
SCVMBuild.GenClass(b);
break;
case "!GenWeapon":
SCVMBuild.GenWeapon(b);
break;
case "!GenArmor":
SCVMBuild.GenArmor(b);
break;
case "!GenEquipment":
SCVMBuild.GenEquipment(b);
break;
case "!GenScroll":
SCVMBuild.GenScroll(b);
break;
case "!GenSilver":
SCVMBuild.GenSilver(b);
break;
case "!GenAbilities":
SCVMBuild.GenAbilities(b);
break;
case "!GenHP":
SCVMBuild.GenHP(b);
break;
case "!GenPower":
SCVMBuild.GenPower(b);
break;
case "!GenOmen":
SCVMBuild.GenOmen(b);
break;
case "!GenTraits":
SCVMBuild.GenTraits(b);
break;
case "!GenBody":
SCVMBuild.GenBody(b);
break;
case "!GenHabit":
SCVMBuild.GenHabit(b);
break;
case "!GenStory":
SCVMBuild.GenStory(b);
break;
case "!GenName":
SCVMBuild.GenName(b);
break;
case "!CharView":
SCVMBuild.printSheet(b);
break;
case "!SaveChar":
SCVMBuild.save(b);
}
}
});
},
GenClass: function (b) {
sendChat("API", "/roll 1t[Class]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split("|");
SCVMBuild.Class = a[0];
SCVMBuild.SilverDie = a[1];
SCVMBuild.OmenDie = a[2];
SCVMBuild.HPDie = a[3];
SCVMBuild.ClassDescription = a[4];
SCVMBuild.Abilities = a[5];
SCVMBuild.StrMod = a[6];
SCVMBuild.AglMod = a[7];
SCVMBuild.PreMod = a[8];
SCVMBuild.TouMod = a[9];
SCVMBuild.WpnDie = a[10];
SCVMBuild.ArmDie = a[11];
SCVMBuild.ScrDie = a[12];
SCVMBuild.output.Class = "<tr><td style='font-weight: bold; padding: 5px;'>Class</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Class + " " + SCVMBuild.SilverDie + " " + SCVMBuild.OmenDie + " " + SCVMBuild.HPDie + " " + SCVMBuild.StrMod + " " + SCVMBuild.AglMod + " " + SCVMBuild.PreMod + " " + SCVMBuild.TouMod + " " + SCVMBuild.WpnDie + " " + SCVMBuild.ArmDie + " " + SCVMBuild.ScrDie + "</td></tr>";
SCVMTextA = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Class + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextA);
});
},
GenWeapon: function (b) {
sendChat("API", "/roll 1t[Weapon]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.attacktype = a[0];
SCVMBuild.weaponname = a[1];
SCVMBuild.weapondamage = a[2];
SCVMBuild.output.Weapon = "<tr><td style='font-weight: bold; padding: 5px;'>Weapon</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.weaponname + "/" + SCVMBuild.attacktype + "/" + SCVMBuild.weapondamage + "</td></tr>";
SCVMTextB = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Weapon + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextB);
});
},
GenArmor: function (b) {
sendChat("API", "/roll 1t[Armor]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Armor = a[0];
SCVMBuild.ArmorTier = a[1];
SCVMBuild.output.Armor = "<tr><td style='font-weight: bold; padding: 5px;'>Armor</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Armor + "</td></tr>";
SCVMTextC = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Armor + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextC);
});
},
GenEquipment: function (b) {
sendChat("API", "/roll 1t[Equipment1]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Equipment1 = a[0];
SCVMBuild.output.Equipment1 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment1</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Equipment1 + "</td></tr>";
SCVMTextD1 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Equipment1 + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextD1);
});
sendChat("API", "/roll 1t[Equipment2]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Equipment2 = a[0];
if (SCVMBuild.Equipment2.includes("scroll")) {
SCVMBuild.GenUScroll(b);
} else {
SCVMBuild.output.Equipment2 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment2</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Equipment2 + "</td></tr>";
SCVMTextD2 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Equipment2 + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextD2);
}
});
sendChat("API", "/roll 1t[Equipment3]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Equipment3 = a[0];
if (SCVMBuild.Equipment3.includes("scroll")) {
SCVMBuild.GenSScroll(b);
} else {
SCVMBuild.output.Equipment3 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment3</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Equipment3 + "</td></tr>";
SCVMTextD3 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Equipment3 + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextD3);
};
});
},
GenUScroll: function (b) {
sendChat("API", "/roll 1t[unclean-scrolls]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split("|");
SCVMBuild.Equipment2 = a[0];
SCVMBuild.output.Equipment2 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment2</td></tr><tr><td style='padding: 5px;'>Scroll of " + SCVMBuild.Equipment2 + "</td></tr>";
SCVMTextD2 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Equipment2 + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextD2);
});
},
GenSScroll: function (b) {
sendChat("API", "/roll 1t[sacred-scrolls]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split("|");
SCVMBuild.Equipment3 = a[0];
SCVMBuild.output.Equipment3 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment3</td></tr><tr><td style='padding: 5px;'>Scroll of " + SCVMBuild.Equipment3 + "</td></tr>";
SCVMTextD3 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Equipment3 + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextD3);
});
},
GenSilver: function (b) {
Cash = 0;
for (let x = 0; x < SCVMBuild.SilverDie; x++) {
Cash = Cash + randomInteger(6);
}
SCVMBuild.Silver = Cash;
SCVMBuild.output.Silver = "<tr><td style='font-weight: bold; padding: 5px;'>Silver</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Silver + "</td></tr>";
SCVMTextQ = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Silver + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextQ);
},
GenAbilities: function (b) {
SCVMBuild.Strength = randomInteger(7) - 4;
SCVMBuild.Strength = SCVMBuild.Strength + Number(SCVMBuild.StrMod);
SCVMBuild.output.Strength = "<tr><td style='font-weight: bold; padding: 5px;'>Strength</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Strength + "</td></tr>";
SCVMTextE = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Strength + "</tbody></table>";
SCVMBuild.Agility = randomInteger(7) - 4;
SCVMBuild.Agility = SCVMBuild.Agility + Number(SCVMBuild.AglMod);
SCVMBuild.output.Agility = "<tr><td style='font-weight: bold; padding: 5px;'>Agility</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Agility + "</td></tr>";
SCVMTextF = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Agility + "</tbody></table>";
SCVMBuild.Presence = randomInteger(7) - 4;
SCVMBuild.Presence = SCVMBuild.Presence + Number(SCVMBuild.PreMod);
SCVMBuild.output.Presence = "<tr><td style='font-weight: bold; padding: 5px;'>Presence</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Presence + "</td></tr>";
SCVMTextG = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Presence + "</tbody></table>";
SCVMBuild.Toughness = randomInteger(7) - 4;
SCVMBuild.Toughness = SCVMBuild.Toughness + Number(SCVMBuild.TouMod);
SCVMBuild.output.Toughness = "<tr><td style='font-weight: bold; padding: 5px;'>Toughness</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Toughness + "</td></tr>";
SCVMTextH = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Toughness + "</tbody></table>";
Stats = SCVMBuild.Agility + SCVMBuild.Presence + SCVMBuild.Strength + SCVMBuild.Toughness
if (Stats < 1) {
SCVMBuild.GenAbilities(b);
} else {
sendChat(b.who, "/direct " + SCVMTextE);
sendChat(b.who, "/direct " + SCVMTextF);
sendChat(b.who, "/direct " + SCVMTextG);
sendChat(b.who, "/direct " + SCVMTextH);
}
},
GenHP: function (b) {
SCVMBuild.HP = randomInteger(SCVMBuild.HPDie);
sendChat(b.who, "/direct " + SCVMBuild.HP);
SCVMBuild.HP = SCVMBuild.Toughness + SCVMBuild.HP;
sendChat(b.who, "/direct " + SCVMBuild.HP);
1 > SCVMBuild.HP && (SCVMBuild.HP = "1");
SCVMBuild.output.HP = "<tr><td style='font-weight: bold; padding: 5px;'>HP</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.HP + "</td></tr>";
SCVMTextI = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.HP + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextI);
},
GenPower: function (b) {
sendChat("API", "/roll 1t[Power]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Power = a[0];
SCVMBuild.output.Power = "<tr><td style='font-weight: bold; padding: 5px;'>Power</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Power + "</td></tr>";
SCVMTextJ = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Power + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextJ);
});
},
GenOmen: function (b) {
sendChat("API", "/roll 1t[Omens]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Omen = a[0];
SCVMBuild.output.Omen = "<tr><td style='font-weight: bold; padding: 5px;'>Omen</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Omen + "</td></tr>";
SCVMTextK = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Omen + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextK);
});
},
GenTraits: function (b) {
sendChat("API", "/roll 1t[Trait]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Trait1 = a[0];
SCVMBuild.output.Trait1 = "<tr><td style='font-weight: bold; padding: 5px;'>Trait1</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Trait1 + "</td></tr>";
SCVMTextL1 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Trait1 + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextL1);
});
sendChat("API", "/roll 1t[Trait]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Trait2 = a[0];
SCVMBuild.output.Trait2 = "<tr><td style='font-weight: bold; padding: 5px;'>Trait2</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Trait2 + "</td></tr>";
SCVMTextL2 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Trait2 + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextL2);
});
},
GenBody: function (b) {
sendChat("API", "/roll 1t[Body]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Body = a[0];
SCVMBuild.output.Body = "<tr><td style='font-weight: bold; padding: 5px;'>Broken Body</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Body + "</td></tr>";
SCVMTextM = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Body + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextM);
});
},
GenHabit: function (b) {
sendChat("API", "/roll 1t[Habit]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Habit = a[0];
SCVMBuild.output.Habit = "<tr><td style='font-weight: bold; padding: 5px;'>Bad Habit</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Habit + "</td></tr>";
SCVMTextN = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Habit + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextN);
});
},
GenStory: function (b) {
sendChat("API", "/roll 1t[Story]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Story = a[0];
SCVMBuild.output.Story = "<tr><td style='font-weight: bold; padding: 5px;'>Troubling Tale</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Story + "</td></tr>";
SCVMTextO = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Story + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextO);
});
},
GenName: function (b) {
sendChat("API", "/roll 1t[Name]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.Name = a[0];
SCVMBuild.output.Name = "<tr><td style='font-weight: bold; padding: 5px;'>Name</td></tr><tr><td style='padding: 5px;'>" + SCVMBuild.Name + "</td></tr>";
SCVMTextP = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Name + "</tbody></table>";
sendChat(b.who, "/direct " + SCVMTextP);
});
},
printSheet: function (b) {
SCVMBuild.output.Class = "<tr><td style='font-weight: bold; padding: 5px;'>Class</td><td style='padding: 5px;'>" + SCVMBuild.Class + "</td></tr>";
SCVMBuild.output.Weapon = "<tr><td style='font-weight: bold; padding: 5px;'>Weapon</td><td style='padding: 5px;'>" + SCVMBuild.weaponname + "/" + SCVMBuild.attacktype + "/" + SCVMBuild.weapondamage + "</td></tr>";
SCVMBuild.output.Armor = "<tr><td style='font-weight: bold; padding: 5px;'>Armor</td><td style='padding: 5px;'>" + SCVMBuild.Armor + "</td></tr>";
SCVMBuild.output.Equipment1 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment1</td><td style='padding: 5px;'>" + SCVMBuild.Equipment1 + "</td></tr>";
SCVMBuild.output.Equipment2 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment2</td><td style='padding: 5px;'>" + SCVMBuild.Equipment2 + "</td></tr>";
SCVMBuild.output.Equipment3 = "<tr><td style='font-weight: bold; padding: 5px;'>Equipment3</td><td style='padding: 5px;'>" + SCVMBuild.Equipment3 + "</td></tr>";
SCVMBuild.output.Silver = "<tr><td style='font-weight: bold; padding: 5px;'>Silver</td><td style='padding: 5px;'>" + SCVMBuild.Silver + "</td></tr>";
SCVMBuild.output.Agility = "<tr><td style='font-weight: bold; padding: 5px;'>Agility</td><td style='padding: 5px;'>" + SCVMBuild.Agility + "</td></tr>";
SCVMBuild.output.Presence = "<tr><td style='font-weight: bold; padding: 5px;'>Presence</td><td style='padding: 5px;'>" + SCVMBuild.Presence + "</td></tr>";
SCVMBuild.output.Strength = "<tr><td style='font-weight: bold; padding: 5px;'>Strength</td><td style='padding: 5px;'>" + SCVMBuild.Strength + "</td></tr>";
SCVMBuild.output.Toughness = "<tr><td style='font-weight: bold; padding: 5px;'>Toughness</td><td style='padding: 5px;'>" + SCVMBuild.Toughness + "</td></tr>";
SCVMBuild.output.HP = "<tr><td style='font-weight: bold; padding: 5px;'>HP</td><td style='padding: 5px;'>" + SCVMBuild.HP + "</td></tr>";
SCVMBuild.output.Power = "<tr><td style='font-weight: bold; padding: 5px;'>Power</td><td style='padding: 5px;'>" + SCVMBuild.Power + "</td></tr>";
SCVMBuild.output.Omen = "<tr><td style='font-weight: bold; padding: 5px;'>Omen</td><td style='padding: 5px;'>" + SCVMBuild.Omen + "</td></tr>";
SCVMBuild.output.Trait1 = "<tr><td style='font-weight: bold; padding: 5px;'>Trait1</td><td style='padding: 5px;'>" + SCVMBuild.Trait1 + "</td></tr>";
SCVMBuild.output.Trait2 = "<tr><td style='font-weight: bold; padding: 5px;'>Trait2</td><td style='padding: 5px;'>" + SCVMBuild.Trait2 + "</td></tr>";
SCVMBuild.output.Body = "<tr><td style='font-weight: bold; padding: 5px;'>Broken Body</td><td style='padding: 5px;'>" + SCVMBuild.Body + "</td></tr>";
SCVMBuild.output.Habit = "<tr><td style='font-weight: bold; padding: 5px;'>Bad Habit</td><td style='padding: 5px;'>" + SCVMBuild.Habit + "</td></tr>";
SCVMBuild.output.Story = "<tr><td style='font-weight: bold; padding: 5px;'>Troubling Tale</td><td style='padding: 5px;'>" + SCVMBuild.Story + "</td></tr>";
SCVMBuild.output.Name = "<tr><td style='font-weight: bold; padding: 5px;'>Name</td><td style='padding: 5px;'>" + SCVMBuild.Name + "</td></tr>";
SCVMText1 = "<table font-size: 10px;'> <tbody>" + SCVMBuild.output.Name + SCVMBuild.output.Class + SCVMBuild.output.Weapon + SCVMBuild.output.Armor + SCVMBuild.output.Equipment1 + SCVMBuild.output.Equipment2 + SCVMBuild.output.Equipment3 + SCVMBuild.output.Silver + SCVMBuild.output.Strength + SCVMBuild.output.Agility + SCVMBuild.output.Presence + SCVMBuild.output.Toughness + SCVMBuild.output.HP + SCVMBuild.output.Power + SCVMBuild.output.Omen + SCVMBuild.output.Trait1 + SCVMBuild.output.Trait2 + SCVMBuild.output.Body + SCVMBuild.output.Habit +
SCVMBuild.output.Story + "</tbody></table>";
SCVMText = SCVMText1 + "<p><p>";
sendChat(b.who, "/direct " + SCVMText);
SCVMBuild.Description = SCVMBuild.Trait1 + "\n" + SCVMBuild.Trait2 + "\n" + SCVMBuild.Body + "\n" + SCVMBuild.Habit + "\n" + SCVMBuild.Story;
"function" === typeof saveCallback && saveCallback();
},
save: function (b, a) {
SCVMBuild.printSheet(b);
c = createObj("character", {
name: SCVMBuild.Name,
archived: !1,
inplayerjournals: "all",
controlledby: "all"
});
createObj("attribute", {
name: "description",
current: SCVMBuild.Description,
_characterid: c.id
});
createObj("attribute", {
name: "char_name",
current: SCVMBuild.Name,
_characterid: c.id
});
createObj("attribute", {
name: "class_description",
current: SCVMBuild.ClassDescription,
_characterid: c.id
});
createObj("attribute", {
name: "class_abilities",
current: SCVMBuild.Abilities,
_characterid: c.id
});
createObj("attribute", {
name: "class",
current: SCVMBuild.Class,
_characterid: c.id
});
createObj("attribute", {
name: "armor",
current: SCVMBuild.Armor,
_characterid: c.id
});
createObj("attribute", {
name: "armortier",
current: SCVMBuild.ArmorTier,
_characterid: c.id
});
createObj("attribute", {
name: "strength",
current: SCVMBuild.Strength,
_characterid: c.id
});
createObj("attribute", {
name: "agility",
current: SCVMBuild.Agility,
_characterid: c.id
});
createObj("attribute", {
name: "presence",
current: SCVMBuild.Presence,
_characterid: c.id
});
createObj("attribute", {
name: "toughness",
current: SCVMBuild.Toughness,
_characterid: c.id
});
createObj("attribute", {
name: "hp_curr",
current: SCVMBuild.HP,
_characterid: c.id
});
createObj("attribute", {
name: "hp",
current: SCVMBuild.HP,
max: SCVMBuild.HP,
_characterid: c.id
});
createObj("attribute", {
name: "silver",
current: SCVMBuild.Silver,
_characterid: c.id
});
SCVMBuild.AddGear(b);
// SCVMBuild.AddAbilities(b);
sendChat("", 'Created <a href="<a href="http://journal.roll20.net/character/" rel="nofollow">http://journal.roll20.net/character/</a>' + c.id + '" style="color:blue;text-decoration:underline;">SCVM ' + SCVMBuild.Name + "</a>");
// },
// AddAbilities: function (b, c) {
switch (SCVMBuild.Class) {
case "Fanged Deserter":
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_weapons_-CREATE_weaponname|Bite Attack --repeating_weapons_-CREATE_attacktype|Melee --repeating_weapons_-CREATE_weapondamage|d6');
sendChat("API", "/roll 1t[FD-Earliest-Memories]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Earliest Memories: ' + SCVMBuild.EM + '');
}),
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Illiterate; you are incapable of understanding scrolls.');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Normal Agility tests are DR14 instead of DR12, excluding defense.');
sendChat("API", "/roll 1t[FD-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.FA + '');
});
break;
case "Gutterborn Scum":
sendChat("API", "/roll 1t[GS-Bad-Birth]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Bad Birth: ' + SCVMBuild.EM + '');
}),
sendChat("API", "/roll 1t[GS-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Specialty:' + SCVMBuild.FA + '');
});
break;
case "Esoteric Hermit":
sendChat("API", "/roll 1t[EH-Eldritch-Origins]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Eldritch-Origin: ' + SCVMBuild.EM + '');
}),
sendChat("API", "/roll 1t[EH-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.FA + '');
});
sendChat("API", "/roll 1t[scrolls]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.SC = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_equipment_-CREATE_equipment|' + SCVMBuild.SC + '');
});
break;
case "Wretched Royalty":
sendChat("API", "/roll 1t[Things-were-going-so-well-until...]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Things-were-going-so-well-until ' + SCVMBuild.EM + '');
}),
sendChat("API", "/roll 1t[WR-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.FA + '');
});
sendChat("API", "/roll 1t[WR-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FB = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.FB + '');
});
break;
case "Heretical Priest":
sendChat("API", "/roll 1t[HP-Unholy-origins]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Unholy-origins: ' + SCVMBuild.EM + '');
})
sendChat("API", "/roll 1t[HP-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.EM + '');
})
break;
case "Occult Herbmaster":
sendChat("API", "/roll 1t[OH-Decoctions]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Decoction Recipe: ' + SCVMBuild.FA + '');
});
sendChat("API", "/roll 1t[OH-Decoctions]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FB = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Decoction Recipe' + SCVMBuild.FB + '');
});
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|You carry a portable laboratory and continually search for frequently expended ingredients. Daily you have the materials to create two decoctions and can brew a total of d4 doses. If unused they lose vitality after 24 hours.');
break;
case "Sacrilegious Songbird":
sendChat("API", "/roll 1t[SS-A-deal-was-struck]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|A deal was struck ' + SCVMBuild.EM + '');
});
sendChat("API", "/roll 1t[SS-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|When you made your life-and-soul altering deal, you were gifted an accursed instrument.');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.FA + '');
});
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|You carry an aura of unnatural charm everywhere you go, capable of unsettling foes and calming friends, spend a use of your daily Powers to add or subtract d6 to any Morale check.');
break;
case "Pale One":
sendChat("API", "/roll 1t[PO-Unspoken-origins]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Unspoken origin: ' + SCVMBuild.EM + '');
});
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Your mind and movements are alien');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|You are literate, but only in dead languages, and cannot use scrolls.');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|You can intuitively use one randomly rolled Power. The Power changes each dawn, or dusk (pick one).');
sendChat("API", "/roll 1t[PO-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.FA + '');
});
// sendChat("API", "[[1t[PO-Name1]]] [[1t[PO-Name2]]] [[1t[PO-Name3]]]", function (a) {
// [1,2,3].forEach(n => SCVMBuild.N[n] = a[0].inlinerolls[n - 1].results[0].tableItem.name.split(":")[0]);
// sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --char_name|'+ SCVMBuild.N1 + ' ' + SCVMBuild.N2 + ' ' + SCVMBuild.N3);
// });
break;
case "Dead Gods Prophet":
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|You are literate and can use scrolls, but must pass a DR12 Presence test when encountering them not to immediately attempt to destroy them as words of false gods.');
sendChat("API", "/roll 1t[DG-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.EM + '');
});
sendChat("API", "/roll 1t[DG-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|' + SCVMBuild.FA + '');
});
// sendChat("API", "/roll 1t[DG-GodName1]", function (a) {
// a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
// SCVMBuild.N1 = a[0];
// });
// sendChat("API", "/roll 1t[DG-GodName2]", function (a) {
// a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
// SCVMBuild.N2 = a[0];
// });
// sendChat("API", "/roll 1t[DG-GodName3]", function (a) {
// a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
// SCVMBuild.N3 = a[0];
// });
// sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|God: '+ SCVMBuild.N1 + ' ' + SCVMBuild.N2 + '' + SCVMBuild.N3 + '');
break;
case "Cursed Skinwalker":
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Shifting your bones as such occupies a single painful round. Armor and weapons are likely unusable in your new form.');
sendChat("API", "/roll 1t[CS-First-Died]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|First Died: ' + SCVMBuild.EM + '');
});
sendChat("API", "/roll 1t[CS-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Creature shape' + SCVMBuild.FA + '');
});
break;
case "Forlorn Philosopher":
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|You carry an aura of unnatural charm everywhere you go, capable of unsettling foes and calming friends, spend a use of your daily Powers to add or subtract d6 to any Morale check.');
sendChat("API", "/roll 1t[FP-Dejection]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.EM = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|The Roots of Your Dejection: ' + SCVMBuild.EM + '');
});
sendChat("API", "/roll 1t[FP-Abilities]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.FA = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|Tablet of Ochre Obscurity and ' + SCVMBuild.FA + '');
});
sendChat("API", "/roll 1t[FP-Roots]", function (a) {
a = JSON.parse(a[0].content).rolls[0].results[0].tableItem.name.split(":");
SCVMBuild.RD = a[0];
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_abilities_-CREATE_class_abilities|The Dejection of Your Roots: ' + SCVMBuild.RD + '');
});
break;
}
},
// },
AddGear: function (b, c) {
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_weapons_-CREATE_weaponname|' + SCVMBuild.weaponname + ' --silent --repeating_weapons_-CREATE_attacktype|' + SCVMBuild.attacktype + ' --silent --repeating_weapons_-CREATE_weapondamage|' + SCVMBuild.weapondamage + '');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_equipment_-CREATE_equipment|' + SCVMBuild.Equipment1 + '');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_equipment_-CREATE_equipment|' + SCVMBuild.Equipment2 + '');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_equipment_-CREATE_equipment|' + SCVMBuild.Equipment3 + '');
sendChat('API', '!setattr --name ' + SCVMBuild.Name + ' --silent --repeating_powers_-CREATE_power|' + SCVMBuild.Power + '');
},
};
on("ready", function () {
SCVMBuild.listen();
});