I’m making my own IF engine in Python. But I have a question about take all command.
The objects can contain another object and that object can contain another object ad infinitum. The same with placing objects on top of objects.
Now, I coded the command to put all the objects in the inventory even though the object might be inside or on a object.
Now, I posed this question on a interactive fiction community on a social media platform, they recommended to me to only put the visible objects directly in inventory. So the objects inside of an object would no be put in unless the containing object is open. But the objects on top are okay to put in inventory.
Placing all the items in the inventory regardless of visibility on TAKE ALL makes the game less fun.
-Listing every item in the inventory on TAKE ALL takes away the thrill of exploration and discovery that gives parser IF its special attraction.
-It makes the game susceptible to TAKE ALL lawnmowering, where you can just enter any room and get every object with one simple command. Even if a box is added to the inventory list, its contents should remain hidden until the box is opened.
There have been more than a few instances where I simply wanted to take all the stuff I saw lying on a workbench and was surprised I had inadvertently also picked up a hidden postcard with a picture of a unicycling billygoat playing the saxophone while juggling bananas. This, I felt, was disappointing.
I agree with @rovarsson. TAKE ALL should only take all objects in scope in the room, not objects in containers or on supporters, or objects that aren’t in scope. Otherwise, you end up with some nasty surprises and TAKE ALL becomes more trouble than it’s worth.
For containers and supporters, you need TAKE ALL FROM SHELF or what have you. That way, there’s no nasty surprises.
…we-ell… Stuff on supporters is a bit of an in-between case to me. If the wrench is on the workbench or the candle is on the side table, I would expect TAKE ALL to grab it.
A book high in a book case or a box of rat poison in the back of a dusty shelf would not be so easily reached.
Of course, in the first case, those objects would probably already be visible when entering the room, whereas the others would require discovering them to bring them in scope.
Right bringing them in scope. In my mind, a cabinet is also and object that’s a container. So you would have to open the cabinet to see hidden stuff.
But what to do if stuff is hidden? Hmm this posses a problem. With some engines, people have put things in a hidden room until it was time to show them. But I can do something a little different and more sophisticated like give an object a hidden flag. And code to go with it for various commands. Hmm. You made me think. Thanks.
I think you want to distinguish between fixed containers and supporters (tables, open cabinets) and portable ones (a tray of crackers, the player’s backpack that they dropped).
I would think in a logical sense though you can see them in the jar unless you open the jar I wouldn’t put the pennies in the inventory but just the jar.
So, the first fix seemed to be a quick one and it was to add the if statement:
if vprop.is_open:
In my engine, props are objects. Yeah, I took my nomenclature from theater. But this is in a recursive function. So, if the container is open, I’m saying you can see it and you are putting it in inventory. It may not satisfy all situations, but I have to draw the line somewhere.