I have a table and I’d like to use the entries from a particular column of the table to create new variables; specifically, a kind of thing for each entry.
I know the code for running through the column and capturing each entry into a temporary variable works, but I can’t seem to deduce how to then take that and use it as the object name to define a new kind of thing.
When play begins:
repeat through the Table of Provisions:
let M be the consumable entry;
XXXX is a kind of edible thing;
now the player carries XXXX.
…where XXXX would be the object named M.
And, for reference, the Table looks something like this:
Table of Provisions
Consumable Health Feeling Inspection
"apple" 2 "a tiny bit" "A healthy snack that will help you regain a very small amount of stamina."
"banana" 2 "a little bit" "A healthy snack that will help you regain a little stamina."
"cheese" 4 "significantly" "A wheel of cheese. A must-have for any adventurer who has taken an arrow to the knee."
(Apologies if the columns don’t line up. I’m not sure how to do that.)
Effectively, what the code should do is create an apple kind of edible thing, then give the player an apple; create a banana kind of edible thing, then give the player a banana; and create a cheese kind of edible thing, then give the player cheese.
I know I could easily define these kinds outside of a loop and a table, but the idea is one of authorial simplicity–simply fill out the table, and the game will do the rest of the work for you, irrespective of how many objects you create. Think of it like a tool.
Any suggestions on the above would be greatly appreciated. I’m still at the point with Inform 7 of writing three lines of code, then spending 1 hour trawling the internet trying to work out how to do what I want it to, with the correct syntax. I thought it was about time I made use of posting in this forum rather than just searching it (so thank you for everyone who has ever answered a beginner’s query such as mine!)