Drop-down menu option from object in Chapbook

Twine Version: 2.10
Format: Chapbook

Hello. I’m trying to work in a basic inventory system for my story in Chapbook. The way I’m doing this probably is not the best, but it’s the one I could figure with my limited knowledge of Javascript:

  • At the first passage, I create vars for body “slots”, like this:

neckwear: 'cross pendant'

  • So, in my Inventory/Wardrobe passage, I can describe the character wearing it like:

“Mary is wearing her {neckWear} at her neck.”

But I want to manipulate this later, let’s say changing clothes, putting/removing hats, etc. I was trying to do it with drop-down menus, like this in my Invetory passage:

Neck: {dropdown menu for: 'neckWear', choices: [neckWearAvOpt]}

Where neckWearAvOpt would be all itens that the character obtained along the story. It could be something like:

neckWearAvOpt: ['wheel choker', 'cross pendant', 'black tie']

I know I can include/remove items like this:

neckWearAv: [...neckWearAv, 'white choker'] // add new choker to Available
neckWearAv: neckWearAv.filter(f => f !== 'black tie') // removes tie

So, my problem is how to make my menu of items list each item from the neckWearAv, so I can change which one the character is wearing. If you have a better idea for my problem, let me know and I will really appreciate.

1 Like