<%* // // Helper Functions //

// 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, ”); }

// Return icon based on type function getIcon(type) { const iconMappings = { ‘Magic Item’: ‘:FasWandMagicSparkles:’, ‘Religious Artifact’: ‘:FasCross:’, ‘Quest Item’: ‘:fas_scroll:’, Treasure: ‘:RiVipDiamondFill:’ };

return iconMappings[type] || ':FasCircleQuestion:';

}

// // Main Code Section //

// Call modal form const result = await MF.openForm(‘OBJECT’);

// Declare variables after form returns values const name = result.Name.value; let type = result.Type.value; const icon = getIcon(type);

if (type === “Manual”) { type = await tp.system.prompt(‘Enter type:’, ‘Leave blank for none’, true); type = type === ‘Leave blank for none’ || ” ? ” : type; }

// 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 object <span style="text-decoration: underline;">${name}</span> added; _%>


type: object tags:

  • <% type ? “object/” + toCamelCase(type) : ” %> headerLink: ”<% name %>

<% name %>

<% type ? ${icon} ${type} : ” %>


Quote

right wm-smDescription of the <% type ? type.toLowerCase() : ‘object’ %>, <% name %>.

marker

marker

Column

FROM “Compendium/NPC’s” AND <% name %>

LIST WITHOUT ID headerLink FROM “Session Notes” AND <% name %>