Hi! I hope this is the right place.
I’m trying the Puny Inform jam and have some clothing with a pocket and something in the pocket.
My problem is working out how to connect a thing in the pocket to the pocket to the clothing.
Either the pocket exists in the room when you look or you see it when searching the thing the clothing is found in.
The clothing is in a pile. The pocket is in the clothing (you look at the clothing to find the pocket). The item is in the pocket.
I tried defining the object in a void and not attached to anything then MOVE to pocket to the dressing gown once you search the dressing gown but that didn’t seem to help.
Hi! I hope this is the right place.
Hmm I found this and thought it would help:
but I get a warning about “self.prop intended?”
OK I found add_to_scope should be after description. But it still doesn’t exist.
Ohh! I got it now!
It’s all working.
How did you get this to work?
I am having a similar problem with the PC wearing pants. Even setting article to “the” and has the attribute clothing, I am having trouble with Inventory.
It indicates that the pants are carried (worn).
I may have to use add_to_scope or something similar to make it more realistic. ?
Mine is basically like this:
(The coat was found in something so has two → arrows).
Object -> -> Coat "Coat" with name 'coat' description "It's a lovely coat.", add_to_scope Pocket, after [; Wear: score = score + 10; "You slip your arms into the Coat"; ], has clothing;
Object Pocket "pocket" with name 'pocket', description "You notice something in the pocket.", add_to_scope Mouse, after [; Look: "It looks like a mouse is in there!"; ], has container openable;
This sounds like expected behaviour. Worn items show up in the inventory with (worn) after.
Would you like the pants to always be there, but not listed? Then you can create an add_to_scope routine for the player which puts them in scope.
Jason: Glad you got it to work!
You may want to put the mouse in the pocket instead.
And note that the score will go up every time they put on the coat. One way to handle it is give the coat the general attribute when you hand out the score, and check for it before handing out the score. Another way is to use tasks (Library of Horror does this).
Thank you Fredrik,
I am into the coding groove. I stayed up into the small hours last night and found a combination of location, scenery and scope that will combine to make the narrative fit my intentions. This is good exercise for the old guy.
Just to summarise, the coat is an object that can be worn.
The pocket is a sub-object of the coat. As the coat is not a
container or a
supporter, you have to either make the coat
transparent or use
add_to_scope so that you can see the pocket. The latter is preferred in this case. The pocket is a
The mouse is placed in the pocket. This is correct, as the pocket is a
container. The pocket does not need
Note that you will need to use a
before routine with the pocket to ensure that you can’t put a ladder or vicious bulldog in the pocket. For this, see the standard library’s
Receive fake action as discussed in the DM4. I assume PunyInform will handle this the same way.
Just as a follow-up to this, I forgot that if you have a container whose parent is a sub-object of another object, but is not a container or supporter itself, then you can never get the contents of the container (the pocket, in this case). So, the sub-object has to be a supporter.
The library has a tricky task of trying to decide what you can see, what you can touch, what you can take, and how far light from an object reaches, when the player may be in / on something, and there are containers, supporters, things held by actors, things connected to other things, things dragged into scope, and transparent objects.
If we can work out the logic of how this can be improved, we could certainly have a go at improving it.