<%*

// 1) Rename if the file starts with ā€œNewPlanetā€ let title; if (tp.file.title.startsWith(ā€œNewPlanetā€)) { title = await tp.system.prompt(ā€œEnter Planet Nameā€); if (!title) { new Notice(ā€œNo name entered. Aborting.ā€); return; } await tp.file.rename(title); } else { title = tp.file.title; }

// 2) Get all Star System notes from folder const systemFiles = tp.app.vault.getMarkdownFiles() .filter(f ⇒ f.path.startsWith(ā€œ2-World/Star Systems/ā€));

const placeholderLabel = ā€šŸŒ€ No Star System Selectedā€; const placeholderPath = ā€œplaceholderā€;

// Combine options const systemChoices = [placeholderLabel, …systemFiles.map(f ⇒ f.basename)]; const systemValues = [placeholderPath, …systemFiles.map(f ⇒ f.path)];

// 3) Prompt user to pick a Star System const chosenPath = await tp.system.suggester(systemChoices, systemValues, true); if (!chosenPath) return;

// 4) Build the wiki-link or set fallback let wikiLink = null; if (chosenPath !== placeholderPath) { const chosenAlias = chosenPath.split(ā€/ā€œ).pop().replace(/.md{chosenPath}|${chosenAlias}]]`; }

// 5) Write to frontmatter setTimeout(() ⇒ { const newFile = tp.file.find_tfile(tp.file.path(true)); if (!newFile) { new Notice(ā€œCould not find file after rename.ā€); return; } app.fileManager.processFrontMatter(newFile, fm ⇒ { fm[ā€œMyContainerā€] = wikiLink ?? ā€œNoneā€; }); }, 200);

%>

Parent Star System: INPUT[suggester(optionQuery(#Category/StarSystem)):MyContainer]

Column

Map

Town Name

INPUT[select(
option(1, ā„¹ļøGeneral Info),
option(2, 🌐Planet Details),
option(3, šŸ“GM Notes),
class(tabbed)
)]

Tabbed

NOTE

INPUT[select(
option(1, šŸ—ŗļøContinents),
option(2, šŸ‘½Sapient Species),
option(3, āš”ļøCapital Cities),
class(tabbed)
)]

Tabbed


General Info

This is the planet description.

Planet Details

Dominant Races:
Climate: Seasons:

GM Notes

Make notes of what you need to track in the region here.

Continents

BUTTON[button_continent] Continents Large continuous landmasses that contain regions.

properties:
  file.name:
    displayName: Continent(s)
views:
  - type: cards
    name: Continents - Cards
    filters:
      and:
        - file.folder == "2-World/Continents"
        - list(MyContainer).contains(this)
    order:
      - file.name
    image: note.image
  - type: table
    name: Continents - Table
    filters:
      and:
        - file.folder == "2-World/Continents"
        - list(MyContainer).contains(this)
    order:
      - file.name
    sort:
      - property: file.name
        direction: DESC
    columnSize:
      file.name: 182
 

Sapient Species

BUTTON[button_species] Intelligent species that live on this planet.

properties:
  file.name:
    displayName: Sapient Species(s)
views:
  - type: cards
    name: Sapient Species - Cards
    filters:
      and:
        - file.folder == "2-World/Sapient Species"
        - list(MyContainer).contains(this)
    order:
      - file.name
    image: note.image
  - type: table
    name: Sapient Species - Table
    filters:
      and:
        - file.folder == "2-World/Sapient Species"
        - list(MyContainer).contains(this)
    order:
      - file.name
    sort:
      - property: file.name
        direction: DESC
    columnSize:
      file.name: 182
 

Capital Cities

BUTTON[button_hub] Groups of people and power - religious, cults, guilds, military

filters:
  and:
    - formula.LinkedToThisPlanet
    - MyContainer.contains(this)
formulas:
  LinkedToThisPlanet: |
    list(MyContainer)
      .filter(
        file(value)
        && list(file(value).properties.MyContainer)
             .filter(
               file(value)
               && list(file(value).properties.MyContainer)
                    .contains(this)
             ).length > 0
      ).length > 0
properties:
  file:
    displayName: Hub
  MyCategory:
    displayName: Type
  MyContainer:
    displayName: Region(s)
views:
  - type: cards
    name: Capital Cities (Cards)
    filters:
      and:
        - file.inFolder("2-World/Hubs")
        - list(MyCategory).contains("City +1500")
    order:
      - file
      - MyCategory
      - MyContainer
    image: note.image
  - type: table
    name: Capital Cities (List)
    filters:
      and:
        - file.inFolder("2-World/Hubs")
        - formula.LinkedToThisPlanet
        - list(MyCategory).contains("City +1500")
    order:
      - file
      - MyCategory
      - MyContainer