Multiple Custom Metadata in Compile Header

I am inserting custom metadata in the header of my compile, but if I add more than one custom metadata, it starts acting weird. Sometimes they show up further down in the text.
This is my custom metadata:

changesetting:Text
conditions:Text
end:Checkbox

The first two are text and the last is a checkbox

This is my Title Prefix:

{
character:“<$label>”,
id:“<$title_no_spaces>”,
setting:“<$custom:changesetting>”,
condition:“<$custom:conditions>”,
isEnd:“<$custom:end>”,
text:"

If I only do one custom metadata, it works as expected, but once I add another, it goes all over. here’s an example:

character:“No Label”,
id:“Whereareyoutakingme?”,
setting:“learnedMesmer”,
condition:“<$custom:cNo”,
text:“Where are you taking me?”,

In this case the checkbox was not checked and the condition was blank text.
I’ve tried removing spaces and line breaks and renaming the metadata but I can’t find a rhyme or reason why this is happening.

Caveat- This coding is not my forte, but since no-one else has chimed in… have you double-checked spelling in your code vs metadata? I see condition vs. conditions and end vs. isEnd. Also, shouldn’t there be a closing bracket?

1 Like

Try using the Prefix tab instead of the Title Prefix box, for this kind of stuff. It’s be a more comfortable space to work in anyway, but more importantly it doesn’t have this particular bug! :smiley:

By the way, given what it looks like you are doing, I figured it worth mentioning that I wrote a simple JSON compile format a while back; maybe it will have some ideas you can use from it.

2 Likes

Thanks for the responses. I’ve double checked the spelling. “isEnd” is what my game engine reads “end” is the metadata tag in scrivener. They don’t need to match up. The closing bracket is in the title suffix. I’ve tried to use the prefix tag but then I have to uncheck title and the compile completely ignores a section if there is not text which is really frustrating. Some of my sections like questions for the player are only titles. Otherwise I would use the prefix box.
The suffix works better, but it seems like the values aren’t set after I add around 4 tags? :sob:
I contacted support several weeks ago and sent them my project but haven’t heard back. I might be able to get it to work by moving the title to the text but that would be a lot of work at this point.

Thanks for the suggestions though!

Hmm, I don’t get that result with either the Prefix or Suffix tabs. I tested five fields, all five of them printed correctly. Here is a very simple test project.

custom_metadata_check.zip (137.8 KB)

Some of my sections like questions for the player are only titles. Otherwise I would use the prefix box.

I might not be understanding the scenario entirely, but unless you are using some special features only the title tabs help you with (like letter case transformation), you can essentially replace the title functions entirely with these tabs, by using the <$title> placeholder.

If I use the <$title> placeholder, then I need to uncheck the title box so it’s not in there twice but if I do that, the compile doesn’t include the section at all because not boxes are checked. I guess it skips if there is no data even if you are using tags.

I may have found a workaround with the prefix like you suggested. I still have a title prefix and suffix

Title Prefix:

id:“<$custom:id>”,
text:"

Title Suffix:

",
lines: [

But then I put all my custom tags in the section prefix:

{
jump:“<$custom:jump>”,
isEnd:“<$custom:end>”,
remove:“<$custom:remove>”,
character:“<$label>”,
conditions:“<$keywords>”,

Then end the brackets in the group suffix:

],
},

So overall it looks like this:

{
jump:“<$custom:jump>”,
isEnd:“<$custom:end>”,
remove:“<$custom:remove>”,
character:“<$label>”,
conditions:“<$keywords>”,
id:“<$custom:id>”,
text:“Section Title>”,
lines: [ lines for the player options go in this array
],
},

And so far it’s working! I guess as long as I keep my custom tags in the section prefix, it should work.

The bug seems to be in the suffix, and title prefix, and title suffix. I was trying to spread by custom metadata for the game out between those but I would randomly get no metadata or garbled data.

Thank you for the help!

1 Like

Right, I forgot about that one! There is a check in the compiler that detects if no content is meant to be compiled for an item (like something that only generates titles but has no title) that causes it to be completely removed, so as to not trigger other things like Separators. Unfortunately it was made too aggressive, and removes things that always have content, like stuff that only prints from the Prefix tab and nowhere else. Basically that check just needs to be pushed further back in the process, even after Replacements, which might add or remove the final character.