Hello! It’s me again. I hope you all had good holidays, and that the first month of the year treated you well.
My questions now I think are a little more complex.
How do I affect descriptions directly? Like… in the basic form of the game, it tells you what room you’re in, what is in there with you, etc. But how do I make it so that, when the player enters the room, my description of the action and the setting play and the game just leaves it at that? I feel that I may be seeking more power over the system than is possible, which I hope isn’t the case.
I would like to have an inventory like a backpack, where it can be removed, have limited space, and you can’t carry/pick-up things if it is removed or full. How would I go on about this?
What I’m working on has a npc that follows the player, and is important for completing the game. There are… several things I want to know about this. Like, how do I get the npc to follow the player automatically once the player enters the room the npc is in (they don’t start in the same room)?
I don’t want the player telling the npc to stay in one spot for certain areas, so how do I implement a description where that doesn’t work? Maybe even for this description to have variations in different areas?
And likely the most complex thing, a certain phrase needs to be said in order to speak with the npc. So I need to implement descriptions for trying to speak with the npc prior to stating the phrase, a confirmation that the phrase was said correctly, and a way to make the state temporary, preferably for areas and not singular rooms. Perhaps even the temporary state being based on how many rooms you pass through, repeated or new.
Any and all help is much appreciated, and thank you if you take the time to do so!
Start by reading the documentation, which has a lot of examples that may be very close to what you want to do. Then you can modify those examples and ask for help about how to tweak them.
1.) I’m not sure what you’re asking here. If you make things scenery, Inform won’t list them after the room description. If this isn’t what you mean, ask this one again a little more specifically.
2.) Reading the examples about a holdall may help here.
4 & 5) Conversation is a little tricky, but chapter 7 in the documentation, starting with 7.6, covers a lot of territory about how to talk to NPCs. There are many useful examples in those sections.
I started learning Inform by copying examples from the docs and then changing them one thing at a time to see what each thing did. My biggest problem with the docs is finding the correct search term-- for instance, I was searching for the section on the holdall but I was sure it was called a carryall and at first I couldn’t find it. So make a good effort to search for stuff you want in the docs (I searched for “backpack” to finally find the section the holdall), but don’t hesitate to ask here if you can’t find the correct search term. But the docs can be really useful if you read through the examples and mess around with them in your own project.
The automatic room description which appears when the player enters a room is generated by a report going rule, called the “describe room gone into rule”. You can prevent this in several ways. The easiest is probably to write an after going rule covering the case. (An after rule will stop the report rules from running, unless they include “continue the action”.) Or you could disable the library rule directly with, for example,
The describe room gone into rule does nothing when the location is the Chamber of Horrors.
If I understand you correctly, you want everything the player takes to be automatically put in this “backpack”, and never held directly by the player. That’s going to be complicated, because a lot of Inform actions expect the noun to be held; I think you’d be working against Inform all the way. A fairly close solution would be:
The player has carrying capacity 1.
The backpack is a wearable container. It has carrying capacity 6.
The player will be able to take one thing in their hands; the worn backpack and its contents won’t count to that limit.
I recommend against doing this; it will probably make your game very tedious to play.
It sounds like you want to give your NPC a binary flag recording whether he’s following the player or not.
Alphonse_following is a truth state that varies.
Last carry out going:
if Alphonse_followingis true and Alphonse is in the room gone from:
try Alphonse going the noun.
You can probably just create an exception.
Carry out answering Alphonse that "stay": now Alphonse_following is false.
Instead of answering Alphonse that "stay" in the Dark Thicket: say "Alphone whinges, and sticks even closer to your heel."
I don’t quite get what you want here, so I’m guessing a bit. It does sound fairly complicated. Is something like this what you want? (It’s very rough.)
The Weird Forest is a region.
Every room in the Weird Forest has a truth state called password_given.
Eery glade is in the Weird Forest. Dark thicket is in the Weird Forest.
Dark thicket is north from Eery glade.
Alphonse is an animal in Eery glade.
Table of Passwords
Site Topic
Eery glade "xyzzy"
Dark thicket "frotz"
To decide whether the password is uttered:
if the topic understood matches the topic corresponding to the site of the location in the Table of Passwords:
decide yes;
decide no.
Alphonse_following is a truth state that varies.
Carry out answering Alphonse that "stay": now Alphonse_following is false.
After answering Alphonse that "stay": say "Alphonse yips."
Carry out answering Alphonse that "heel": now Alphonse_following is true.
After answering Alphonse that "heel": say "Alphonse barks."
Instead answering Alphonse that when the password is uttered:
now password_given of the location is true;
say "Alphonse pricks up his ears."
To decide whether Alphonse follows:
if Alphonse_following is false:
decide no;
if password_given of the location of Alphonse is false:
decide no;
decide yes.
Last carry out going:
if Alphonse is in the room gone from and Alphonse follows:
try Alphonse going the noun.
Test me with "Alphonse, heel / n / s / Alphonse, xyzzy / n"
(Alternatively, you could do it all with the “alphonse_following” flag, by writing rules to switch is to false whenever you enter a new room, and adapting the rule that sets it to true so that it checks whether the password has been given. Then you wouldn’t need the “to decide whether Alphonse follows” phrase. Which is better depends on the details of what you’re doing. probably.)
Edit: I realize that I forgot to deal with the timer condition. Sorry, I don’t have time to think about it now, but it won’t be hard; you could use a “future event” (see manual), or implement a turn counter yourself.