open-campaign-logger / generator-library

This repository contains the generator library files for https://campaign-logger.com/generator which can be referenced like this: "{lib:adjColor}".
Apache License 2.0
31 stars 13 forks source link

Are variable values preserved in external (inter-file) subtable calls? #18

Closed evesala closed 6 years ago

evesala commented 6 years ago

I'm currently fiddling with quite a complex NPC description generator that uses plenty of variables.

It would make a lot of sense to split this generator into several JSON files (when the support for that materializes). Could you please confirm if the variable values are carried over when external tables from other files are used? Armed with that knowledge I would then be better prepared to plan the generator.

hkokko commented 6 years ago

This sounds intriguing. Could you share some of the approach, not using variables yet

evesala commented 6 years ago

Sure! I’m currently on a tablet, so this is just a snippet pasted from my Dropbox, but this should show the principle. He’s the first gender table (the other is for special cases like constructs and maybe dwarfs):

{ "name": "gender", "explanation": "Gender of the character.", "entries": [ { "m": 49, "v": "{female age}", "set": { "gender": "female", "subject": "she", "object": "her", "dependentpossessive": "her", "independentpossessive": "hers", "reflexive": "herself" } }, { "m": 49, "v": "{male age}", "set": { "gender": "male", "subject": "he", "object": "him", "dependentpossessive": "his", "independentpossessive": "his", "reflexive": "himself" } } ] },

The call is not returning anything directly, only the set variable values that can be used later on.

This is not the the best of examples, as in this case the call continues on to set the age, and based on that, also the substantive used for the character (a young female would get the ’substantive’ value of ”girl”, and so on.)

Anyway, this is more like a proof of concept thing, nothing even remotely finished.

JochenLinnemann commented 6 years ago

No, they aren't preserved. For that we now have globals.

evesala commented 6 years ago

This was a blast from the past! Glad we have globals now, they have made generator planning (and content recycling) so much easier.

Closing this as a triumphantly solved ticket.