Tiddlywikis — Who, What, How, Why?

So, a more involved example of the kinds of things you can do with fields. Here is the "Books" tiddler from my CoC TW.
1792420478998.png

The bit on the right, where you see a tab called "Contents" with items under it, is a basic function in TW. Tag any tiddler with "TableOfContents" and it will show up there. So you can easily sort and organize your info.

This is the code in the "Books" tiddler.
1792420588208.png

This is a lot of code, but it's all the same thing. I've set it up do "<book title> — <language(s)>, by <author(s)>, tr. by <translator(s), if any> (<printing city(ies): <publisher>, <date of publication>)" and a lot of the code is just to do the following:
  • If the book has a "caption" field, use the "caption" field contents instead of the tiddler title. That way, I can have the tiddler titled "Necronomicon" and the caption say "The Necronomicon" and have it show up how I like it in the list.
  • Every book has an author in the "author" field. The author section checks if there's a "caption" field on the author tiddler. All of the authors have this, since the tiddlers are titled something like "AlHazred, Abdul" but the captions are ordered as "Abdul AlHazred". This is, again, a way to get it to show up in the list in a way that I like. It also checks if there's more than one author, and if there is, it lists them as "<author A>, <author B>, & <author C>". Again, all this is because my autism requires the list to look a specific way.
  • Some books have a translator in a "translator" field. That section checks if there is one, and if there is, lists the "caption" field from the translator tiddler, again sorting more than one translator in the Oxford style.
  • All books have a location of printing in a "place" field. This section checks for the "caption" field in the place tiddler, and uses that, and if there's more than one, sorts it the way I like. Really, if I wasn't such a stickler for appearances, the code would be one-tenth the size it is.
  • The same process happens with the book tiddler's "publisher" field, pulling the "caption" field of the publisher tiddler.
  • Finally there's the date. You can format dates very easily, and I've set it to just use the four-digit year, and append "BCE" or "CE".
Everything has links, because I want to be able to navigate easily. TW has a "<$link>...</$link>" function you can call from the tiddler's body that lets you easily turn things into links.

There are ways to automate and make life easy in a number of ways. I'm not good at teaching, so I'm going to hit them in a mostly random order.
 

log in or register to remove this ad

Here is what the Necronomicon looks like. You can see there are a ton of fields, because the more you can sort and organize the information, the more operations you can perform on the tiddlers. Calling any particular field into a tiddler is accomplished by encapsulating the field name with two curly brackets and prepending two exclamation marks, like so: "{{!!subclass}}". If you train yourself to consistently put certain information in fields, you can easily copy-and-paste your code from one tiddler to another and still have the correct information show up.
1792421783880.png
1792421825934.png


Now, you can see it's tagged with both "book" and "tome". I have differentiated these as follows: "book" is anything that's a book, while "tome" is a book that has game-mechanical effects. In Call of Cthulhu, some books have information it is dangerous for mortal men to know, and those are called Mythos Tomes.

You can create a tiddler to automatically populate any other tiddler with certain fields. This is a tiddler I made called "$:/mymodules/book-field-automation". If I tag a tiddler with the tag "book", it automatically adds fields for "author", "date", etc. I have another one called "$:/mymodules/tome-field-automation" which automatically adds fields for "mythos rating", "sanity loss", "spells" and so forth. It saves a lot of time.
1792421997274.png


Now, you'll notice some of the fields in the Necronomicon above have double-square-brackets around them, like "[[Madrid, Spain]]". Double square brackets is now you make a wiki link; so every time that field is called, it puts it as a link to the tiddler for "Madrid, Spain". This is not just a convenience. I have a field for "spells", and many of the spell names have multiple words. In TW, it will interpret every word as a separate tiddler, unless they are enclosed in double square brackets. Again, if you think of this kind of thing at the outset, it saves you going back and editing a lot of tiddlers later.

The other bit of deeper TW code is the grey infobox on the right side of the Necronomicon tiddler. Initially, I put the following code into the body of each book tiddler.
<<<

<$list filter="[all[current]has[tome.san]]">
''Sanity Loss:'' {{!!tome.san}}
</$list>

<$list filter="[all[current]has[tome.cmi]]">
''Cthulhu Mythos:'' +{{!!tome.cmi}}/+{{!!tome.cmf}} percentiles
</$list>

<$list filter="[all[current]has[tome.mr]]">
''Mythos Rating:'' {{!!tome.mr}}%
</$list>

<$list filter="[all[current]has[tome.occult]]">
''Occult:'' +{{!!tome.occult}} percentiles
</$list>

<$list filter="[all[current]has[tome.other]]">
''Other Skills:'' {{!!tome.other}}
</$list>

<$list filter="[all[current]has[tome.study]]">
''Study:'' {{!!tome.study}} weeks
</$list>

<$list filter="[all[current]has[tome.spellmult]]">
''Spell Multiplier:'' ×{{!!tome.spellmult}}
</$list>

<$list filter="[all[current]has[tome.spells]]">
''Suggested Spells:'' {{!!tome.spells}}.
</$list>

<<<
The three left-arrows makes it a text box, and the individual items checked to see if there was data in the named field, and if there was, it would put it in the tiddler there. This is a lot of additional work you don't need to do. Learn from my learning pains!

I created a TomeInfoboxTemplate tiddler that looks like this:
1792422547735.png

It has one field, "list-after" which you can see if you edit the tiddler:
1792422607688.png

The "$:/tags/ViewTemplate" tag makes this a System tiddler, one of the ones that changes the way the TW will operate. The "list-after" field tells TW where to put whatever the Template tiddler is asking it to do. This generates the infobox for any tiddler tagged "tome"; "book" tiddlers don't need the infobox because they have no game mechanical information, which is all that is in this tiddler.
 

Attachments

  • 1792421726852.png
    1792421726852.png
    215 KB · Views: 26
  • 1792421670730.png
    1792421670730.png
    234.7 KB · Views: 39

I just realized, in my Necronomicon example above, you can see what I'm talking about with figuring out your structure before doing a lot of work.

You can see, in the second image, the line "//Latin manuscript, by [[Abdul AlHazred|AlHazred, Abdul]], tr. by [[Olaus Wormius|Worm, Ole]], 1624//" at the top of the tiddler body box. That's a remnant from when I originally put the Necronomicon in, before I did any automation at all. The forward-slashes at front and back put the stuff in between into italics. If you look at the image above it, you'll actually see that information (sort of) in there twice.
1792423308706.png

The line that goes "Latin, by Abdul AlHazred, tr. by (Madrid: manuscript, 1624 CE)" that's immediately under the title of the tiddler is generated by another Template tiddler, BookSubtitleTemplate. It looks like this:
1792423473094.png

1792423541449.png

Notice, all books are going to get this line under the title, while only tomes will get the infobox; that's by design.

This, again, looks really complicated, but once you figure out a code that works for, say, "authors" you can copy it and modify it for "translators", "publishers", etc. There's a few statements that use TW's built-in <%if ...%>...</%endif^+%> function, which I've used to only include sections for translators if there is something in the "translator" field of the book tiddler, for example.

If you look at the first screen capture in this post, you'll see a part that says "tr. by (...". That's because I don't have a tiddler for the translator "Worm, Ole" yet. Once I do, it'll automatically populate that bit of the Necronomicon tiddler.

For now, I remove the "//Latin manuscript, by [[Abdul AlHazred|AlHazred, Abdul]], tr. by [[Olaus Wormius|Worm, Ole]], 1624//" at the top of the tiddler body box, and it looks like this:
1792423905474.png
 

Oh, one more quick one. You notice the "Books" item under the "Contents" tab has an arrow, like you can open a menu. Well, that's because you can.
1792424079367.png

I made two subpages, "Fictional Books" and "Real Books". "Fictional Books" looks like this:
1792424131519.png

You can make it a subpage of a Contents page by tagging the tiddler with the name of the tiddler it's going to be a subpage for. And the only difference in the code between this one and the "Books" tiddler is an addition to the <$list filter...> line: "contains:status[Fictional]". The "contains" operator looks in each tiddler for the "status" field, and then finds the ones that have that field with the value "Fictional". Those tiddlers will show up in this list. If I didn't also have "[tag[book]]", then every tiddler with "Fictional" in the status field would show up in this list: npcs like "AlHazred, Abdul", places like "Arkham, Massachusetts" and so on. It's a good example of the kinds of operations you can do to manipulate the tiddlers.
 

I played around with the empty TW and realized I was inaccurate with the TableOfContents. You have to make one initially, using the <<toc>> macro embedded in TW.
Create a new tiddler titled "TableOfContents" (or whatever) and tag it with "$:/tags/SideBar". Add a field named "caption" and put in whatever you're going to want the tab to say (I used "Contents"). Put <<toc-selective-expandable "TableOfContents">> in the body.
1792427332965.png

As soon as I select the checkmark to finish editing the new tiddler, you'll see "Contents" on the right hand side, as a new sidebar.
1792427377042.png

Now, you can do the stuff I mentioned in my previous reply, with the table of contents. You can use this to segregate your tiddlers as well, having a different tab for different projects, for example. It's all up to you what you do with it.
 

I will mention, you can also use a site called TiddlyHost to put your TW online. It has a number of additional features I don't need so I didn't mention it, but it's available. With the free level of TiddlyHost, you can put your TW online. Like anything on the Internet now, if you're willing to pay money, you can get some nice features.
1792427762714.png

I know the Internet is a shop now, but I remember when it was a library.

Anyway, I believe you can use TiddlyHost to have a TW that's both GM-facing and player-facing; they just have to log in using a free TiddlyHost account. TiddlyHost has all of the functionality of the TW stuff I'm talking about here, so it's another option for how you can use it with your games, for instance if you want a wiki that players can reference like @el-remmen mentioned.
 


So, modifying the graphical look of your TW is also fairly straightforward. If you're at all familiar with stylesheets, TW uses those, each in its own tiddler. For example, I have a BookStylesheetTemplate, which looks like this:
1792432649299.png

The data is from the WOFF2 version of the font "Beaumarchais", which was the closest I could get to the default header font in the Call of Cthulhu books. I uploaded it to TW as its own tiddler, by dragging-and-dropping the WOFF2 file:
1792432788534.png

1792432816967.png

You'll notice that it has the "Type" of "font/woff2". I set that, so that the TW knows it's a font, and then it can be called from inside other tiddlers. The name makes it a System tiddler, which hides it from general search. The active stylesheet part is here at the bottom of BookStylesheetTemplate:
1792432953833.png

Anything tagged "book" will use Beaumarchais in the title.

How I learned this is also simple: I looked it up. There is a forum for TW discussion at Talk TW, and I find the community is very welcoming. Most of the code you've seen in various tiddlers I've posted came from querying Talk TW and then applying what people told me. A lot of the custom widgets are poorly documented, and can be difficult and time-consuming to figure out from scratch; most of the users on the forum are willing to help other users avoid the time-sinks that trapped them.
 


An excellent overview. I've used TW in the past. If you're familiar with wikis in general, it's pretty easy to use for non-fancy uses.
I agree! Like I said, I'm not a coder. All of the code depicted was gotten from Talk TW, or from downloading somebody else's Tiddlywiki and looking into the tiddlers to see how they did things. I've been hearing that some people are even using AI to develop their Tiddlywikis, but I don't think that's really necessary; plus, I'd be worried about the AI hallucinating code that overwrites tiddlers you've already made. It's another reason to use a Cloud storage solution, especially one that saves previous versions of files.
 

Remove ads

Top