So in bed last nite I had some ideas about making an object like a trunk which can have stuff both inside it and on top of it. And which, if opened while items are on top of it, the items fall off.
Well, those ideas didn’t exactly work out right LOL (using Before, Instead, and After)
So I came up with something else, using Check, Carry Out, and Report. I also added flexible descriptions to both the trunk and the room to describe what is in or on it.
The problem I’m having is how it keeps printing “(the Trunk)” every freakin command involving the trunk. How do I suppress that? I’m not sure where in the process that gets printed, or even what is printing it, or why.
Example game interaction:
>x trunk (the Trunk) Your standard green metal trunk, which is open. >close trunk (the Trunk) You close the Trunk. >x trunk (the Trunk) Your standard green metal trunk. >take stuff Taken.
Comments and critiques on the code are appreciated, as I’m still pretty n00b with Inform 7.
Also, what about that commented out Tables section? I was thinking I could simplify my Check, Carry Out, and Report code by checking tables for both the trunk inside and trunk top to determine which actions would apply to which trunk part. It would make it easier to add more actions, rather than having to write more Check, etc… rules. Or maybe that idea isn’t workable. S’why I’m asking.
"Supporter Containers - The Trunk" by "V.C.Stegeman" Volume - Setup Book - Bookkeeping Part - Initialization Use no scoring. Use American Dialect and the serial comma. The story headline is "Supporter Container". The story description is "Things on the trunk fall off if the chest is openened after the player is warned about it. The game autoreports things on or in the trunk as appropriate.". The story genre is "Learning". The release number is 1. The story creation year is 2021. Book - Tables (Could this be used to hold a list of actions respective of the part being interacted with) [ Table of Trunk Interior options "inserting it into" Table of Trunk Top option "putting it on" ] Book - Geography Part - Map The Laboratory is a room. The description is "[lab description]". To say lab description: Say "Clean white empty walls everywhere. Smack in the middle of the floor is"; If the Trunk Interior is open: Say " an open green metal trunk.[If something is inside the Trunk Interior] Inside the trunk is [a list of things inside the Trunk Interior].[no line break]"; Otherwise: Say " a green metal trunk[if something is on the Trunk Top]. On top of it is [a list of things on the Trunk Top][end if].[no line break]". Book - People The player is a person in the Laboratory. Book - Things Part - The Trunk The Trunk is in the Laboratory. It is scenery. It is unmentioned. The description is "Your standard green metal trunk[trunk description].". To say trunk description: If the trunk interior is open: Say ", which is open[If something is inside the Trunk Interior]. Inside it is [a list of things inside the Trunk Interior][end if]"; Otherwise if something is on the Trunk Top: Say ". On top of it is [a list of things on top of the Trunk Top]". The Trunk Interior is part of the Trunk. It is a container. It is openable. It is closed. The printed name is "Trunk". The Trunk Top is part of the Trunk. It is a supporter. The printed name is "Trunk". Check opening the Trunk: Now the noun is the Trunk Interior; Continue the action. Carry out opening the Trunk Interior: If something is on the Trunk Top: Say "As you open the trunk [a list of things on the Trunk Top] falls off it and onto the floor."; Repeat with Item running through list of things on the Trunk Top: Now the Item is in the Laboratory; Now the Trunk Interior is open; Stop the action; Otherwise: Say "You open the trunk."; Continue the action. Report opening the Trunk Interior: Stop the action. Check closing the Trunk: Now the noun is the Trunk Interior; Continue the action. Check inserting something into the trunk: Now the second noun is the Trunk Interior; Continue the action. Check searching the Trunk: Now the noun is the Trunk Interior; Continue the action. Check putting something on the Trunk: If the Trunk Top is open: Say "You can't put things on the trunk while it's open." instead; Otherwise: Now the second noun is the Trunk Top; Continue the action. Report touching the Trunk: Say "The outside of the trunk feels rough and metalic. And cold[If the Trunk Interior is open]. A smooth cloth of some sort lines the interior[End if]." instead. Part - Various Simple Items The Stuff is a thing in the Laboratory. The indefinite article is "some". The description is "Just some stuff." The Gadget is a singular-named thing in the Laboratory. The indefinite article is "the". The description is "Just some gadget." Volume - The Game Itself Book - Testing Commands - Not for release Test me with "take all/put gadget on trunk/examine trunk/open trunk/put stuff in trunk/examine trunk/close trunk/examine trunk/look/open trunk/look/close trunk/put gadget on trunk/look" Test supporting with "take all/put all on trunk/examine trunk/open trunk" Book - Game Play