Seems like this should be a straightforward piece of code but I can’t figure it out.
Here’s the test code:
Lab is a room.
To decide what K is a random member of (list - list of values of kind K):
let length be the number of entries in the list;
let index be a random number between one and length;
decide on entry index of the list.
To decide what text is lab-description-001:
let description-parts be {
"Part-001-001.",
"Part-001-002.",
"Part-001-003."
};
decide on a random member of description-parts.
To decide what text is lab-description-002:
let description-parts be {
"Part-002-001.",
"Part-002-002.",
"Part-002-003."
};
decide on a random member of description-parts.
To decide what text is lab-description-003:
let description-parts be {
"Part-003-001.",
"Part-003-002.",
"Part-003-003."
};
decide on a random member of description-parts.
To decide what text is lab-description:
decide on "[lab-description-001] [lab-description-002] [lab-description-003]".
Fooing is an action applying to nothing.
Understand "foo" as fooing.
Instead of fooing:
now description of lab is lab-description.
Test me with "l/foo/l/l/l".
The expected behavior is the description of the room only randomizes when I enter ‘foo’.
The observed behavior is the description of the room also randomizes when I enter ‘l’.
I’ve tried a bunch of permutations:
Instead of fooing:
now description of lab is "[lab-description]".
Instead of fooing:
let str be [lab-description];
now description of lab is str.
Instead of fooing:
let str be "[lab-description]";
now description of lab is str.
None of these ideas work. I feel like there is something fundamental I don’t understand about function invocation in this language. Can someone help me with my confusion?