Item generation and other misc newb questions...

Just noting that Skinny Mike pointed out on another thread that I needed “[is-are a list of things…]” in one pair of brackets, instead of “[is-are] [a list of things]…” in two brackets.

Yeah I caught that. Thanks guys. Glad to know it was simply a matter of changing the comma to a colon. I could have sworn I tried the colon already, several times actually, but I’m sure I screwed something else up and then gave up too quickly.

If anyone is curious, the resulting code looked like this:

Instead of taking inventory: 
    say "[line break]What are you [italic type]blind[roman type] or is your amnesia really that severe? In your hands, you're carrying [a list of things carried by the player].[no line break][if the player wears something] You are wearing [a list of things worn by the player including contents].[no line break][end if] [If a thing worn by the player incorporates a container][checkholdall][no line break][end if][if price of money is greater than $0.00] You currently have [price of money] in cash.[no line break][end if][line break]".

To say checkholdall:
	repeat with satchel running through player's holdalls enclosed by the player:
		say "[The satchel] contain[s] [a list of things in satchel]. ".

So I’d get this:

take inventory

What are you blind or is your amnesia really that severe? In your hands, you’re carrying nothing. You are wearing your jacket and a backpack (in which are your camera and your handy-dandy notepad). The backpack contains your camera and your handy-dandy notepad. The left pocket contains your pack of cigarettes. The right pocket contains a wallet. The jacket pocket contains your writing pen and your lighter. You currently have $9.00 in cash.

It’s not perfect. I’m not a fan of the “in which are” stuff. But it works. Also, these are listing off the starting items, which all are conveniently named “your ____”, but if you pick up items later, it will be a bit inconsistent with “a” and “your.”

I don’t know if there’s a simple way to change the “in which are” stuff – it looks like it’s handled in I6. Probably there’s an extension out there that lets you handle it. I wrote this up:

[code]Instead of taking inventory:
say “[line break]What are you [italic type]blind[roman type] or is your amnesia really that severe? In your hands, you’re carrying [a list of things carried by the player].[no line break][if the player wears something] You are wearing [a list of things worn by the player].[no line break][end if] [If a thing worn by the player incorporates a container][checkholdall][no line break][end if][line break]”.

To say checkholdall:
repeat with satchel running through player’s holdalls enclosed by the player:
say "[The satchel] contain[s] [a list of things in satchel]. ".

Rule for printing the name of a worn container (called satchel) while taking inventory:
unless satchel contains something:
say “empty [printed name of satchel]”;
otherwise:
say “[printed name of satchel], which contains [a list of things contained by satchel]”.

Rule for printing the name of a carried container (called satchel) while taking inventory:
unless satchel contains something:
say “empty [printed name of satchel]”;
otherwise:
say “[printed name of satchel], which contains [a list of things contained by satchel]”.[/code]

but it probably requires a lot more refinement if you want it to work. (For instance, I’m pretty sure it will automatically list the contents of closed opaque containers). But if you want to waste some time twiddling around with it, which is what I’ve just been doing, it could be a fun place to start! There are almost certainly better solutions involving extensions though.

A note: I seriously advice against such a complicated storage system. The player shouldn’t be harassed by inventory management, unless it is a matter of a puzzle (and, that said, that kind of puzzle is as old as time).
I understand what you are doing is far more realistic than having the PC i.e. carry around a ladder, three pigeons and a llama, but for enjoyment sake the latter is best. One holdall is sufficient, imo, or you should make the items available no matter what you type ingame. Or else, all your player will be bored to death…

By default, typing “take [something]” will automatically trigger the removing it from action in I7 if the thing is visible and contained within something else. The player never has to type “take/remove [thing] from [other thing]” if they don’t want to.

What if you carry the chip in the left pocket and “activate computer” on the desk? Also, although realistic, I hardly see the economy of “put key in left pocket, put wallet in backpack”. That was my point.

Thanks for everyone’s help.

I’ve got one more simple question. Is there like a proceed or something? I’m trying to make it so the player cannot leave the room unless he has his gun with him.

Instead opening OfficeDoor:
	unless the player has your gun:
		say "Hold up, you don't want to leave without your gun, do you?";
	otherwise:
		continue opening OfficeDoor.

I also tried

Before opening OfficeDoor:
	unless the player has your gun:
		say "Hold up, you don't want to leave without your gun, do you?" instead;
	otherwise:
		continue opening OfficeDoor.

I realize “continue” should only be used for creating rules. I feel like there’s a simple solution somewhere, but I cannot seem to find it. I did try “try opening OfficeDoor.” but of course, Inform doesn’t like it that I put the same action in the instead condition (“instead of opening the door, open the door.”)

How do I fix this??

You want “continue the action”.

A more Informish way, though, might be to write a more specific rule – one that only triggers when the player doesn’t carry the gun, anyway.

Instead of opening the office door when the player does not carry the gun: say "Hold up, you don't want to leave without your gun, do you?"

Nevermind. I figured it out. You just don’t need the continue.

Yes, an instead rule that runs stops the action by default – unless you tack on a “continue the action”. That means that check, carry out, after, and report rules for that action will not be considered. It also means that you do need a “continue the action” if you use the “instead of opening the door” rule. That rule will run any time you try to open the door: if you don’t carry the gun, it will remind you to take it; if you do carry it, the rule will do nothing, not even open the door. (If you use the “instead of opening the door when the player does not carry the gun”, the rule will only ever run and stop the action if you try to open the door while not carrying the gun. On trying to open it while holding the gun, that specific rule will not be considered – and so the door will be opened as ordinary.)