Hello! In my game the player can wear/equip different items, all represented on the appearance/inventory screen using slots. So when the player picks up an item I have to set 5 different variables for the relevant slot to correctly portray it in the inventory.
For example: A steel chainshirt which goes into the chest slot. I have to set:
$chestSlotName
Used to refer to the item in the actual story passages, "Your steel chainshirt resists the damage."
$chestSlotShortDescription
Used to briefly mention the item in the inventory. Differs from the name because this variable adds the necessary a/an particle (and potentially an adjective or two), tying into the paragraph that describes your appearance in words, "You are wearing a steel chainshirt and..."
$chestSlotSmallImageLink
Used to display the item's image in the inventory, small to conserve space.
$chestSlotLongDescription
Used to describe the item in a "new-window" passage, specific to the chest slot, in greater detail, "A fine protective garment made up of intertwined metal rings. Has a moderate defensive value while not weighing you down too much."
$chestSlotLargeImageLink
Used to display a much larger image for the item, in the "new window" which is item-specific so has a lot of space.
As you might imagine, having to set these 5 variables every time can quickly clutter a story passage, especially if there are multiple items to be picked up and worn available! I am yet new to Twine so I was wondering if there was some way to only set 1 parent variable, while having those other 5 declared in an item-specific passage (there would be a sort of database then, since each item in the game would need to have 1 such passage). Like so:
Player puts on a steel chainshirt. Game sets a variable: $chestSlot="steelchainshirt"
This parent variable links to that item's passage which contains the 5 child variables:
steelchainshirt
$itemName
$itemShortDesc
$itemLongDesc
$itemImageSmall
$itemImageLarge
And then finally, in the inventory screen, the chest slot fields are filled with information on account of the game knowing that $chestSlot="steelchainshirt".
Is this possible? Or another solution like it? I am basically looking for a way to be able to avoid having to set 5 variables wherever a wearable item appears in the story passages.
Comments
Best of luck! I'm on a similar (albeit less organised) quest myself