This is a complicated structure, and I think we may be making some conflicting assumptions. Let me clarify some of mine:
- Data tiddlers (like the “Character/spellbook” example in your screenshot) are purely for holding data; they don’t need a special UI (and in fact, can’t have one, since the
type
— set toapplication/x-tiddler-dictionary
in this instance — is already defining a dictionary-type ViewTemplate.) Rather, our goal is to build an interface for editing the data tiddler without ever opening it, and then display that interface as part of a template used elsewhere. -
<$let spellbook={{{ [<currentTiddler>] [[spellbook]] +[join[/]] }}}>
← This code sets the<<spellbook>>
variable to a value =<<currentTiddler>>/spellbook
.; the<<spellbook>>
variable sets the name of the data tiddler being edited. This means that my code won’t be editing any indexes on<<currentTiddler>>
, i.e. the tiddler where the template is displayed. I was envisioning it being used as part of an EditTemplate for a character tiddler, so<<currentTiddler>>
would be the name of the character… but I’m not sure exactly what your ideal structure looks like.- Do make sure that, wherever this template is displayed, the
<<currentTiddler>>
is not a dictionary tiddler, and the tiddler whose title corresponds to<<currentTiddler>>/spellbook
is. - It looks like, at present, you’re trying to use my code as part of a general list of spells, not a list of spells known by a particular character. In this case, I imagine you don’t actually want to edit the level at which a particular character knows the spell… because in this situation, there’s no character defined. Is that right?
- Do make sure that, wherever this template is displayed, the
First, to fix your code, tiddler="<<currentTiddler>>"
should be tiddler=<<currentTiddler>>
. You don’t want to use quotations marks around any <<variable>>
or {{!!transclusion}}
when it’s used as the value of an attribute (like tiddler
in this $select
widget). Quotation marks indicate a literal value, so your current code would be changing the spellbook
field of the tiddler with the literal title “<<currentTiddler>>
”.
If a character only has one spellbook and all character spellbooks (i.e., data tiddlers) following the CharacterName/spellbook
naming convention, then no, you don’t need a field listing this title. I gave the $select
example because you’d asked about how to build a dynamic dropdown, and at the time I wasn’t sure about the sort of character/spellbook relationship you were envisioning.
- If, for example, you had a bunch of prebuilt spellbook data tiddlers with titles like
Spellbook A
,Spellbook B
, etc., and you wanted each character to use one of these preset spellbooks rather than an individualized one whose title can be programmatically determined, it’d be helpful to have aspellbook
field that specifies which spellbook should be used for that character.
I would try moving the level-editing code from GURPSSpellbookEditTemplate
to GURPSCharEditTemplate
.