In my WIP, the player will eventually accumulate several notes. The player’s inventory becomes quite extensive, and searching through your inventory to find which papers you have and which you don’t becomes tedious. I would like to make it so that all of these are grouped together in the inventory.
I know that this could easily be done similar to the keyring from Locksmith. However, I do not want to have a notebook or folder-type container.
I simply want to list them in a group instead of in whatever order inform decides on to print the inventory.
Is this possible, or would it be simpler to just include a folder/notebook object to contain them?
“Notebook” and “folder” are just names. If you make a container called “notes” it doesn’t matter if it’s implemented the same way as a physical object. You could even make it privately-named to make sure the player can’t refer to it directly.
So I tried the advice in section 17.13 and 17.14, but it didn’t produce the results I expected.
What this did was group them together as a single object in inventory, like so:You are carrying:
a dead parrot
five notes (receipt, sheet of paper, post-it, letter to M and letter to D)
a can of spamAnd that’s not what I want.
So I made my own object, but I used Juhana’s advice to make it privately-named.
It’s a supporter that the player invisibly and unobtrusively acquires whenever they carry more than one note object, and that disappears when only one is carried. Perhaps this will be useful to someone else?[code]Note is a kind of thing.
NotesFolder is a supporter. It is off-stage. NotesFolder is privately-named and portable. The printed name of the NotesFolder is “the following notes:”
After the player taking a note:
if the player does not carry the NotesFolder:
let NoteSum be 0;
repeat with target running through things carried by the player:
if target is a note:
increment NoteSum;
if NoteSum is 2:
now the player carries the NotesFolder;
repeat with target running through things carried by the player:
if target is a note:
now the target is on the NotesFolder;
now the noun is on the NotesFolder;
otherwise:
now the noun is on the NotesFolder;
continue the action;
Before dropping a note:
if the noun is on the NotesFolder:
now the player carries the noun;
continue the action;
After the player dropping a note:
if the player carries the NotesFolder:
let NoteSum be 0;
repeat with target running through things on the NotesFolder:
increment NoteSum;
if NoteSum is 1:
repeat with target running through things on the NotesFolder:
now the player carries the target;
now the NotesFolder is off-stage;
continue the action;
[/code]When I use it, I get the following, nicely formatted listing:You are carrying:
a dead parrot
the following notes:
receipt
sheet of paper
post-it
letter to M
letter to D
a can of spam
For something similar, check out the AARP-Gnosis example in the Recipe Book. It doesn’t do exactly what you want, it highlights a different way to dynamically group things together.