I’m adapting code from Ryan Veeder’s Island of Dr Wooby:
(https://www.rcveeder.net/blog/2017/05/17/procedural-generation-of-dinosaurs-in-inform-7/)
The idea being that I’m trying to generate a randomized student with certain biographical backgrounds.
But using the ‘repeat with’ command in generally the same way Ryan does is giving me an error: (I’m getting a few errors but this is the first one!)
But I didn’t recognise ‘bio_storys incorporated by student_biography’.
The name ‘bio_fact’ doesn’t yet exist.
As far as I can tell, ‘repeat with’ is supposed to use a new value, and that’s who Ryan is using it, so I’m not sure why it’s causing a problem here!
My code below:
"student building" by "Jason Mehmel"
Book 1 - making students
A student is a kind of thing.
A generated_student is a kind of thing.
A locker_owner is a kind of thing.
A blank_human is a kind of thing.
Section 1 - Index of bio-stories
A bio_story is a kind of thing.
A bio_story has text called flavour.
A thing can be marked.
Section 2 - biography
A Student_Biography is a kind of bio_story. A Student_Biography is a part of every locker_owner.
Student_economics is a kind of value. The student_economics are rich, middle-class, and poor.
Understand the student_economics property as describing a student_biography.
Student_home is a kind of value. The student_homes are downtown, suburbs, and country.
Understand the student_home property as describing a student_biography.
Student_parents is a kind of value. The student_parents are divorced, married, separated, blended, foster, and adopted.
Understand the student_parents property as describing a student_biography.
A student_biography has student_economics. The student_economics of a student_biography is usually middle-class.
A student_biography has student_home. The student_home of a student_biography is usually suburbs.
A student_biography has student_parents. The student_parents of a student_biography is usually married.
This is the biographize rule:
let the current student_biography be a random student_biography;
now the student_economics of the current student_biography is a random student_economics;
now the student_home of the current student_biography is a random student_home;
now the student_parents of the current student_biography is a random student_parents;
rule succeeds with result student_biography.
A locker_owner has text called the impression.
The description of a locker_owner is usually "[the impression of the noun].".
To say the impression of (student - locker_owner):
let L be a list of texts;
repeat with bio_fact running through bio-storys incorporated by student_biography:
if bio_fact is a student_economics:
add "[flavor of bio-fact] economic class," to L;
if bio_fact is a student_home:
add "[flavor of bio-fact] housing location," to L;
if bio_fact is a student_parents:
add "[flavor of bio-fact] family background," to L;
sort L in random order;
say "What we know about The Student: [L] but we need to find out more. That's where you come in."
Book 2 - game begins
When play begins:
follow biographize rule.
The office is a room.
There is a boy in the office. The boy is a locker_owner.