// Convert string to camelCase function toCamelCase(str) { return str.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, index) ⇒ index === 0 ? word.toLowerCase() : word.toUpperCase()).replace(/\s+/g, ”); }
// Call modal form const result = await MF.openForm(‘NPC’);
// Declare variables after form returns values const affinity = result.Affinity.value; const gender = result.Gender.value; const job = result.Job.value; const location = result.Location.value; const name = result.Name.value; const race = result.Race.value;
// Rename & open note
await tp.file.rename(name);
await app.workspace.getLeaf(true).openFile(tp.file.find_tfile(name));
new Notice().noticeEl.innerHTML = <span style="color: green; font-weight: bold;">Finished!</span><br>New NPC <span style="text-decoration: underline;">${name}</span> added;
_%>
type: npc locations:
- <% location ?
"[[${location}]]": ” %> tags: - race/<% toCamelCase(race) %>
- affinity/<% toCamelCase(affinity) %><% job ?
\n - job/${toCamelCase(job)}: ” %> headerLink: ”<% name %>”
<% name %>
<% location ? :FasMapLocationDot: [[${location}#location|${location}]] | : ” %>:FasHeartPulse: <% affinity %>
Infobox
Details:
Type Stat :FasBriefcase: Job <% job %> :FasVenusMars: Gender <% gender %> :FasUser: Race <% race %>
Quote
Profile of <% name.toLowerCase() %>, the <% gender.toLowerCase() %> <% race.toLowerCase() %> NPC.
marker
Column
QUESTS:
LIST WITHOUT ID headerLink FROM "Compendium/Party/Quests" AND [[<% name %>]]HISTORY
LIST WITHOUT ID headerLink FROM "Session Notes" AND [[<% name %>]]
