I’m creating a text adventure where the player is controlling a robot. I was also planning on the player having the ability to name the robot or something like that. Is there any way I can do this easily.
Example
[name] opens the dorr
[name] is holding
item 1
In one of my games, I had a cat the player could name. Here’s the source code to that. Many props to A.Schultz for helping me with it.
> Section 1.1 - Cat
>
> a cat is an animal in Among the Books. "Lounging among the books is your cat, [Nickname of the cat in sentence case]."
>
> instead of saying hello to cat:
> say "You talk to [nickname of cat in sentence case] for a little bit. Although he doesn't talk back, he pays keen attention to you and [italic type]meows[roman type] appropriately."
>
> the cat has some indexed text called the nickname.
>
> the nickname of the cat is "Bookstore Cat".
>
> understand the nickname property as describing the cat.
>
> rule for printing the name of the cat when the nickname of the cat is not "Bookstore Cat":
> say "[nickname of the cat in sentence case]"
>
> naming it with is an action applying to one thing and one topic.
>
> understand "name [something][text]" as naming it with.
>
> check naming it with:
> say "You can't name that."
>
> instead of naming the cat with "nothing":
> now the nickname of the cat is "nothing";
> now the cat is improper-named;
> say "You revoke your choice of cat-name."
>
> instead of naming the cat with something:
> let N be the indexed text;
> let N be the "[the topic understood]";
> replace the text "'" in N with "";
> now the nickname of the cat is "[N]";
> now the cat is proper-named;
> say "The cat is now known as [nickname of the cat in sentence case]."