Dynamic Lists

Hi, first of all, this tool is incredible. I'm predominantly a designer without a wealth of scripting knowledge, so now that I'm blazing through a sample character sheet for playtesting our system, it's absolutely invaluable, thank you.

My design starts with a series of gates that control access to lists based on character choices. For instance, each Race has a list of Archetypes, each Homeland has a list of Classes, and some are mutually exclusive. To do this, I created a CSV for each option, each containing all of the necessary values referenced the lists each option would lead into. I added those CSVs to my lists.

For example:
race,arch,str,int,mag
human,archhuman,1,0,0
elf,archelf,0,0,1

In my Script tab, I added this function:

function Update()
{
CharArchetype.List = Lookup( 'Races', CharRace.Text, 'arch');
}

CharArchetype and CharRace are list objects on my sheet, races.csv creates the Races list, and arch is the csv value it's looking for.

I set the Update function to run OnUpdate.

Any time the User changes an option, it checks to see if the CharRace list object has changed. If so, it goes to the Races CSV file I created, finds out what the Archetype of that race should be, and sets CharArchetype.List to that option. Works like a charm. After this is set you can then lookup the values of each field if attributes and such have changed. Theoretically any number of these list checks could be done by adding them to the update function, but I did notice a slowdown in performance after 3 or 4 calls.

I hope this helps anyone wanting to make sheets for more complex choice-based systems.

-Altheus

Leave a Comment