Hi everyone! In my IF I have a pitchfork and I need to put a feather on it. I wrote this:
the pitchfork is in room1. "A pitchfork made of wood and iron. Its teeth are dirty with blood and feathers.".
the feather is on the pitchfork. "A bloodstained black feather.".
If I only write about the pitchfork, It (the pitchfork) can be taken and be carried by the player. But if I write also the second line about the feather, the pitchfork cannot be taken anymore. Why this? is it wrong the “on” preposition? I need that if the player doesn’t take tha feather but takes the pitchfork and then he change room, he can take the feather anyway… What can I do to fix this?
There’s nothing wrong with your code so far! When you write “the feather is on the pitchfork” Inform figures out that the pitchfork has to be a supporter. Supporters are by default fixed in place (often they’re things like tables), but you can change that by explicitly saying they’re “portable”:
…though a side effect of having the pitchfork be a supporter is that you will be able to put anything whatsoever on the pitchfork. You might not want this. If you don’t, you could make the feather part of the pitchfork; then the feather will come along with the pitchfork when you move it.
The feather is part of the pitchfork.
But if you do this, you will find that the player can’t take the feather.
The way to get around this is to figure out what rule is preventing the taking action from working. We can do this by typing “rules” at the game prompt and then trying the action. This will list all the rules that are being tried:
It’s the “can’t take component parts” rule that is stopping the action. So we turn that rule off for the specific case of taking the feather:
The can't take component parts rule does nothing when taking the feather.
Not really related, but when you put text in quotation marks right after an object name like that, it usually creates an initial appearance property, which shows up in the room description, rather than the description, which shows up when you examine it. You probably want the description here. You can specify that explicitly:
The description of the pitchfork is "A pitchfork made of wood and iron. Its teeth are dirty with blood and feathers."
…and it might be nice to allow “blood” and “feathers” to refer to the feather so the player is directed to the words that will let them refer to the object, and to give the feather a different description depending on whether it’s on the pitchfork. So:
[code]room1 is a room.
the pitchfork is in room1. The description of the pitchfork is “A pitchfork made of wood and iron. Its teeth are dirty with blood and feathers.”
the feather is part of the pitchfork.
The description of the feather is “[if the feather is part of the pitchfork]One particular bloodstained black feather sticks up from the pitchfork[otherwise]A bloodstained black feather[end if].”
Understand “blood” or “feathers” as the feather.
The can’t take component parts rule does nothing when taking the feather.[/code]
(You might also want to create a special object for the leftover feathers, which starts out of play but becomes part of the pitchfork once you’ve taken the black feather, so the player can look at the rest of the feathers once they’ve got the black one. But that’s for another time, perhaps.)