Function for finding highest value of placeholder

Give me two moments as explaining my situation will make this much clearer I think.

I am writing a comic script and I am using the <$n> and <$sn> tags for the comic page numbers (which correspond multiple pages of script to one final comic page) and for the individual panel numbers (as provided in the template). For example:

PAGE <$N>: 3 PANELS
PANEL <$SN>
blah blah

PANEL <$SN>
blah blah

PANEL <$SN>
blah blah

[next document in file structure]

PAGE <$N>: 3 PANELS
PANEL <$SN>
blah blah

PANEL <$SN>
blah blah

PANEL <$SN>
blah blah

It is normally accepted in comic scripts however that you provide a number of panels with the page number (as seen above manually typed).

I was wondering whether there was a way to find the highest <$SN> value in a section then return that in a placeholder so I could automate adding in the number of panels on a page (as a page with 3 panels would have the highest <$SN> value be 3). This would make it much easier to be flexible with this while I am writing.

image

1 Like

Thanks for the reply.

That doesn’t seem to work for counting the instances of <$SN>? I presume there’s no way to do this then?

There is no way, no. [That I know of]

But this placeholder I pasted the definition of is the solution.
Make each panel a seperate child-document in the binder and use that placeholder. You’ll get the number you want inserted automatically at compile.

Etiher use a folder in the binder with your panels inside, or make the first panel of what you consider a new document (as per your first post) the parent.

. . . . . . . .

There are other ways I can think of, if for some reason you don’t like this approach, but they involve manual tweakings, and on top, therefor, are pron to human error.
For example, using a custom metadata field and managing the value manually. The only advantage is that you wouldn’t have to manage your documents’ splits etc. And you could split if you want without ending up with “4” where it should be “3”, where you want the panel count at compile.

. . . . . . . .
The solution I suggested in my previous post isn’t a solution : it is the way to do it. And unless you have good technical reasons to handle things differently, it’ll always end up being the best option.

1 Like

The main problem with trying to use placeholders, even the more sophisticated forms that allow for recall and parallel counting in different streams (see below), is that the compiler is by and large downward processing. It starts at the top, and works down, meaning that placeholders meant to print the highest use value will print the value at the time of their use—or for what would be the panel count of the previous page.

There are some exceptions to that rule of thumb, but they are few because things start to get very complicated once you start going back and forth in the source material. You risk running into endless loops, “echo” output and other fun things. There is one such exception that allows for forward referencing, but they are designed for cross-referencing in non-fiction. For example, we can say, See Fig. <$n#figure:captionName>, which not only refers to the :figure counter stream, but a specific instance of it using the :captionName handle. Such a thing would be declared somewhere else as, <$n:figure:captionName> (the difference is in the first punctuation separator).

There is a similar form that allows us to print the current count for the stream, <$n#panel> for example, which duplicates the last number printed by <$n:panel>, but of course that will be the last panel from the previous page, prior to that stream being reset to 1 for the next page. Again, this is more of a non-fiction tool, where you might see it employed as, Figure <$n#chapter>.<$n:figure:figureName>, which might print as, “Figure 18.21”, or the 21st figure in chapter 18. The key being it comes after the increment it is referencing to, not before it.

Summary: you can do what you want, with placeholders, but the approach is necessarily probably more complicated than you would want, because it is designed for a use case that is at a conceptual level much more complicated. That is an acceptable level of complication, to give all of your tables or figures a name so you can reference them from anywhere in the book, but to name each and every panel in a graphic novel? That sounds like a crazy amount of overhead!

Overall I would suggest giving the earlier solution a try. There is no harm in splitting up a test page into multiple panels and indenting them beneath it. You can see what it is like to work with them in Scrivenings mode. You can play with the different appearance settings in the Appearance: Scrivenings options tab, the “Corners” divider for example is extremely low key and really does feel more like typing in a single “file”.

But if you don’t like it—no big deal. Select them all and use Documents ▸ Merge, or better yet, duplicate the page first so that you aren’t modifying the original.

3 Likes