Variables / Object Properties

I am brand new to using Scrivener and I know I’ve barely scratched the surface of what it can do, but there is a particular feature that I would really find useful, and I think others would too.

If you look at the “Binder” for a project, there are categories like “characters” and “places” where you can create a variety of notes for such things. I want to be able to create user-defined properties for these items which can be referenced in my text.

Suppose I’ve created a new project and I’ve created an entry under “Characters” for “protagonist”. I want to be able to treat “protagonist” as an object and create properties, such that when I’m writing the actual text of my story, I can insert something like “<%protagonist.firstname%>” which refers to the “firstname” property of the “protagonist” object, which may contain something like “Mike”

When I compile the project, when Scrivener sees a tag like “<%protagonist.firstname%>” it will automatically look for an object named “protagonist” and then through that object’s list of properties looking for “firstname”. Then it will replace the tag with whatever text is assigned to that property.

This will allow you to easily rename characters or places in your story by simply changing the property values. It would work better than a simple global search and replace because it would not get tripped up over common problems such as having two characters with the same first name.

To a degree you can do something similar with the “project replace” option when you compile, but it’s not as powerful as I’d like.

There’s a discussion of something similar here:

viewtopic.php?f=4&t=16638&p=115929

Have a look at pigfender’s contribution: it’s hilarious.

Martin.

So it is. Brilliant. And horribly, horribly true if you’ve ever had to write what we used to call “text adventures” but the young people call “Interactive Fiction” and the really groovy young people call “Eff off, grandad.” The fools.

You could have a toggle on whether to show the variable <$character:$main> vs David.

So you could read the text normally, yet see the variables as required. So the interpretation would not happen at compile time, but rather continuously as you typed.

A drop list would be nice also, to allow easier insertion of the variables. Say CTRL right click? And not just characters but other user-defined categories?