Figuring out how to create multiple things?

I’m working on a project where I’m procedurally generating some details about a person, and then letting the player ‘investigate’ that person by examining their belongings.

(The current framing is a school locker, to determine information about the ‘new kid’ in school.)

I’m trying to figure out / decide on also generating some level of randomness of those belongings.

i.e.
2 - 5 binders,
1 - 3 notebooks
3 - 7 pens,

etc.

Which means I’m trying to figure out how to create an uncertain number of things which I then also want to be persistent once created.

(I’ll have some more logic to indicate the class subject for the binder, for example, as well as some personalized qualities based on the student.)

I’m not quite sure the best method to use. I’ve taken a peek over here:

https://ganelson.github.io/inform-website/book/RB_10_3.html

And maybe I could use some of the ideas, like a ‘school locker limbo’ where a max amount of items lives, and then pull from (and personalize) those items as per some logic.

But I’d love any thoughts of other methods! Still an Inform 7 newbie, so I’m happy to explore other ideas.

1 Like

There might be better ways, but…

And I didn’t do this 'cause it’s a bit more complicated than I can handle now, but you could create a value that varies “pen-color” “the pen-colors are blue, red, green, sparkle-glitter, and black” and I assume you’d run through pens in the locker and say “now the pen-color of item is the next pen-color” (there’s a way to cycle through and assign them I believe?)

3 Likes

Thank you for drafting that snippet! And showing it as something run-able makes it clear how it’s working.

Yeah, I’ll vary the pen color, probably by random choice from a table, or work through a list like you showed.

I’m also going to apply ‘stickers’ to binders as part of determining the nerd/jock affiliation of the student, I’ve already drafted some code to randomly select based on a global variable for that student, so I should be able to squeeze that into the creation process for the binder.

1 Like