Im struggling to work out how to leverage java script to dynamically select different notes.
What I’m trying to do
I am trying to create an encounter calculator that takes the selection of a monster defined in its own file, and populates some local properties that can be used.
The structure of each monster file is the same and is its own folder monsters/[monster-name].md . The simplified metadata is:
---
monster-name: orc
hp: 55
attack: 4
xp: 120
---
Things I have tried
Selecting the monster is easy
INPUT[suggester(optionQuery("monsters"), useLinks(false)):selectedMonster]
The following works if explicilty referenced as storagePath#property
meta-bind-js-view
{orc#hp} as text
---
return context.bound.text
however the following where selectedMonster = orc fails
meta-bind-js-view
{selectedMonster#hp} as text
---
return context.bound.text
and even if selectedMonster = orc#hp it just returns “orc#hp”
meta-bind-js-view
{selectedMonster#hp} as text
---
return context.bound.text
Any advice would be appreciated on how to structure the js, i know there are potential other solutions using other plugins, but i’d like to at least learn what I’m doing wrong here before moving on.